[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Uninitialized variable causes a crash on aarch64.
From: |
Pierre Langlois |
Subject: |
Uninitialized variable causes a crash on aarch64. |
Date: |
Sat, 12 Sep 2020 13:17:16 +0100 |
User-agent: |
mu4e 1.4.13; emacs 27.1 |
Hi there!
Since version 3.10, mailutils isn't available on Guix for aarch64 since
the test-suite doesn't pass because of a segfault in readmsg tests. You
can find the full log here [0] and the bugreport on [1].
Reproducing the crash under GDB, it seems the `weedc' variable isn't
initialized and on this platform is set to `0xffff'. Later on, it causes
a crash.
Here's a reproducer, ran in GDB:
```
$ export
MAIL=/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/testsuite/spool/mbox1
$ export
FOLDER=/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/testsuite/spool/mbox1
$ ... edit readmsg script so that `gdb --args' is prepended
$ /tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/readmsg --no-site
--no-user readmsg -h SOMETHING
...
(gdb) start
Temporary breakpoint 2 at 0x4034c8: file readmsg.c, line 463.
Starting program:
/tmp/guix-build-mailutils-3.10.drv-0/mailutils-3.10/readmsg/.libs/readmsg
--no-site --no-user readmsg -h SOMETHING
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/gnu/store/cb88z63hyg1icd2kkahiink2p291mhr2-glibc-2.31/lib/libthread_db.so.1".
Temporary breakpoint 2, main (argc=6, argv=0xffffffffeb58) at readmsg.c:463
463 int *set = NULL;
(gdb) p weedc
$4 = 65535
(gdb) watch weedc
Hardware watchpoint 3: weedc
(gdb) c
Continuing.
From bar@dontmailme.org Fri Dec 28 23:28:09 2001
Program received signal SIGSEGV, Segmentation fault.
0x00000000004030a0 in print_header (message=0x470f90, unix_header=1,
weedc=65535, weedv=0x4042c8 <__libc_csu_init>) at readmsg.c:353
353 if (weedv[j][0] == '!')
(gdb) p j
$5 = 0
(gdb) p weedv[j][0]
Cannot access memory at address 0x910003fda9bc7bfd
(gdb) up
#1 0x0000000000403a2c in main (argc=2, argv=0xffffffffeb78) at readmsg.c:580
580 print_header (msg, unix_header, weedc, weedv);
(gdb) p weedc
$6 = 65535
(gdb)
```
If we set `weedc' to zero, then the readmsg tests all pass and we're
good to go to update mailutils in Guix!
Thanks,
Pierre
[0]:
https://ci.guix.gnu.org/log/i8wpby2wmbn85qn0yv4v0q7ik4cki149-guile2.2-mailutils-3.10
[1]: https://issues.guix.gnu.org/43088
signature.asc
Description: PGP signature
- Uninitialized variable causes a crash on aarch64.,
Pierre Langlois <=