Diff for /wikisrc/users/leot/aarch64_problems.mdwn between versions 1.1 and 1.8

version 1.1, 2018/06/18 12:30:36 version 1.8, 2018/07/24 00:09:53
Line 4  Here a list of possible problems of NetB Line 4  Here a list of possible problems of NetB
 investigation in order to write proper PR or better yet to fix them!  investigation in order to write proper PR or better yet to fix them!
   
   
 ## `usbhidctl` and NetBSD crashes on Pinebook  
   
 At least by running:  
   
 ````  
 # usbhidctl -f uhid4 -r  
 ````  
   
 it is possible to crash the Pinebook. Investigate why and if possible get a  
 complete backtrace.  
   
   
 ## `mpv` and NetBSD crashes  ## `mpv` and NetBSD crashes
 Just by invoking `mpv` via:  Just by invoking `mpv` via:
   
 ````      $ mpv
 $ mpv  
 ````  
   
 It is possible to completely crash NetBSD on aarch64. Investigate why and if  It is possible to completely crash NetBSD on aarch64. Investigate why and if
 possible get a complete backtrace.  possible get a complete backtrace.
Line 32  possible get a complete backtrace. Line 18  possible get a complete backtrace.
 ## Python `import requests` SIGILLs  ## Python `import requests` SIGILLs
 Doing a (please note that also `python36` is affected):  Doing a (please note that also `python36` is affected):
   
 ````      $ python2.7 -c 'import requests'
 $ python2.7 -c 'import requests'      Illegal instruction (core dumped)
 Illegal instruction (core dumped)      Exit 132
 Exit 132  
 ````  ...where:
   
 leads to a SIGILL. Trying to reduce the test case this also happens with just a:      % gdb -core python2.7.core `which python2.7`
       Reading symbols from /usr/pkg/bin/python2.7...(no debugging symbols found)...done.
 ````      [New process 1]
 $ python2.7 -c 'import OpenSSL'      Core was generated by `python2.7'.
 Illegal instruction (core dumped)      Program terminated with signal SIGILL, Illegal instruction.
 Exit 132      #0  0x0000f42f5fd00000 in ?? ()
 ````      (gdb) bt 5
       #0  0x0000f42f5fd00000 in ?? ()
 Trying to debug this a bit further we can see:      #1  0x0000f42f5fd0a3d0 in restore_errno_only () at c/misc_thread_common.h:43
       #2  0x0000f42f5fbf0f90 in _cffi_f_SSL_library_init (self=<optimized out>, noarg=<optimized out>)
 ````          at build/temp.netbsd-8.99.22-evbarm-2.7/_openssl.c:51839
 % cat asi.py      #3  0x0000f42f617606ac in PyEval_EvalFrameEx () from /usr/pkg/lib/libpython2.7.so.1.0
 import OpenSSL      #4  0x0000f42f6175e5c0 in PyEval_EvalCodeEx () from /usr/pkg/lib/libpython2.7.so.1.0
 % python2.7 -m trace --trace asi.py      (More stack frames follow...)
 [...]      (gdb) f 2
 binding.py(88):     for attr in dir(lib):      #2  0x0000f42f5fbf0f90 in _cffi_f_SSL_library_init (self=<optimized out>, noarg=<optimized out>)
 binding.py(89):         if attr not in excluded_names:          at build/temp.netbsd-8.99.22-evbarm-2.7/_openssl.c:51839
 binding.py(90):             setattr(conditional_lib, attr, getattr(lib, attr))      warning: Source file is more recent than executable.
 binding.py(88):     for attr in dir(lib):      51839     _cffi_restore_errno();
 binding.py(89):         if attr not in excluded_names:      (gdb) list
 binding.py(90):             setattr(conditional_lib, attr, getattr(lib, attr))      51834   _cffi_f_SSL_library_init(PyObject *self, PyObject *noarg)
 binding.py(88):     for attr in dir(lib):      51835   {
 binding.py(89):         if attr not in excluded_names:      51836     int result;
 binding.py(90):             setattr(conditional_lib, attr, getattr(lib, attr))      51837
 binding.py(88):     for attr in dir(lib):      51838     Py_BEGIN_ALLOW_THREADS
 binding.py(92):     return conditional_lib      51839     _cffi_restore_errno();
 binding.py(126):                 cls._lib_loaded = True      51840     { result = SSL_library_init(); }
 binding.py(128):                 cls.lib.SSL_library_init()      51841     _cffi_save_errno();
 Illegal instruction (core dumped)      51842     Py_END_ALLOW_THREADS
 Exit 132      51843
 ````      (gdb) f 1
       #1  0x0000f42f5fd0a3d0 in restore_errno_only () at c/misc_thread_common.h:43
       43      static void restore_errno_only(void) { errno = cffi_saved_errno; }
       (gdb) list
       38         syntactically valid to use "__thread" with this C compiler. */
       39      #ifdef USE__THREAD
       40
       41      static __thread int cffi_saved_errno = 0;
       42      static void save_errno_only(void) { cffi_saved_errno = errno; }
       43      static void restore_errno_only(void) { errno = cffi_saved_errno; }
       44
       45      #else
       46
       47      static void save_errno_only(void)
       (gdb) disas
       Dump of assembler code for function restore_errno_only:
          0x0000f42f5fd0a3b0 <+0>:     str     x30, [sp, #-16]!
          0x0000f42f5fd0a3b4 <+4>:     bl      0xf42f5fd075c0 <__errno@plt>
          0x0000f42f5fd0a3b8 <+8>:     mov     x2, x0
          0x0000f42f5fd0a3bc <+12>:    mrs     x1, tpidr_el0
          0x0000f42f5fd0a3c0 <+16>:    adrp    x0, 0xf42f5fd34000
          0x0000f42f5fd0a3c4 <+20>:    ldr     x3, [x0, #4088]
          0x0000f42f5fd0a3c8 <+24>:    add     x0, x0, #0xff8
          0x0000f42f5fd0a3cc <+28>:    blr     x3
       => 0x0000f42f5fd0a3d0 <+32>:    ldr     w0, [x1, x0]
          0x0000f42f5fd0a3d4 <+36>:    str     w0, [x2]
          0x0000f42f5fd0a3d8 <+40>:    ldr     x30, [sp], #16
          0x0000f42f5fd0a3dc <+44>:    ret
       End of assembler dump.
       (gdb) info reg
       x0             0xf42f5fd34ff8   268484308324344
       x1             0xf42f61875080   268484336898176
       x2             0xf42f6186c848   268484336863304
       x3             0xf42f5fd00000   268484308107264
       x4             0xf42f5ff3c0b8   268484310450360
       x5             0xf42f60000570   268484311254384
       x6             0x65000000000000 28428972647776256
       x7             0x65     101
       x8             0xf42f6185e000   268484336803840
       x9             0xf42f6185e668   268484336805480
       x10            0xf42f6185e668   268484336805480
       x11            0x1      1
       x12            0x30     48
       x13            0xffffff9264f0   281474969527536
       x14            0x65     101
       x15            0x3      3
       x16            0xf42f615bd730   268484334049072
       x17            0xf42f615ec2c8   268484334240456
       x18            0xf42f615ca1a0   268484334100896
       x19            0xf42f5fc9cea8   268484307701416
       x20            0xf42f5fd9c3c0   268484308747200
       x21            0xf42f61307090   268484331204752
       x22            0xf42f5fcd38e8   268484307925224
       x23            0xf42f5fcd10a0   268484307914912
       x24            0xf42f5fb8c5a8   268484306585000
       x25            0xf42f5fd9c3c0   268484308747200
       x26            0xf42f5fbf0f70   268484306997104
       x27            0xf42f5fdd467e   268484308977278
       x28            0xf42f61307090   268484331204752
       x29            0x0      0
       x30            0xf42f5fd0a3d0   268484308149200
       sp             0xffffff926760   0xffffff926760
       pc             0xf42f5fd0a3d0   0xf42f5fd0a3d0 <restore_errno_only+32>
       cpsr           0x60000000       [ EL=0 C Z ]
       fpsr           0x3000000        50331648
       fpcr           0x10     16
       (gdb) quit
   
   ...and `_cffi_restore_errno` and `_cffi_save_errno` are defined in
   `cffi/_cffi_include.h` as follows:
   
       #define _cffi_restore_errno                                              \
           ((void(*)(void))_cffi_exports[13])
       #define _cffi_save_errno                                                 \
           ((void(*)(void))_cffi_exports[14])
   
   The following patch workaround the issue:
   
       $NetBSD: aarch64_problems.mdwn,v 1.7 2018/07/23 22:51:09 leot Exp $
       
       Kludge for NetBSD/aarch64 SIGILL.
       
       --- setup.py.orig   2018-02-27 18:15:41.000000000 +0000
       +++ setup.py
       @@ -70,7 +70,7 @@ def ask_supports_thread():
            ok = (sys.platform != 'win32' and
                  config.try_compile('__thread int some_threadlocal_variable_42;'))
            if ok:
       -        define_macros.append(('USE__THREAD', None))
       +        pass
            else:
                ok1 = config.try_compile('int some_regular_variable_42;')
                if not ok1:
   
   
   ## polkitd crashes
   
       pinebook# /usr/pkg/lib/polkit-1/polkitd
       Successfully changed to user polkitd
       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

Removed from v.1.1  
changed lines
  Added in v.1.8


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