Fix signal handler
- From
- Markus Elfring <markus.elfring@web.de>
- Date
- Feb 2, 2010, 16:14 UTC
- Message-ID
- <4B684F5F.7020409@web.de>
Hello,
The function "early_output" that is set as a signal handler by the function "setup_early_output" contains a simple looking instruction. http://git.kernel.org/?p=git/git.git;a=blob;f=builtin-log.c;h=8d16832f7e9483f7903009459a72efc39e267c98;hb=HEAD#l173
A global variable gets a function pointer assigned. http://git.kernel.org/?p=git/git.git;a=blob;f=revision.h;h=a14deefc252bd641fba5e16f7859b4a985a72578;hb=HEAD#l138
I find that this approach does not fit to standard rules because the data type "sig_atomic_t" is the only type that can be safely used for global write access in signal handlers. https://www.securecoding.cert.org/confluence/display/seccode/SIG31-C.+Do+not+access+or+modify+shared+objects+in+signal+handlers
Would you like to change any details in the design of your software because of this issue to avoid undefined behaviour?
Regards, Markus