File:  [NetBSD Developer Wiki] / wikisrc / users / leot / aarch64_problems.mdwn
Revision 1.9: download - view: text, annotated - select for diffs
Sat Jul 28 19:14:29 2018 UTC (4 years, 10 months ago) by leot
Branches: MAIN
CVS tags: HEAD
Update the mpv entry.

Now the problem is in the userland and we have a .core!

    1: # Various (possible) problems of aarch64
    2: 
    3: Here a list of possible problems of NetBSD/evbarm aarch64 that needs further
    4: investigation in order to write proper PR or better yet to fix them!
    5: 
    6: 
    7: ## `mpv` and NetBSD crashes
    8: Just by invoking `mpv` via:
    9: 
   10:     % mpv
   11: 
   12: It SEGV as follows:
   13: 
   14:     % mpv
   15:     /usr/pkg/lib/ffmpeg4/libavcodec.so.58: text relocations
   16:     mpv 0.29.0 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
   17:      built on Sat Jul 28 21:02:57 CEST 2018
   18:     ffmpeg library versions:
   19:        libavutil       56.14.100
   20:        libavcodec      58.18.100
   21:        libavformat     58.12.100
   22:        libswscale      5.1.100
   23:        libavfilter     7.16.100
   24:        libswresample   3.1.100
   25:     ffmpeg version: 4.0.2
   26:     
   27:     Usage:   mpv [options] [url|path/]filename
   28:     
   29:     Basic options:
   30:      --start=<time>    seek to given (percent, seconds, or hh:mm:ss) position
   31:      --no-audio        do not play sound
   32:      --no-video        do not play video
   33:      --fs              fullscreen playback
   34:      --sub-file=<file> specify subtitle file to use
   35:      --playlist=<file> specify playlist file
   36:     
   37:      --list-options    list all mpv options
   38:      --h=<string>      print options which contain the given string in their name
   39:     
   40:     [1]   Segmentation fault (core dumped) /usr/pkg/bin/mpv...
   41:     % gdb -core mpv.core /usr/pkg/bin/mpv
   42:     Reading symbols from /usr/pkg/bin/mpv...done.
   43:     [New process 5]
   44:     [New process 6]
   45:     [New process 4]
   46:     [New process 3]
   47:     [New process 2]
   48:     [New process 1]
   49:     Core was generated by `mpv'.
   50:     Program terminated with signal SIGSEGV, Segmentation fault.
   51:     #0  0x0000f96f727f40b0 in memcpy () from /usr/lib/libc.so.12
   52:     [Current thread is 1 (process 5)]
   53:     (gdb) bt
   54:     #0  0x0000f96f727f40b0 in memcpy () from /usr/lib/libc.so.12
   55:     #1  0x00000002001cba34 in __memcpy_ichk (len=18446744073709551615, src=0xf96f6e10fec0, dst=<optimized out>)
   56:         at /usr/include/ssp/string.h:82
   57:     #2  strndup_append_at (str=str@entry=0xf96f6f4ff348, at=0, append=0xf96f6e10fec0 "speed", append_len=<optimized out>,
   58:         append_len@entry=18446744073709551615) at ../ta/ta_utils.c:113
   59:     #3  0x00000002001cbea4 in ta_strdup_append_buffer (str=str@entry=0xf96f6f4ff348, a=<optimized out>) at ../ta/ta_utils.c:165
   60:     #4  0x00000002001cb7b8 in ta_talloc_strdup_append_buffer (s=<optimized out>, s@entry=0x0, a=<optimized out>) at ../ta/ta_talloc.c:31
   61:     #5  0x0000000200157eec in print_str_list (opt=<optimized out>, src=<optimized out>) at ../options/m_option.c:1477
   62:     #6  0x000000020015db90 in m_option_print (val_ptr=0xf96f6f4ff3c0, opt=0xf96f6f4ff430) at ../options/m_option.h:496
   63:     #7  m_property_do (log=0xf96f71045130, prop_list=0xf96f71081040, name=name@entry=0xf96f6e139218 "property-list",
   64:         action=action@entry=6, arg=arg@entry=0xf96f6f4ff598, ctx=ctx@entry=0xf96f71011040) at ../options/m_property.c:127
   65:     #8  0x000000020016f9f8 in mp_property_do_silent (name=0xf96f6e139218 "property-list", action=6, val=0xf96f6f4ff598, ctx=0xf96f71011040)
   66:         at ../player/command.c:4167
   67:     #9  0x0000000200171014 in mp_property_do (name=0xf96f6e139218 "property-list", action=action@entry=6, val=<optimized out>,
   68:         val@entry=0xf96f6f4ff5c8, ctx=0xf96f71011040) at ../player/command.c:4177
   69:     #10 0x00000002001637bc in getproperty_fn (arg=0xf96f6f4ff5d8, arg@entry=0xf96f6f4ff5e8) at ../player/client.c:1261
   70:     #11 0x00000002001655b0 in run_locked (fn_data=0xf96f6f4ff5e8, fn=0x200163648 <getproperty_fn>, ctx=0xf96f6f5071c0)
   71:         at ../player/client.c:1003
   72:     #12 mpv_get_property (ctx=0xf96f6f5071c0, name=name@entry=0xf96f6e139218 "property-list", format=format@entry=MPV_FORMAT_STRING,
   73:         data=data@entry=0xf96f6f4ff668) at ../player/client.c:1335
   74:     #13 0x0000000200179b4c in script_get_property (L=0xf96f6e103400) at ../player/lua.c:794
   75:     #14 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5
   76:     #15 0x0000f96f72b3877c in luaV_execute () from /usr/pkg/lib/liblua5.2.so.5
   77:     #16 0x0000f96f72b2cf04 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5
   78:     #17 0x0000f96f72b28e40 in lua_callk () from /usr/pkg/lib/liblua5.2.so.5
   79:     #18 0x0000000200178270 in load_builtin (L=0xf96f6e103400) at ../player/lua.c:214
   80:     #19 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5
   81:     #20 0x0000f96f72b2cef8 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5
   82:     #21 0x0000f96f72b28e40 in lua_callk () from /usr/pkg/lib/liblua5.2.so.5
   83:     #22 0x0000f96f72b43900 in ll_require () from /usr/pkg/lib/liblua5.2.so.5
   84:     #23 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5
   85:     ---Type <return> to continue, or q <return> to quit---
   86:     #24 0x0000f96f72b3877c in luaV_execute () from /usr/pkg/lib/liblua5.2.so.5
   87:     #25 0x0000f96f72b2cf04 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5
   88:     #26 0x0000f96f72b28e40 in lua_callk () from /usr/pkg/lib/liblua5.2.so.5
   89:     #27 0x0000000200179524 in require (L=L@entry=0xf96f6e103400, name=name@entry=0xf96f6f503420 "@stats.lua") at ../player/lua.c:232
   90:     #28 0x000000020017963c in load_scripts (L=0xf96f6e103400) at ../player/lua.c:260
   91:     #29 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5
   92:     #30 0x0000f96f72b2cef8 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5
   93:     #31 0x0000f96f72b2c4b8 in luaD_rawrunprotected () from /usr/pkg/lib/liblua5.2.so.5
   94:     #32 0x0000f96f72b2d19c in luaD_pcall () from /usr/pkg/lib/liblua5.2.so.5
   95:     #33 0x0000f96f72b28f14 in lua_pcallk () from /usr/pkg/lib/liblua5.2.so.5
   96:     #34 0x000000020017b020 in run_lua (L=0xf96f6e103400) at ../player/lua.c:354
   97:     #35 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5
   98:     #36 0x0000f96f72b2cef8 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5
   99:     #37 0x0000f96f72b2c4b8 in luaD_rawrunprotected () from /usr/pkg/lib/liblua5.2.so.5
  100:     #38 0x0000f96f72b2d19c in luaD_pcall () from /usr/pkg/lib/liblua5.2.so.5
  101:     #39 0x0000f96f72b28f14 in lua_pcallk () from /usr/pkg/lib/liblua5.2.so.5
  102:     #40 0x000000020017b4c8 in mp_cpcall (func=0x20017abd0 <run_lua>, ud=0xf96f6e1010c0, L=0xf96f6e103400) at ../player/lua.c:99
  103:     #41 load_lua (client=<optimized out>, fname=0xf96f6f503420 "@stats.lua") at ../player/lua.c:387
  104:     #42 0x00000002001815c0 in script_thread (p=0xf96f6f5050c0) at ../player/scripting.c:95
  105:     #43 0x0000f96f743ec588 in pthread__create_tramp (cookie=0xf96f6f515000) at /usr/src/lib/libpthread/pthread.c:593
  106:     #44 0x0000f96f727385ec in _lwp_makecontext (u=0x0, start=0x0, arg=0x0, private=0xff00000014,
  107:         stack_base=0x1 <error: Cannot access memory at address 0x1>, stack_size=8589934592) at /usr/src/lib/libc/arch/aarch64/gen/_lwp.c:47
  108:     #45 0x0000f96f743df000 in ?? ()
  109:     #46 0x544a8f02d40034c1 in ?? ()
  110:     Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  111: 
  112: 
  113: ## Python `import requests` SIGILLs
  114: Doing a (please note that also `python36` is affected):
  115: 
  116:     $ python2.7 -c 'import requests'
  117:     Illegal instruction (core dumped)
  118:     Exit 132
  119: 
  120: ...where:
  121: 
  122:     % gdb -core python2.7.core `which python2.7`
  123:     Reading symbols from /usr/pkg/bin/python2.7...(no debugging symbols found)...done.
  124:     [New process 1]
  125:     Core was generated by `python2.7'.
  126:     Program terminated with signal SIGILL, Illegal instruction.
  127:     #0  0x0000f42f5fd00000 in ?? ()
  128:     (gdb) bt 5
  129:     #0  0x0000f42f5fd00000 in ?? ()
  130:     #1  0x0000f42f5fd0a3d0 in restore_errno_only () at c/misc_thread_common.h:43
  131:     #2  0x0000f42f5fbf0f90 in _cffi_f_SSL_library_init (self=<optimized out>, noarg=<optimized out>)
  132:         at build/temp.netbsd-8.99.22-evbarm-2.7/_openssl.c:51839
  133:     #3  0x0000f42f617606ac in PyEval_EvalFrameEx () from /usr/pkg/lib/libpython2.7.so.1.0
  134:     #4  0x0000f42f6175e5c0 in PyEval_EvalCodeEx () from /usr/pkg/lib/libpython2.7.so.1.0
  135:     (More stack frames follow...)
  136:     (gdb) f 2
  137:     #2  0x0000f42f5fbf0f90 in _cffi_f_SSL_library_init (self=<optimized out>, noarg=<optimized out>)
  138:         at build/temp.netbsd-8.99.22-evbarm-2.7/_openssl.c:51839
  139:     warning: Source file is more recent than executable.
  140:     51839     _cffi_restore_errno();
  141:     (gdb) list
  142:     51834   _cffi_f_SSL_library_init(PyObject *self, PyObject *noarg)
  143:     51835   {
  144:     51836     int result;
  145:     51837
  146:     51838     Py_BEGIN_ALLOW_THREADS
  147:     51839     _cffi_restore_errno();
  148:     51840     { result = SSL_library_init(); }
  149:     51841     _cffi_save_errno();
  150:     51842     Py_END_ALLOW_THREADS
  151:     51843
  152:     (gdb) f 1
  153:     #1  0x0000f42f5fd0a3d0 in restore_errno_only () at c/misc_thread_common.h:43
  154:     43      static void restore_errno_only(void) { errno = cffi_saved_errno; }
  155:     (gdb) list
  156:     38         syntactically valid to use "__thread" with this C compiler. */
  157:     39      #ifdef USE__THREAD
  158:     40
  159:     41      static __thread int cffi_saved_errno = 0;
  160:     42      static void save_errno_only(void) { cffi_saved_errno = errno; }
  161:     43      static void restore_errno_only(void) { errno = cffi_saved_errno; }
  162:     44
  163:     45      #else
  164:     46
  165:     47      static void save_errno_only(void)
  166:     (gdb) disas
  167:     Dump of assembler code for function restore_errno_only:
  168:        0x0000f42f5fd0a3b0 <+0>:     str     x30, [sp, #-16]!
  169:        0x0000f42f5fd0a3b4 <+4>:     bl      0xf42f5fd075c0 <__errno@plt>
  170:        0x0000f42f5fd0a3b8 <+8>:     mov     x2, x0
  171:        0x0000f42f5fd0a3bc <+12>:    mrs     x1, tpidr_el0
  172:        0x0000f42f5fd0a3c0 <+16>:    adrp    x0, 0xf42f5fd34000
  173:        0x0000f42f5fd0a3c4 <+20>:    ldr     x3, [x0, #4088]
  174:        0x0000f42f5fd0a3c8 <+24>:    add     x0, x0, #0xff8
  175:        0x0000f42f5fd0a3cc <+28>:    blr     x3
  176:     => 0x0000f42f5fd0a3d0 <+32>:    ldr     w0, [x1, x0]
  177:        0x0000f42f5fd0a3d4 <+36>:    str     w0, [x2]
  178:        0x0000f42f5fd0a3d8 <+40>:    ldr     x30, [sp], #16
  179:        0x0000f42f5fd0a3dc <+44>:    ret
  180:     End of assembler dump.
  181:     (gdb) info reg
  182:     x0             0xf42f5fd34ff8   268484308324344
  183:     x1             0xf42f61875080   268484336898176
  184:     x2             0xf42f6186c848   268484336863304
  185:     x3             0xf42f5fd00000   268484308107264
  186:     x4             0xf42f5ff3c0b8   268484310450360
  187:     x5             0xf42f60000570   268484311254384
  188:     x6             0x65000000000000 28428972647776256
  189:     x7             0x65     101
  190:     x8             0xf42f6185e000   268484336803840
  191:     x9             0xf42f6185e668   268484336805480
  192:     x10            0xf42f6185e668   268484336805480
  193:     x11            0x1      1
  194:     x12            0x30     48
  195:     x13            0xffffff9264f0   281474969527536
  196:     x14            0x65     101
  197:     x15            0x3      3
  198:     x16            0xf42f615bd730   268484334049072
  199:     x17            0xf42f615ec2c8   268484334240456
  200:     x18            0xf42f615ca1a0   268484334100896
  201:     x19            0xf42f5fc9cea8   268484307701416
  202:     x20            0xf42f5fd9c3c0   268484308747200
  203:     x21            0xf42f61307090   268484331204752
  204:     x22            0xf42f5fcd38e8   268484307925224
  205:     x23            0xf42f5fcd10a0   268484307914912
  206:     x24            0xf42f5fb8c5a8   268484306585000
  207:     x25            0xf42f5fd9c3c0   268484308747200
  208:     x26            0xf42f5fbf0f70   268484306997104
  209:     x27            0xf42f5fdd467e   268484308977278
  210:     x28            0xf42f61307090   268484331204752
  211:     x29            0x0      0
  212:     x30            0xf42f5fd0a3d0   268484308149200
  213:     sp             0xffffff926760   0xffffff926760
  214:     pc             0xf42f5fd0a3d0   0xf42f5fd0a3d0 <restore_errno_only+32>
  215:     cpsr           0x60000000       [ EL=0 C Z ]
  216:     fpsr           0x3000000        50331648
  217:     fpcr           0x10     16
  218:     (gdb) quit
  219: 
  220: ...and `_cffi_restore_errno` and `_cffi_save_errno` are defined in
  221: `cffi/_cffi_include.h` as follows:
  222: 
  223:     #define _cffi_restore_errno                                              \
  224:         ((void(*)(void))_cffi_exports[13])
  225:     #define _cffi_save_errno                                                 \
  226:         ((void(*)(void))_cffi_exports[14])
  227: 
  228: The following patch workaround the issue:
  229: 
  230:     $NetBSD: aarch64_problems.mdwn,v 1.9 2018/07/28 19:14:29 leot Exp $
  231:     
  232:     Kludge for NetBSD/aarch64 SIGILL.
  233:     
  234:     --- setup.py.orig	2018-02-27 18:15:41.000000000 +0000
  235:     +++ setup.py
  236:     @@ -70,7 +70,7 @@ def ask_supports_thread():
  237:          ok = (sys.platform != 'win32' and
  238:                config.try_compile('__thread int some_threadlocal_variable_42;'))
  239:          if ok:
  240:     -        define_macros.append(('USE__THREAD', None))
  241:     +        pass
  242:          else:
  243:              ok1 = config.try_compile('int some_regular_variable_42;')
  244:              if not ok1:
  245: 
  246: 
  247: ## polkitd crashes
  248: 
  249:     pinebook# /usr/pkg/lib/polkit-1/polkitd
  250:     Successfully changed to user polkitd
  251:     Error loading /var/run/ConsoleKit/database: Error statting file /var/run/ConsoleKit/database: No such file or directory[1]   Segmentation fault      /usr/pkg/lib/polkit-1/polkitd

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb