Bug 26728 - Change _dl_fatal_printf to dump core file
Summary: Change _dl_fatal_printf to dump core file
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: dynamic-link (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-13 10:09 UTC by Jonny Grant
Modified: 2020-10-13 10:26 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.