aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-04-24 11:09:00 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-07-07 14:10:58 -0300
commitb1ccfc061feee9ce616444ded8e1cd5acf9fa97f (patch)
treefc6cf960f68245bcbf045df47955c253a94504d8 /debug
parente4e11b1dba261cb650e631978622bf3b4a4d8c37 (diff)
downloadglibc-b1ccfc061feee9ce616444ded8e1cd5acf9fa97f.tar
glibc-b1ccfc061feee9ce616444ded8e1cd5acf9fa97f.tar.gz
glibc-b1ccfc061feee9ce616444ded8e1cd5acf9fa97f.tar.bz2
glibc-b1ccfc061feee9ce616444ded8e1cd5acf9fa97f.zip
signal: Move sys_siglist to a compat symbol
The symbol was deprecated by strsignal and its usage imposes issues such as copy relocations. Its internal name is changed to __sys_siglist and __sys_sigabbrev to avoid static linking usage. The compat code is also refactored, since both Linux and Hurd usage the same strategy: export the same array with different object sizes. The libSegfault change avoids calling strsignal on the SIGFAULT signal handler (the current usage is already sketchy, adding a call that potentially issue locale internal function is even sketchier). Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi on all affected platforms. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'debug')
-rw-r--r--debug/segfault.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/debug/segfault.c b/debug/segfault.c
index 14c64cd0bd..8b59783c9e 100644
--- a/debug/segfault.c
+++ b/debug/segfault.c
@@ -49,20 +49,16 @@
static const char *fname;
-/* We better should not use `strerror' since it can call far too many
- other functions which might fail. Do it here ourselves. */
+/* Print the signal number SIGNAL. Either strerror or strsignal might
+ call local internal functions and these in turn call far too many
+ other functions and might even allocate memory which might fail. */
static void
write_strsignal (int fd, int signal)
{
- if (signal < 0 || signal >= _NSIG || _sys_siglist[signal] == NULL)
- {
- char buf[30];
- char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
- WRITE_STRING ("signal ");
- write (fd, buf, &buf[sizeof (buf)] - ptr);
- }
- else
- WRITE_STRING (_sys_siglist[signal]);
+ char buf[30];
+ char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
+ WRITE_STRING ("signal ");
+ write (fd, buf, &buf[sizeof (buf)] - ptr);
}