Synopsis - Issue Tracker

Bug132 Editing

Title Fix signal handler
Created on 2007-04-03.10:11:25 by anonymous, last changed 2007-05-04.18:03:58 by elfring.
assigned to priority normal
type security severity normal
components other formatter platform
status new resolution
depends on superseded by
Add Comment:
File
CC List:? blindvt, elfring, hir, jsrinivasa

Messages
Author: anonymous Date: 2007-04-03.10:11:24
The function "exit()" does not belong to the list of async-signal-safe functions.
See section "2.4.3 Signal Actions" from the document "2.4 Signal Concepts".
http://opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
http://opengroup.org/onlinepubs/009695399/functions/_Exit.html

I imagine that the output to "std::cerr" in a signal handling function may be also unsafe.

Should the corresponding calls be replaced by safe alternatives in your function "sighandler"?
http://synopsis.fresco.org/viewsvn/Synopsis/trunk/src/Support/ErrorHandler.cc?rev=1811&view=auto
Author: blindvt Date: 2007-05-03.18:12:07
Just curious..
So, instead of exit() would you suggest abort()ing?

Which "safe alternative" do you have in mind to use instead?

The I/O subsystem (usually libc) should not be affected by this.
Author: elfring Date: 2007-05-03.20:47:21
Can the function "sighandler" be completely omitted?

Otherwise, consider to call "_Exit()".
Author: admin Date: 2007-05-03.21:21:35
Surely, if we wouldn't need the sighandlers, we would omit them.
Author: elfring Date: 2007-05-04.04:11:38
Are you going to make your logging approach async-signal-safe?
Author: blindvt Date: 2007-05-04.14:27:17
So you just suggests to omit running the __exit_function_table.
Author: elfring Date: 2007-05-04.15:13:14
How do you think about the message by Eric P. McCoy on the topic "threads with signals"?
http://groups.google.de/group/comp.os.linux.development.apps/msg/feb871fc978018f6

The object "std::cerr" must not be used inside a signal handler.
Author: blindvt Date: 2007-05-04.15:42:51
I, personally, think that is perfectly fine to use STDIO in a signal handler.

The worst that could happen is that there are a number of faults, which is fine since we're dead anyways.
Author: elfring Date: 2007-05-04.16:19:15
The following instructions will work.

char const * message[] = "bye bye\n";
write(file, message, sizeof(message));
Author: elfring Date: 2007-05-04.16:21:09
Better:
char const message[] = "bye bye\n";
Author: blindvt Date: 2007-05-04.17:03:49
Not sure how your c++ library implements string operator <<

Mine works fine, so perhaps you should rather fix your libc++ impl
Author: elfring Date: 2007-05-04.18:03:56
Are you sure that the implementation of the output operator is async-signal-safe on all supported platforms?

Will it call "new" or "malloc()"?
Files
File nameUploaded
synopsis-trunk.bug132-do-not-run-exit-dtors.diff blindvt, 2007-05-04.14:27:19
History
Date User Action Args
2007-04-03 10:11:27anonymouscreate
2007-04-11 22:42:07anonymoussetnosy: anonymous, hir, jsrinivasa
components: + other formatter, - general
2007-05-03 18:12:12blindvtsetnosy: + blindvt
messages: + msg665
2007-05-03 20:47:25elfringsetnosy: + elfring, - anonymous
messages: + msg668
2007-05-03 21:21:36adminsetmessages: + msg669
2007-05-04 04:11:42elfringsetmessages: + msg670
2007-05-04 14:27:25blindvtsetfiles: + synopsis-trunk.bug132-do-not-run-exit-dtors.diff
messages: + msg671
2007-05-04 15:13:18elfringsetmessages: + msg672
2007-05-04 15:42:57blindvtsetmessages: + msg673
2007-05-04 16:19:19elfringsetmessages: + msg674
2007-05-04 16:21:13elfringsetmessages: + msg675
2007-05-04 17:03:54blindvtsetmessages: + msg676
2007-05-04 18:04:00elfringsetmessages: + msg677