From: Andrew Ayer <agwa@andrewayer.name>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] vfs: POSIX-compliant version of fchmodat with flag argument
Date: Fri, 30 Dec 2011 16:26:49 -0800 [thread overview]
Message-ID: <1325291211-30354-1-git-send-email-agwa@andrewayer.name> (raw)
Hi,
The below patches implement a 4 argument version of fchmodat (fchmodat4)
that supports a flag argument, as specified by POSIX. Currently, the
glibc wrapper has a flag argument, but fails with EOPNOTSUPP if you
specify AT_SYMLINK_NOFOLLOW. POSIX says that fchmodat should only fail
with EOPNOTSUPP if you specify AT_SYMLINK_NOFOLLOW and the path actually
refers to a symbolic link (and the system doesn't support changing the
mode of symbolic links). Unfortunately glibc can't do better because
the current syscall doesn't have a flag argument.
In addition to supporting AT_SYMLINK_NOFOLLOW, this also supports the
AT_EMPTY_PATH flag, just like fchownat.
Besides the POSIX-compliance, this patch will make it possible to
ensure, in a race-free way, that you do not follow symlinks when
chmodding. Previously, you could open a file with O_NOFOLLOW and fchmod
it, but this only worked if you had read or write permissions on the
file. Now you can open the file with O_PATH|O_NOFOLLOW and do fchmodat
with AT_EMPTY_PATH.
Any feedback is welcome.
Cheers,
Andrew
next reply other threads:[~2011-12-31 0:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-31 0:26 Andrew Ayer [this message]
2011-12-31 0:26 ` [PATCH 1/2] vfs: Add POSIX-compliant version of fchmodat syscall Andrew Ayer
2011-12-31 0:26 ` [PATCH 2/2] x86: Hook up new fchmodat4 syscall Andrew Ayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1325291211-30354-1-git-send-email-agwa@andrewayer.name \
--to=agwa@andrewayer.name \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).