[PATCH 0/6] Fix signal-unsafe logging

Bryce Harrington bryce at canonical.com
Fri Apr 6 11:53:37 PDT 2012


On Fri, Apr 06, 2012 at 11:25:53AM -0700, Chase Douglas wrote:
> During signal context we may only call signal-safe functions. The list
> of safe functions can be found in the POSIX signal(7) man page. If you
> call a signal unsafe function in signal context you may cause memory,
> lock, or other corruption.
> 
> In particular, I can't run the X server under valgrind to diagnose
> issues in signal context that also happen to log messages. Valgrind is
> very strict about signal context, and it causes a segfault as soon as
> ErrorF is hit, for example.
> 
> This patch set ensures that logging is always signal context safe. It
> triggers a warning if a normal logging function is used from signal
> context because all the existing logging is *printf style. There is no
> signal-safe way of doing *printf outside of rolling your own
> implementation. In fact, on Ubuntu sprintf() is the function that causes
> valgrind to segfault.
> 
> It then adds LogMessageVerbSigSafe() to log a static string. An unsigned
> number formatting routine has been added to help with typical printing
> use cases.
> 
> Finally, two known signal context logging paths have been fixed to use
> LogMessageVerbSigSafe().
> 
> Because corruption can occur, I suggest this be applied to the 1.12
> stable series as well. However, I don't know for sure that corruption is
> occurring, so it's not a clear cut candidate.

For the series:

Reviewed-by: Bryce Harrington <bryce at canonical.com>


More information about the xorg-devel mailing list