Subject: Re: bug#58923: Malformed core dumps on Guix System

From: Ludovic Courtès <[email-masked]>
Date: Thu, 10 Nov 2022 11:14:49 +0100

Hi,

Mathieu Othacehe <[email-masked]> skribis:

> I suspected that at first, but I then reproduced it on Berlin so I would
> rather bet on a recent regression. I'll see if this can be reproduced on
> a foreign distribution.

I checked in a Guix System VM and cannot reproduce it either:

--8<---------------cut here---------------start------------->8---
$ guix describe
Generation 234	Nov 07 2022 00:27:58	(current)
  guix 4a34da8
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 4a34da845ed91821d38ba8a9b65ad650dd7488d1
$ $(guix system vm --no-graphic gnu/system/examples/bare-bones.tmpl) -m 1024
[…]
komputilo login: root
root
This is the GNU operating system, welcome!

root@komputilo ~# ulimit -c unlimited
ulimit -c unlimited
root@komputilo ~# guile -c '(use-modules (system foreign)) (dereference-pointer (make-pointer 1234))'
guile -c '(use-modules (system foreign)) (dereference-pointer (make-pointer 1234))'
[   17.580329] guile[188]: segfault at 4d2 ip 00007f53893ff97f sp 00007ffede6ab190 error 4 in libguile-3.0.so.1.5.0[7f53893dc000+c8000]
[   17.582412] Code: 66 66 2e 0f 1f 84 00 00 00 00 00 48 83 ec 08 40 f6 c7 06 75 26 48 8b 07 83 e0 7f 48 83 f8 1f 75 1a 48 8b 47 08 48 85 c0 74 31 <48> 8b 38 31 f6 48 83 c4 08 e9 33 d1 fd ff 0f 1f 00 48 89 fa 48 8d
Segmentation fault (core dumped)
root@komputilo ~# uname -a
uname -a
Linux komputilo 6.0.7-gnu #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux
root@komputilo ~# echo "set debug-file-directory /gnu/store/9snhi90f2nivxqrvqgjgixdch5zkps88-guile-3.0.8-debug/lib/debug" >> ~/.gdbinit
echo "set debug-file-directory /gnu/store/9snhi90f2nivxqrvqgjgixdch5zkps88-guile-3.0.8-debug/lib/debug" >> ~/.gdbinit
root@komputilo ~# /gnu/store/8fg0nk7c0xylmb6vpz1hc2mx7k3nqw47-gdb-12.1/bin/gdb $(type -P guile) core
/gnu/store/8fg0nk7c0xylmb6vpz1hc2mx7k3nqw47-gdb-12.1/bin/gdb $(type -P guile) core
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /run/current-system/profile/bin/guile...
Reading symbols from /gnu/store/9snhi90f2nivxqrvqgjgixdch5zkps88-guile-3.0.8-debug/lib/debug//gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/bin/guile.debug...
[New LWP 188]

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Core was generated by `guile -c (use-modules (system foreign)) (dereference-pointer (make-pointer 1234'.
Program terminated with signal SIGSEGV, Segmentation fault.
--Type <RET> for more, q to quit, c to continue without paging--

#0  scm_dereference_pointer (pointer=0x7f5388a3d4f0) at foreign.c:375
375	foreign.c: No such file or directory.
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/lib/libguile-3.0.so.1.5.0-gdb.scm
WARNING: (guile-user): imported module (gdb) overrides core binding `symbol?'
;;; /gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/lib/libguile-3.0.so.1.5.0-gdb.scm:293:21: warning: possibly unbound variable `program-debug-info-name'
;;; /gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/lib/libguile-3.0.so.1.5.0-gdb.scm:326:10: warning: possibly unbound variable `find-source-for-addr'
;;; /gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/lib/libguile-3.0.so.1.5.0-gdb.scm:326:32: warning: possibly unbound variable `program-debug-info-addr'
;;; /gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/lib/libguile-3.0.so.1.5.0-gdb.scm:327:32: warning: possibly unbound variable `program-debug-info-context'
;;; compiled /root/.cache/guile/ccache/3.0-LE-8-4.5/gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/lib/libguile-3.0.so.1.5.0-gdb.scm.go
;;; compiling /gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/share/guile/3.0/system/base/types.scm
;;; compiled /root/.cache/guile/ccache/3.0-LE-8-4.5/gnu/store/qlmpcy5zi84m6dikq3fnx5dz38qpczlc-guile-3.0.8/share/guile/3.0/system/base/types.scm.go
(gdb) bt
bt
#0  scm_dereference_pointer (pointer=#<pointer 0x4d2>) at foreign.c:375
#1  0x00007f5389478326 in vm_regular_engine (thread=0x7f5388913d80)
    at vm-engine.c:972
#2  0x00007f53894855d9 in scm_call_n (proc=<optimized out>, 
    argv=<optimized out>, nargs=1) at vm.c:1610
#3  0x00007f53893ed457 in scm_primitive_eval (exp=<optimized out>, 
    exp@entry=(dereference-pointer (make-pointer 1234))) at eval.c:671
#4  0x00007f53893f34b6 in scm_eval (
    exp=(dereference-pointer (make-pointer 1234)), 
    module_or_state="#<struct module>" = {...}) at eval.c:705
#5  0x00007f5389478326 in vm_regular_engine (thread=0x7f5388913d80)
    at vm-engine.c:972
#6  0x00007f53894855d9 in scm_call_n (proc=<optimized out>, 
    argv=<optimized out>, nargs=1) at vm.c:1610
#7  0x00007f53893ed457 in scm_primitive_eval (exp=<optimized out>, 
    exp@entry=((@ (ice-9 control) %) (begin ((@@ (ice-9 command-line) eval-string/lang) "(use-modules (system foreign)) (dereference-pointer (make-pointer 1234))") (quit)))) at eval.c:671
#8  0x00007f53893f34b6 in scm_eval (
    exp=((@ (ice-9 control) %) (begin ((@@ (ice-9 command-line) eval-string/lang) "(use-modules (system foreign)) (dereference-pointer (make-pointer 1234))") (quit))), module_or_state="#<struct module>" = {...}) at eval.c:705
#9  0x00007f53894573b6 in scm_shell (argc=3, argv=0x7ffede6abb48)
--Type <RET> for more, q to quit, c to continue without paging--

    at script.c:357
#10 0x00007f538940249c in invoke_main_func (body_data=0x7ffede6aba00)
    at init.c:312
#11 0x00007f53893eb85a in c_body (d=0x7ffede6ab920) at continuations.c:430
#12 0x00007f5389478326 in vm_regular_engine (thread=0x7f5388913d80)
    at vm-engine.c:972
#13 0x00007f53894855d9 in scm_call_n (proc=<optimized out>, 
    argv=<optimized out>, nargs=2) at vm.c:1610
#14 0x00007f53893ed09a in scm_call_2 (proc=<optimized out>, 
    arg1=<optimized out>, arg2=<optimized out>) at eval.c:503
#15 0x00007f53894a3742 in scm_c_with_exception_handler.constprop.0 (type=#t, 
    handler_data=handler_data@entry=0x7ffede6ab8b0, 
    thunk_data=thunk_data@entry=0x7ffede6ab8b0, thunk=<optimized out>, 
    handler=<optimized out>) at exceptions.c:170
#16 0x00007f538947588f in scm_c_catch (tag=<optimized out>, 
    body=<optimized out>, body_data=<optimized out>, handler=<optimized out>, 
    handler_data=<optimized out>, pre_unwind_handler=<optimized out>, 
    pre_unwind_handler_data=0x7f5388991040) at throw.c:168
#17 0x00007f53893ede66 in scm_i_with_continuation_barrier (
    pre_unwind_handler=0x7f53893edb80 <pre_unwind_handler>, 
    pre_unwind_handler_data=0x7f5388991040, handler_data=0x7ffede6ab920, 
    handler=0x7f53893f48b0 <c_handler>, body_data=0x7ffede6ab920, 
    body=0x7f53893eb850 <c_body>) at continuations.c:368
--Type <RET> for more, q to quit, c to continue without paging--

#18 scm_c_with_continuation_barrier (func=<optimized out>, 
    data=<optimized out>) at continuations.c:464
#19 0x00007f5389474b39 in with_guile (base=0x7ffede6ab9a8, data=0x7ffede6ab9d0)
    at threads.c:645
#20 0x00007f538934b0ba in GC_call_with_stack_base ()
   from /gnu/store/2lczkxbdbzh4gk7wh91bzrqrk7h5g1dl-libgc-8.0.4/lib/libgc.so.1
#21 0x00007f538946d8b8 in scm_i_with_guile (dynamic_state=<optimized out>, 
    data=<optimized out>, func=<optimized out>) at threads.c:688
#22 scm_with_guile (func=<optimized out>, data=<optimized out>)
    at threads.c:694
#23 0x00007f538940b025 in scm_boot_guile (argc=argc@entry=3, 
    argv=argv@entry=0x7ffede6abb48, 
    main_func=main_func@entry=0x401230 <inner_main>, closure=closure@entry=0x0)
    at init.c:295
#24 0x00000000004010f7 in main (argc=3, argv=0x7ffede6abb48) at guile.c:94
(gdb) 
--8<---------------cut here---------------end--------------->8---

Would be good to isolate the circumstances that can cause the problem.

Ludo’.