Bug 26728

Summary: Change _dl_fatal_printf to dump core file
Product: glibc Reporter: Jonny Grant <jg>
Component: dynamic-linkAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: fweimer
Priority: P2 Flags: fweimer: security-
Version: 2.34   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Jonny Grant 2020-10-13 10:09:12 UTC
Could _dl_fatal_printf be considered to change to call raise a signal that dumps the core instead of _exit(127)?

As the code is an assert(), perhaps SIGTRAP or SIGABRT is best?

On my computer any C program compiled with assert(0) dumps a core file, but this glibc issue assert does not dump a core file.

Inconsistency detected by ld.so: ../elf/dl-tls.c: 481: _dl_allocate_tls_init: Assertion `listp->slotinfo[cnt].gen <= GL(dl_tls_generation)' failed!
Command exited with non-zero status 127

This came up while discussing this issue
https://sourceware.org/bugzilla/show_bug.cgi?id=19329


This is my test program

$ ./a
a: a.c:6: main: Assertion `0' failed.
Aborted (core dumped)


$ cat a.c
// gcc -Wall -o a a.c
#include <assert.h>

int main()
{
    assert(0);
}
Comment 1 Andreas Schwab 2020-10-13 10:16:13 UTC
_dl_fatal_printf is not only used for assertions.
Comment 2 Jonny Grant 2020-10-13 10:26:52 UTC
(In reply to Andreas Schwab from comment #1)
> _dl_fatal_printf is not only used for assertions.

Maybe a new _dl_fatal_printf_abort could be added for the assertion use case.