This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/17523] open() and openat() ignore 'mode' with O_TMPFILE
- From: "e at nanocritical dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 06 Nov 2014 21:57:30 +0000
- Subject: [Bug libc/17523] open() and openat() ignore 'mode' with O_TMPFILE
- Auto-submitted: auto-generated
- References: <bug-17523-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=17523
--- Comment #7 from Eric Rannaud <e at nanocritical dot com> ---
(In reply to Florian Weimer from comment #6)
> > fd = open("/path/to/dir", O_TMPFILE|O_WRONLY, 0600);
> > snprintf(path, PATH_MAX, "/proc/self/fd/%d", fd);
> > linkat(AT_FDCWD, path, AT_FDCWD, "/path/for/file", AT_SYMLINK_FOLLOW);
>
> Why would anyone want to do this instead of opening /path/for/file directly
> with O_CREATE|O_EXCL?
An interesting application would set stricter permissions after open and before
linkat, such as:
fsetxattr(fd, "security.selinux", ...)
This being said, I don't know if there any real users at this point. The need
for linkat on a mounted /proc (as opposed to a hypothetical flink(2)) appears
to make people think twice.
Samba people are looking to use this feature to emulate a regular open(O_CREAT)
that can atomically set ACLs before making the file visible in the filesystem:
https://lkml.org/lkml/2014/10/31/119
https://lkml.org/lkml/2014/11/3/843
--
You are receiving this mail because:
You are on the CC list for the bug.