public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/26791] New: Missing O_CLOEXEC in sysconf.c
@ 2020-10-26 16:04 max at maxfragg dot de
  2020-11-11 10:32 ` [Bug libc/26791] " arjun.is at lostca dot se
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: max at maxfragg dot de @ 2020-10-26 16:04 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26791

            Bug ID: 26791
           Summary: Missing O_CLOEXEC in sysconf.c
           Product: glibc
           Version: 2.34
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: max at maxfragg dot de
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

if sysconf is used in multithreaded processes, various filedescriptors may leak
due to missing O_CLOEXEC. Bug present in current head and at least all recent
glibc-versions.

diff --git a/sysdeps/unix/sysv/linux/sysconf.c
b/sysdeps/unix/sysv/linux/sysconf.c
index 7958a74..783938a 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -81,7 +81,7 @@ __sysconf (int name)

   if (procfname != NULL)
     {
-      int fd = __open_nocancel (procfname, O_RDONLY);
+      int fd = __open_nocancel (procfname, O_RDONLY|O_CLOEXEC);
       if (fd != -1)
        {
          /* This is more than enough, the file contains a single integer.  */

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/26791] Missing O_CLOEXEC in sysconf.c
  2020-10-26 16:04 [Bug libc/26791] New: Missing O_CLOEXEC in sysconf.c max at maxfragg dot de
@ 2020-11-11 10:32 ` arjun.is at lostca dot se
  2020-11-11 12:32 ` arjun.is at lostca dot se
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: arjun.is at lostca dot se @ 2020-11-11 10:32 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26791

Arjun Shankar <arjun.is at lostca dot se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |arjun.is at lostca dot se
           Assignee|unassigned at sourceware dot org   |arjun.is at lostca dot se
   Last reconfirmed|                            |2020-11-11
     Ever confirmed|0                           |1

--- Comment #1 from Arjun Shankar <arjun.is at lostca dot se> ---
I'll apply, test and commit this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/26791] Missing O_CLOEXEC in sysconf.c
  2020-10-26 16:04 [Bug libc/26791] New: Missing O_CLOEXEC in sysconf.c max at maxfragg dot de
  2020-11-11 10:32 ` [Bug libc/26791] " arjun.is at lostca dot se
@ 2020-11-11 12:32 ` arjun.is at lostca dot se
  2020-11-11 12:33 ` arjun.is at lostca dot se
  2020-11-11 12:37 ` arjun.is at lostca dot se
  3 siblings, 0 replies; 5+ messages in thread
From: arjun.is at lostca dot se @ 2020-11-11 12:32 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26791

Arjun Shankar <arjun.is at lostca dot se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #2 from Arjun Shankar <arjun.is at lostca dot se> ---
Fixed:

commit d2d714b9fc02e4710d6dc769d8ec2c9dab0eb69a
Author: Maximilian Krüger <max@maxfragg.de>
Date:   Wed Nov 11 11:21:30 2020 +0100

    Use O_CLOEXEC in sysconf [BZ #26791]

    If sysconf is used in multithreaded processes, various filedescriptors
    may leak due to missing O_CLOEXEC.  This commit adds the flag.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/26791] Missing O_CLOEXEC in sysconf.c
  2020-10-26 16:04 [Bug libc/26791] New: Missing O_CLOEXEC in sysconf.c max at maxfragg dot de
  2020-11-11 10:32 ` [Bug libc/26791] " arjun.is at lostca dot se
  2020-11-11 12:32 ` arjun.is at lostca dot se
@ 2020-11-11 12:33 ` arjun.is at lostca dot se
  2020-11-11 12:37 ` arjun.is at lostca dot se
  3 siblings, 0 replies; 5+ messages in thread
From: arjun.is at lostca dot se @ 2020-11-11 12:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26791

--- Comment #3 from Arjun Shankar <arjun.is at lostca dot se> ---
Thanks for the report and patch!

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/26791] Missing O_CLOEXEC in sysconf.c
  2020-10-26 16:04 [Bug libc/26791] New: Missing O_CLOEXEC in sysconf.c max at maxfragg dot de
                   ` (2 preceding siblings ...)
  2020-11-11 12:33 ` arjun.is at lostca dot se
@ 2020-11-11 12:37 ` arjun.is at lostca dot se
  3 siblings, 0 replies; 5+ messages in thread
From: arjun.is at lostca dot se @ 2020-11-11 12:37 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26791

Arjun Shankar <arjun.is at lostca dot se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.33

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-11 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 16:04 [Bug libc/26791] New: Missing O_CLOEXEC in sysconf.c max at maxfragg dot de
2020-11-11 10:32 ` [Bug libc/26791] " arjun.is at lostca dot se
2020-11-11 12:32 ` arjun.is at lostca dot se
2020-11-11 12:33 ` arjun.is at lostca dot se
2020-11-11 12:37 ` arjun.is at lostca dot se

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).