diff options
| author | Paul Eggert | 2012-10-01 15:12:44 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-10-01 15:12:44 -0700 |
| commit | aa1ba90e4a95542c83cf636de3bc67e8fb23bad3 (patch) | |
| tree | 1407a999bbc11bf54aaeba40764d6a75565db182 /src/process.c | |
| parent | ace917bddb2ed2448a97ddf279445bb581c5cd32 (diff) | |
| download | emacs-aa1ba90e4a95542c83cf636de3bc67e8fb23bad3.tar.gz emacs-aa1ba90e4a95542c83cf636de3bc67e8fb23bad3.zip | |
Fix a malloc race condition involving strsignal.
A signal can arrive in the middle of a malloc, and Emacs's signal
handler can invoke strsignal, which can invoke malloc, which is
not portable. This race condition bug makes Emacs hang on GNU/Linux.
Fix it by altering the signal handler so that it does not invoke
strsignal.
* emacs.c (shut_down_emacs): Use safe_strsignal, not strsignal.
* process.c (status_message): Use const pointer, in case strsignal
is #defined to safe_strsignal.
* sysdep.c (sys_siglist, init_signals): Always define and
initialize a substitute sys_siglist if the system does not define
one, even if HAVE_STRSIGNAL.
(safe_strsignal): Rename from strsignal. Always define,
using sys_siglist. Return a const pointer.
* syssignal.h (safe_strsignal): New decl.
(strsignal) [!HAVE_STRSIGNAL]: Define in terms of safe_strsignal.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c index dfc89809fa5..92bea0d3a27 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -570,7 +570,7 @@ status_message (struct Lisp_Process *p) | |||
| 570 | 570 | ||
| 571 | if (EQ (symbol, Qsignal) || EQ (symbol, Qstop)) | 571 | if (EQ (symbol, Qsignal) || EQ (symbol, Qstop)) |
| 572 | { | 572 | { |
| 573 | char *signame; | 573 | char const *signame; |
| 574 | synchronize_system_messages_locale (); | 574 | synchronize_system_messages_locale (); |
| 575 | signame = strsignal (code); | 575 | signame = strsignal (code); |
| 576 | if (signame == 0) | 576 | if (signame == 0) |