Message ID | 20210412211113.393120-8-adhemerval.zanella@linaro.org |
---|---|
State | New |
Headers | show |
Series | [01/11] support: Add xmkfifo | expand |
On Apr 12 2021, Adhemerval Zanella via Libc-alpha wrote: > The syslog open the '/dev/console' for LOG_CONS without O_CLOEXEC, > which might leak in multithread programs that call fork. Ok. Andreas.
diff --git a/misc/syslog.c b/misc/syslog.c index a310eba476..b595889e1c 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -250,7 +250,8 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, */ int fd; if (LogStat & LOG_CONS && - (fd = __open (_PATH_CONSOLE, O_WRONLY | O_NOCTTY, 0)) >= 0) + (fd = __open (_PATH_CONSOLE, O_WRONLY | O_NOCTTY | O_CLOEXEC, + 0)) >= 0) { __dprintf (fd, "%s\r\n", buf + msgoff); __close (fd);