From: Al Viro <viro@ZenIV.linux.org.uk>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Hugh Dickins <hugh@veritas.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Joe Malicki <jmalicki@metacarta.com>,
Michael Itz <mitz@metacarta.com>,
Kenneth Baker <bakerk@metacarta.com>,
Chris Wright <chrisw@sous-sol.org>,
David Howells <dhowells@redhat.com>,
Alexey Dobriyan <adobriyan@gmail.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Q: check_unsafe_exec() races (Was: [PATCH 2/4] fix setuid sometimes doesn't)
Date: Mon, 30 Mar 2009 13:31:01 +0100 [thread overview]
Message-ID: <20090330123101.GQ28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20090330014040.GA4807@redhat.com>
On Mon, Mar 30, 2009 at 03:40:40AM +0200, Oleg Nesterov wrote:
> > We can't proceed. If that another exec() fails, it will clear "under exec" at
> > the end of do_execve(), before we kill other threads.
>
> Or we need a counter to mark/unmark.
Nah, easier to have check_unsafe_exec() return -EAGAIN in cases we care
about.
Anyway, completely untested patchset is in
git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/ execve-mess
(the last 9 changesets of it).
WARNING: that's *NOT* for merge at the moment; this is not a pull request.
Review (and testing) would be welcome.
Shortlog of execve-related part:
Al Viro (6):
Take fs_struct handling to new file (fs/fs_struct.c), sanitize chroot_fs_refs()
New helper - current_umask()
Get rid of indirect include of fs_struct.h
Kill unsharing fs_struct in __set_personality()
New locking/refcounting for fs_struct
check_unsafe_exec() doesn't care about signal handlers sharing
Hugh Dickins (3):
Don't bump fs_struct refcount for procfs accesses
compat_do_execve should unshare_files
fix setuid sometimes doesn't - files_struct
Diffstat (again, of execve-related stuff)
arch/cris/kernel/process.c | 1 -
arch/powerpc/platforms/cell/spufs/inode.c | 2 +-
fs/Makefile | 2 +-
fs/btrfs/acl.c | 2 +-
fs/btrfs/ioctl.c | 2 +-
fs/cifs/dir.c | 4 +-
fs/cifs/inode.c | 4 +-
fs/compat.c | 28 ++++-
fs/dcache.c | 1 +
fs/exec.c | 39 +++++--
fs/ext2/acl.c | 2 +-
fs/ext3/acl.c | 2 +-
fs/ext4/acl.c | 2 +-
fs/fat/inode.c | 2 +-
fs/fs_struct.c | 173 +++++++++++++++++++++++++++++
fs/generic_acl.c | 2 +-
fs/gfs2/acl.c | 2 +-
fs/hfsplus/options.c | 2 +-
fs/hpfs/super.c | 2 +-
fs/internal.h | 8 +-
fs/jffs2/acl.c | 2 +-
fs/jfs/acl.c | 2 +-
fs/namei.c | 14 +--
fs/namespace.c | 61 +----------
fs/nfs/nfs3proc.c | 6 +-
fs/nfs/nfs4proc.c | 2 +-
fs/nfsd/nfssvc.c | 7 +-
fs/ocfs2/acl.c | 2 +-
fs/omfs/inode.c | 2 +-
fs/open.c | 1 +
fs/proc/base.c | 53 +++------
fs/proc/task_nommu.c | 3 +-
fs/reiserfs/xattr_acl.c | 2 +-
fs/xfs/linux-2.6/xfs_iops.c | 4 +-
include/linux/fs.h | 2 +
include/linux/fs_struct.h | 7 +-
include/linux/mnt_namespace.h | 2 +
include/linux/nsproxy.h | 1 +
include/linux/sched.h | 3 +-
init/do_mounts.c | 1 +
ipc/mqueue.c | 2 +-
kernel/auditsc.c | 1 +
kernel/exec_domain.c | 22 ----
kernel/exit.c | 32 +-----
kernel/fork.c | 63 +++++------
kernel/sys.c | 1 +
net/unix/af_unix.c | 2 +-
security/tomoyo/realpath.c | 1 +
48 files changed, 337 insertions(+), 246 deletions(-)
create mode 100644 fs/fs_struct.c
next prev parent reply other threads:[~2009-03-30 12:32 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-28 23:16 [PATCH 1/4] compat_do_execve should unshare_files Hugh Dickins
2009-03-28 23:20 ` [PATCH 2/4] fix setuid sometimes doesn't Hugh Dickins
2009-03-29 0:53 ` Q: check_unsafe_exec() races (Was: [PATCH 2/4] fix setuid sometimes doesn't) Oleg Nesterov
2009-03-29 4:10 ` Al Viro
2009-03-29 4:14 ` Al Viro
2009-03-29 4:52 ` Oleg Nesterov
2009-03-29 5:55 ` Al Viro
2009-03-29 6:01 ` Al Viro
2009-03-29 21:36 ` Oleg Nesterov
2009-03-29 22:20 ` Al Viro
2009-03-29 23:56 ` Oleg Nesterov
2009-03-30 0:03 ` Oleg Nesterov
2009-03-30 1:08 ` Al Viro
2009-03-30 1:13 ` Al Viro
2009-03-30 1:36 ` Oleg Nesterov
2009-03-30 1:40 ` Oleg Nesterov
2009-03-30 12:31 ` Al Viro [this message]
2009-03-30 14:32 ` Hugh Dickins
2009-03-31 6:16 ` Al Viro
2009-04-01 0:28 ` Hugh Dickins
2009-04-01 2:38 ` Al Viro
2009-04-01 3:03 ` Al Viro
2009-04-01 11:25 ` Hugh Dickins
2009-04-06 15:31 ` Oleg Nesterov
2009-04-19 16:30 ` Hugh Dickins
2009-04-21 16:10 ` Oleg Nesterov
2009-04-21 16:31 ` Linus Torvalds
2009-04-21 17:15 ` Oleg Nesterov
2009-04-21 17:35 ` Linus Torvalds
2009-04-21 19:39 ` Hugh Dickins
2009-04-23 23:01 ` [PATCH 1/2] do_execve() must not clear fs->in_exec if it was set by another thread Oleg Nesterov
2009-04-23 23:18 ` Roland McGrath
2009-04-23 23:31 ` Al Viro
2009-04-24 11:57 ` [PATCH 3/2] check_unsafe_exec: rcu_read_unlock Hugh Dickins
2009-04-24 14:34 ` Oleg Nesterov
2009-04-24 4:20 ` [PATCH 1/2] do_execve() must not clear fs->in_exec if it was set by another thread Hugh Dickins
2009-04-23 23:02 ` [PATCH 2/2] check_unsafe_exec: s/lock_task_sighand/rcu_read_lock/ Oleg Nesterov
2009-04-23 23:18 ` Roland McGrath
2009-04-24 4:29 ` Hugh Dickins
2009-04-01 11:18 ` Q: check_unsafe_exec() races (Was: [PATCH 2/4] fix setuid sometimes doesn't) Hugh Dickins
2009-04-06 15:51 ` Oleg Nesterov
2009-04-19 16:44 ` Hugh Dickins
2009-04-21 16:39 ` Oleg Nesterov
2009-03-30 23:45 ` Serge E. Hallyn
2009-03-31 6:19 ` Al Viro
2009-03-28 23:21 ` [PATCH 3/4] fix setuid sometimes wouldn't Hugh Dickins
2009-03-29 11:19 ` Alexey Dobriyan
2009-03-29 21:48 ` Oleg Nesterov
2009-03-29 22:37 ` Al Viro
2009-03-28 23:23 ` [PATCH 4/4] Annotate struct fs_struct's usage count restriction Hugh Dickins
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=20090330123101.GQ28946@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bakerk@metacarta.com \
--cc=chrisw@sous-sol.org \
--cc=dhowells@redhat.com \
--cc=gregkh@suse.de \
--cc=hugh@veritas.com \
--cc=jmalicki@metacarta.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mitz@metacarta.com \
--cc=oleg@redhat.com \
--cc=torvalds@linux-foundation.org \
/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).