Also, print out the offending message format. This will hopefully help developers track down unsafe logging.
Signed-off-by: Chase Douglas <[email protected]> Reviewed-by: Peter Hutterer <[email protected]> --- os/log.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/os/log.c b/os/log.c index 8adf6cc..62bae2e 100644 --- a/os/log.c +++ b/os/log.c @@ -456,6 +456,16 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) Bool newline; size_t len = 0; + if (inSignalContext) { + BUG_WARN_MSG(inSignalContext, + "Warning: attempting to log data in a signal unsafe " + "manner while in signal context. Please update to check " + "inSignalContext and/or use LogMessageVerbSigSafe() or " + "ErrorSigSafe(). The offending log format message is:\n" + "%s\n", format); + return; + } + type_str = LogMessageTypeVerbString(type, verb); if (!type_str) return; @@ -537,6 +547,15 @@ LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, Bool newline; size_t len = 0; + if (inSignalContext) { + BUG_WARN_MSG("Warning: attempting to log data in a signal unsafe " + "manner while in signal context. Please update to check " + "inSignalContext and/or use LogMessageVerbSigSafe(). The " + "offending header and log message formats are:\n%s %s\n", + hdr_format, msg_format); + return; + } + type_str = LogMessageTypeVerbString(type, verb); if (!type_str) return; -- 1.7.9.5 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
