This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17523] open() and openat() ignore 'mode' with O_TMPFILE


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

Eric Rannaud <e at nanocritical dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |e at nanocritical dot com

--- Comment #1 from Eric Rannaud <e at nanocritical dot com> ---
Created attachment 7864
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7864&action=edit
Proposed fix

Patch written against 'master', successfully tested on top of Arch's glibc
2.20-2

Note that O_TMPFILE is a multi-bit mask, so the test becomes:

-  if (oflag & O_CREAT)
+  if ((oflag & O_CREAT) != 0 || (oflag & O_TMPFILE) == O_TMPFILE)

Using (oflag & O_TMPFILE) != 0 would trigger when just O_DIRECTORY is in oflag,
as the definition of O_TMPFILE is (see https://lwn.net/Articles/558951/)

#define O_TMPFILE (O_DIRECTORY | O_RDWR | __O_TMPFILE)

I've modified all instances of the test (oflag & O_CREAT) in the source as I
believe the change is required everywhere, but this should be reviewed.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]