Subject: Segfault in arm gcc7, thumb2 builroot, with arm patch
From: [email-masked]
To: "[email-masked]'" <[email-masked]>
Date: Mon, 20 Apr 2020 19:34:28 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Here is a backtrace of running guile on a builtroot constructed system
for rpi3.
Thumb2 instructions: BR2_ARM_INSTRUCTIONS_THUMB2=y
Gcc 7.5: BR2_GCC_VERSION="7.5.0"
Glibc.

Uses the patch from
https://gitlab.com/wingo/lightening/-/merge_requests/3

I hope this makes it through the mail client ok. 

-Dale

Core was generated by `guile'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x76ee6f12 in ?? ()
[Current thread is 1 (LWP 507)]
(gdb) thread apply all backtrace

Thread 5 (LWP 508):
#0 0x76e59674 in __libc_do_syscall () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#1 0x76e5499e in pthread_cond_wait@@GLIBC_2.4 () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#2 0x76e7d7aa in GC_wait_marker () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#3 0x76e7dab0 in GC_help_marker () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#4 0x76e7db26 in GC_mark_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#5 0x76e4fbb0 in start_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#6 0x76b450ec in ?? () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt
stack?)

Thread 4 (LWP 510):
#0 0x76e59674 in __libc_do_syscall () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#1 0x76e5499e in pthread_cond_wait@@GLIBC_2.4 () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#2 0x76e7d7aa in GC_wait_marker () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#3 0x76e7dab0 in GC_help_marker () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#4 0x76e7db26 in GC_mark_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#5 0x76e4fbb0 in start_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#6 0x76b450ec in ?? () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt
stack?)

Thread 3 (LWP 511):
#0 0x76e59674 in __libc_do_syscall () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#1 0x76e57720 in read () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#2 0x76ef8aee in read_finalization_pipe_data (data=0x74c1f95c) at
finalizers.c:205
#3 0x76e7cea8 in GC_do_blocking_inner () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#4 0x76e7b068 in GC_with_callee_saves_pushed () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#5 0x76e7b094 in GC_do_blocking () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#6 0x76f3f10c in scm_without_guile (func=0x76ef8add , data=0x74c1f95c)
at threads.c:706
#7 0x76ef8d7a in finalization_thread_proc (unused=) at
finalizers.c:218
#8 0x76eef876 in c_body (d=0x74c1fe1c) at continuations.c:430
#9 0x76f4298e in vm_debug_engine (thread=0x76a46c00) at
vm-engine.c:972
#10 0x76f47b9c in scm_call_n (proc=0x7521dc70,
argv=argv@entry=0x74c1fbc0, nargs=nargs@entry=2) at vm.c:1608
#11 0x76ef22c4 in scm_call_2 (proc=, arg1=, arg2=) at eval.c:503
#12 0x76ef31a2 in scm_c_with_exception_handler (type=type@entry=0x404,
handler=0x76f3f9b9 , handler_data=handler_data@entry=0x74c1fda8, 
 thunk=0x76f3fa7d , thunk_data=thunk_data@entry=0x74c1fda8) at
exceptions.c:170
#13 0x76f3fbd4 in scm_c_catch (tag=tag@entry=0x404,
body=body@entry=0x76eef86d , body_data=body_data@entry=0x74c1fe1c, 
 handler=handler@entry=0x76eefa1d ,
handler_data=handler_data@entry=0x74c1fe1c, 
 pre_unwind_handler=pre_unwind_handler@entry=0x76eef8fb ,
pre_unwind_handler_data=pre_unwind_handler_data@entry=0x751fc300) at
throw.c:168
--Type  for more, q to quit, c to continue without paging--c
#14 0x76eefba2 in scm_i_with_continuation_barrier (body=0x76eef86d ,
body_data=body_data@entry=0x74c1fe1c, handler=0x76eefa1d ,
handler_data=handler_data@entry=0x74c1fe1c,
pre_unwind_handler=0x76eef8fb , pre_unwind_handler_data=0x751fc300) at
continuations.c:368
#15 0x76eefc06 in scm_c_with_continuation_barrier (func=, data=) at
continuations.c:464
#16 0x76f3edd4 in with_guile (base=0x74c1fe4c, data=0x74c1fe64) at
threads.c:645
#17 0x76e78e98 in GC_call_with_stack_base () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#18 0x76f3f0cc in scm_i_with_guile (dynamic_state=, data=, func=) at
threads.c:688
#19 scm_with_guile (func=, data=) at threads.c:694
#20 0x76e4fbb0 in start_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#21 0x76b450ec in ?? () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt
stack?)

Thread 2 (LWP 509):
#0 0x76e59674 in __libc_do_syscall () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#1 0x76e5499e in pthread_cond_wait@@GLIBC_2.4 () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#2 0x76e7d7aa in GC_wait_marker () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#3 0x76e7dab0 in GC_help_marker () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#4 0x76e7db26 in GC_mark_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libgc.so.1
#5 0x76e4fbb0 in start_thread () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
#6 0x76b450ec in ?? () from
/home/dales/br/rpi/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt
stack?)

Thread 1 (LWP 507):
#0 0x76ee6f12 in scm_is_pair (x=0x0) at pairs.h:182
#1 scm_sloppy_assq (key=0x752076f0, alist=0x0) at alist.c:59
#2 0x76effef8 in scm_hash_fn_ref (table=table@entry=0x751da8b0,
obj=obj@entry=0x752076f0, dflt=dflt@entry=0x4,
hash_fn=hash_fn@entry=0x76eff79d , assoc_fn=0x76ee6f0d ,
closure=closure@entry=0x0) at hashtab.c:300
#3 0x76efff5c in scm_hashq_ref (table=0x751da8b0,
key=key@entry=0x752076f0, dflt=0x4, dflt@entry=0x904) at hashtab.c:426
#4 0x76f11f74 in scm_module_variable (module=0x74f281e0,
sym=0x752076f0) at modules.c:500
#5 0x76f430c4 in vm_debug_engine (thread=0x76a46e00) at
vm-engine.c:1560
#6 0x76f47b9c in scm_call_n (proc=0x74107800,
argv=argv@entry=0x7eb8fb64, nargs=nargs@entry=1) at vm.c:1608
#7 0x76ef22b0 in scm_call_1 (proc=, arg1=) at eval.c:496
#8 0x76f4298e in vm_debug_engine (thread=0x76a46e00) at
vm-engine.c:972
#9 0x76f47b9c in scm_call_n (proc=0x7521dc30,
argv=argv@entry=0x7eb8fdb0, nargs=nargs@entry=4) at vm.c:1608
#10 0x76ef22f4 in scm_call_4 (proc=, arg1=arg1@entry=0x751fc300,
arg2=arg2@entry=0x74d09810, arg3=arg3@entry=0x76a4ab60,
arg4=arg4@entry=0x7416c0b8) at eval.c:517
#11 0x76eea9a0 in scm_print_exception (port=port@entry=0x751fc300,
frame=frame@entry=0x74d09810, key=key@entry=0x76a4ab60,
args=args@entry=0x7416c0b8) at backtrace.c:121
#12 0x76eef994 in print_exception_and_backtrace (args=0x7416c0b8,
tag=0x76a4ab60, port=0x751fc300) at continuations.c:415
#13 pre_unwind_handler (error_port=0x751fc300, tag=0x76a4ab60,
args=0x7416c0b8) at continuations.c:453
#14 0x76f3fa2e in catch_pre_unwind_handler (data=0x7eb91c18,
exn=0x74159fa0) at throw.c:135
#15 0x76f4298e in vm_debug_engine (thread=0x76a46e00) at
vm-engine.c:972
#16 0x76f47b9c in scm_call_n (proc=proc@entry=0x7521dc50,
argv=0x7eb90068, nargs=5) at vm.c:1608
#17 0x76ef245a in scm_apply_0 (proc=0x7521dc50, args=0x304) at
eval.c:603
#18 0x76ef2afa in scm_apply_1 (proc=, arg1=arg1@entry=0x76a4ab60,
args=args@entry=0x74d098c8) at eval.c:609
#19 0x76f3fd1c in scm_throw (key=0x76a4ab60, key@entry=0x76f8bd90 ,
args=0x74d098c8) at throw.c:262
#20 0x76f3fe22 in scm_ithrow (key=key@entry=0x76f8bd90 , args=,
no_return=no_return@entry=1) at throw.c:457
#21 0x76ef0e66 in scm_error_scm (key=key@entry=0x76f8bd90 ,
subr=subr@entry=0x4, message=message@entry=0x76a4ab60,
args=args@entry=0x304, data=0x74d09948) at error.c:90
#22 0x76f41c4a in bind_kwargs (thread=, npositional=, nlocals=14,
kwargs=0x75145ce0, strict=1 '01', allow_other_keys=0 '00') at
vm.c:1015
#23 0x7500c6e4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt
stack?)

(gdb) info reg
r0 0x752076f0 1965061872
r1 0x0 0
r2 0x0 0
r3 0x76ee6f0d 1995337485
r4 0x4 4
r5 0x76f7c000 1995948032
r6 0x751da8b0 1964878000
r7 0x752076f0 1965061872
r8 0x3 3
r9 0x74c6d160 1959186784
r10 0x76f8c7e4 1996015588
r11 0x76f7c000 1995948032
r12 0x76f7c288 1995948680
sp 0x7eb8f8d8 0x7eb8f8d8
lr 0x76effef9 1995439865
pc 0x76ee6f12 0x76ee6f12 
cpsr 0x40000030 1073741872
fpscr 0x0 0

(gdb) disassem /r 0x76ee6f12,+8
Dump of assembler code from 0x76ee6f12 to 0x76ee6f1a:
=> 0x76ee6f12 : 0b 68 ldr r3, [r1, #0]
 0x76ee6f14 : da 07 lsls r2, r3, #31
 0x76ee6f16 : 0a d4 bmi.n 0x76ee6f2e 
 0x76ee6f18 : 13 f0 06 0f tst.w r3, #6
End of assembler dump.