diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-04-10 23:29:40 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-04-15 11:32:40 -0300 |
commit | 7f3ab33f20f19ad5b8fdd40bd77d35a0da355347 (patch) | |
tree | e4323f5a2d89125fb96b9691d91d85b79740ae33 /misc | |
parent | ded3cef36135afa3510ce3c12b982f659b8ea244 (diff) | |
download | glibc-7f3ab33f20f19ad5b8fdd40bd77d35a0da355347.tar.gz glibc-7f3ab33f20f19ad5b8fdd40bd77d35a0da355347.tar.xz glibc-7f3ab33f20f19ad5b8fdd40bd77d35a0da355347.zip |
misc: syslog: Use CLOC_EXEC with _PATH_CONSOLE (BZ #17145)
The syslog open the '/dev/console' for LOG_CONS without O_CLOEXEC, which might leak in multithread programs that call fork. Checked on x86_64-linux-gnu.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/syslog.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/misc/syslog.c b/misc/syslog.c index 18330a373b..e228860d22 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -284,7 +284,8 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap, * syslogd failure. */ 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); (void)__close(fd); |