Annotation of wikisrc/users/leot/aarch64_problems.mdwn, revision 1.7
1.1 leot 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:
1.2 leot 10: $ mpv
1.1 leot 11:
12: It is possible to completely crash NetBSD on aarch64. Investigate why and if
13: possible get a complete backtrace.
14:
15: (Is it PaX MPROTECT related?)
16:
17:
18: ## Python `import requests` SIGILLs
19: Doing a (please note that also `python36` is affected):
20:
1.2 leot 21: $ python2.7 -c 'import requests'
22: Illegal instruction (core dumped)
23: Exit 132
1.1 leot 24:
1.5 leot 25: ...where:
1.1 leot 26:
1.5 leot 27: % gdb -core python2.7.core `which python2.7`
28: Reading symbols from /usr/pkg/bin/python2.7...(no debugging symbols found)...done.
29: [New process 1]
30: Core was generated by `python2.7'.
31: Program terminated with signal SIGILL, Illegal instruction.
32: #0 0x0000f42f5fd00000 in ?? ()
33: (gdb) bt 5
34: #0 0x0000f42f5fd00000 in ?? ()
35: #1 0x0000f42f5fd0a3d0 in restore_errno_only () at c/misc_thread_common.h:43
36: #2 0x0000f42f5fbf0f90 in _cffi_f_SSL_library_init (self=<optimized out>, noarg=<optimized out>)
37: at build/temp.netbsd-8.99.22-evbarm-2.7/_openssl.c:51839
38: #3 0x0000f42f617606ac in PyEval_EvalFrameEx () from /usr/pkg/lib/libpython2.7.so.1.0
39: #4 0x0000f42f6175e5c0 in PyEval_EvalCodeEx () from /usr/pkg/lib/libpython2.7.so.1.0
40: (More stack frames follow...)
41: (gdb) f 2
42: #2 0x0000f42f5fbf0f90 in _cffi_f_SSL_library_init (self=<optimized out>, noarg=<optimized out>)
43: at build/temp.netbsd-8.99.22-evbarm-2.7/_openssl.c:51839
44: warning: Source file is more recent than executable.
45: 51839 _cffi_restore_errno();
46: (gdb) list
47: 51834 _cffi_f_SSL_library_init(PyObject *self, PyObject *noarg)
48: 51835 {
49: 51836 int result;
50: 51837
51: 51838 Py_BEGIN_ALLOW_THREADS
52: 51839 _cffi_restore_errno();
53: 51840 { result = SSL_library_init(); }
54: 51841 _cffi_save_errno();
55: 51842 Py_END_ALLOW_THREADS
56: 51843
57: (gdb) f 1
58: #1 0x0000f42f5fd0a3d0 in restore_errno_only () at c/misc_thread_common.h:43
59: 43 static void restore_errno_only(void) { errno = cffi_saved_errno; }
60: (gdb) list
61: 38 syntactically valid to use "__thread" with this C compiler. */
62: 39 #ifdef USE__THREAD
63: 40
64: 41 static __thread int cffi_saved_errno = 0;
65: 42 static void save_errno_only(void) { cffi_saved_errno = errno; }
66: 43 static void restore_errno_only(void) { errno = cffi_saved_errno; }
67: 44
68: 45 #else
69: 46
70: 47 static void save_errno_only(void)
71: (gdb) disas
72: Dump of assembler code for function restore_errno_only:
73: 0x0000f42f5fd0a3b0 <+0>: str x30, [sp, #-16]!
74: 0x0000f42f5fd0a3b4 <+4>: bl 0xf42f5fd075c0 <__errno@plt>
75: 0x0000f42f5fd0a3b8 <+8>: mov x2, x0
76: 0x0000f42f5fd0a3bc <+12>: mrs x1, tpidr_el0
77: 0x0000f42f5fd0a3c0 <+16>: adrp x0, 0xf42f5fd34000
78: 0x0000f42f5fd0a3c4 <+20>: ldr x3, [x0, #4088]
79: 0x0000f42f5fd0a3c8 <+24>: add x0, x0, #0xff8
80: 0x0000f42f5fd0a3cc <+28>: blr x3
81: => 0x0000f42f5fd0a3d0 <+32>: ldr w0, [x1, x0]
82: 0x0000f42f5fd0a3d4 <+36>: str w0, [x2]
83: 0x0000f42f5fd0a3d8 <+40>: ldr x30, [sp], #16
84: 0x0000f42f5fd0a3dc <+44>: ret
85: End of assembler dump.
86: (gdb) info reg
87: x0 0xf42f5fd34ff8 268484308324344
88: x1 0xf42f61875080 268484336898176
89: x2 0xf42f6186c848 268484336863304
90: x3 0xf42f5fd00000 268484308107264
91: x4 0xf42f5ff3c0b8 268484310450360
92: x5 0xf42f60000570 268484311254384
93: x6 0x65000000000000 28428972647776256
94: x7 0x65 101
95: x8 0xf42f6185e000 268484336803840
96: x9 0xf42f6185e668 268484336805480
97: x10 0xf42f6185e668 268484336805480
98: x11 0x1 1
99: x12 0x30 48
100: x13 0xffffff9264f0 281474969527536
101: x14 0x65 101
102: x15 0x3 3
103: x16 0xf42f615bd730 268484334049072
104: x17 0xf42f615ec2c8 268484334240456
105: x18 0xf42f615ca1a0 268484334100896
106: x19 0xf42f5fc9cea8 268484307701416
107: x20 0xf42f5fd9c3c0 268484308747200
108: x21 0xf42f61307090 268484331204752
109: x22 0xf42f5fcd38e8 268484307925224
110: x23 0xf42f5fcd10a0 268484307914912
111: x24 0xf42f5fb8c5a8 268484306585000
112: x25 0xf42f5fd9c3c0 268484308747200
113: x26 0xf42f5fbf0f70 268484306997104
114: x27 0xf42f5fdd467e 268484308977278
115: x28 0xf42f61307090 268484331204752
116: x29 0x0 0
117: x30 0xf42f5fd0a3d0 268484308149200
118: sp 0xffffff926760 0xffffff926760
119: pc 0xf42f5fd0a3d0 0xf42f5fd0a3d0 <restore_errno_only+32>
120: cpsr 0x60000000 [ EL=0 C Z ]
121: fpsr 0x3000000 50331648
122: fpcr 0x10 16
123: (gdb) quit
1.6 leot 124:
125: ...and `_cffi_restore_errno` and `_cffi_save_errno` are defined in
126: `cffi/_cffi_include.h` as follows:
127:
128: #define _cffi_restore_errno \
129: ((void(*)(void))_cffi_exports[13])
130: #define _cffi_save_errno \
131: ((void(*)(void))_cffi_exports[14])
1.7 ! leot 132:
! 133: The following patch workaround the issue:
! 134:
! 135: $NetBSD$
! 136:
! 137: Kludge for NetBSD/aarch64 SIGILL.
! 138:
! 139: --- setup.py.orig 2018-02-27 18:15:41.000000000 +0000
! 140: +++ setup.py
! 141: @@ -70,7 +70,7 @@ def ask_supports_thread():
! 142: ok = (sys.platform != 'win32' and
! 143: config.try_compile('__thread int some_threadlocal_variable_42;'))
! 144: if ok:
! 145: - define_macros.append(('USE__THREAD', None))
! 146: + pass
! 147: else:
! 148: ok1 = config.try_compile('int some_regular_variable_42;')
! 149: if not ok1:
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb