You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MUSL, __syscall_cp_c() polls for __pthread_self()->cancel not equal to zero, and if true, calls __cancel() to stop the thread. This code is all correct, but when Rust apps make a syscall, either the __pthread_self() pointer is bad, or the value of ->cancel is bad (0x10000 typeically), and the attempt to cancel the sole thread crashes with SIGSEGV.
This is only a problem for Rust apps built with Rust 1.71.0 or newer, Older builds of rustc don't repro the issue. I'll investigate.
Here is a typical callstack from a SIGSEGV during a syscall for open() in a single-threaded app that isn't using pthreads for anything:
(gdb) info stack
#0 0x00000000 in ?? () #1 0xbeec564e in pthread_exit () from target:/lib/ld-musl-armhf.so.1 #2 0xbeed70fa in ?? () from target:/lib/ld-musl-armhf.so.1 #3 0xbeed7156 in ?? () from target:/lib/ld-musl-armhf.so.1 #4 0xbeeaa3ca in open64 () from target:/lib/ld-musl-armhf.so.1 #5 0xbeeaa248 in __z_azsp_open () from target:/lib/ld-musl-armhf.so.1 #6 0x0002f916 in ADC_Open (id=0) at /opt/azurespheresdk/Sysroots/16/usr/include/applibs/adc_internal.h:24 #7 0x0003044c in ADC_Open_inline (id=0) at ../azure-sphere-sys/static_inline_helpers.c:30 #8 0x0001c4d8 in azure_sphere::applibs::adc::AdcController::new (controller_id=0)
at azure-sphere/src/applibs/adc.rs:63 #9 0x00016ca0 in allapis::main () at samples/allapis/src/main.rs:62
The text was updated successfully, but these errors were encountered:
In MUSL, __syscall_cp_c() polls for __pthread_self()->cancel not equal to zero, and if true, calls __cancel() to stop the thread. This code is all correct, but when Rust apps make a syscall, either the __pthread_self() pointer is bad, or the value of ->cancel is bad (0x10000 typeically), and the attempt to cancel the sole thread crashes with SIGSEGV.
This is only a problem for Rust apps built with Rust 1.71.0 or newer, Older builds of rustc don't repro the issue. I'll investigate.
Here is a typical callstack from a SIGSEGV during a syscall for open() in a single-threaded app that isn't using pthreads for anything:
(gdb) info stack
#0 0x00000000 in ?? ()
#1 0xbeec564e in pthread_exit () from target:/lib/ld-musl-armhf.so.1
#2 0xbeed70fa in ?? () from target:/lib/ld-musl-armhf.so.1
#3 0xbeed7156 in ?? () from target:/lib/ld-musl-armhf.so.1
#4 0xbeeaa3ca in open64 () from target:/lib/ld-musl-armhf.so.1
#5 0xbeeaa248 in __z_azsp_open () from target:/lib/ld-musl-armhf.so.1
#6 0x0002f916 in ADC_Open (id=0) at /opt/azurespheresdk/Sysroots/16/usr/include/applibs/adc_internal.h:24
#7 0x0003044c in ADC_Open_inline (id=0) at ../azure-sphere-sys/static_inline_helpers.c:30
#8 0x0001c4d8 in azure_sphere::applibs::adc::AdcController::new (controller_id=0)
at azure-sphere/src/applibs/adc.rs:63
#9 0x00016ca0 in allapis::main () at samples/allapis/src/main.rs:62
The text was updated successfully, but these errors were encountered: