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

From: zimoun <[email-masked]>
Date: Wed, 02 Nov 2022 15:18:13 +0100

Hi,

On mer., 02 nov. 2022 at 12:25, Mathieu Othacehe <[email-masked]> wrote:

>                                    I'll see if this can be reproduced on
> a foreign distribution.

Using Guix 00ff6f7.

--8<---------------cut here---------------start------------->8---
$ uname -a
Linux pfiuh07 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ echo "/tmp/my-core-%p" | sudo tee /proc/sys/kernel/core_pattern
/tmp/my-core-%p

$ guix shell -C coreutils gcc-toolchain gdb

/tmp/bug-58923 [env]$ cat test.c
#include <stdio.h>
int main() {
        int *t = NULL;
        return *t;
}
/tmp/bug-58923 [env]$ gcc test.c

/tmp/bug-58923 [env]$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 255927
max locked memory           (kbytes, -l) 65536
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 9788
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 255927
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

/tmp/bug-58923 [env]$ ulimit -c unlimited
/tmp/bug-58923 [env]$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) unlimited
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 255927
max locked memory           (kbytes, -l) 65536
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 9788
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 255927
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

/tmp/bug-58923 [env]$ ./a.out
Segmentation fault (core dumped)

/tmp/bug-58923 [env]$ ls /tmp/
bug-58923  my-core-23

/tmp/bug-58923 [env]$ gdb ./a.out /tmp/my-core-23
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 ./a.out...
(No debugging symbols found in ./a.out)
[New LWP 23]
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000401106 in main ()
(gdb) bt
#0  0x0000000000401106 in main ()
(gdb) exit
/tmp/bug-58923 [env]$ exit
exit
--8<---------------cut here---------------end--------------->8---

Cheers,
simon