OSDN Git Service

fs: take i_mutex during prepare_binprm for set[ug]id executables
authorJann Horn <jann@thejh.net>
Sun, 19 Apr 2015 00:48:39 +0000 (02:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2015 08:22:18 +0000 (10:22 +0200)
commitbdb29adaff1b4b558f19c7efa0b24629728cbc2b
tree1e99bf6da47b992764d7c33bac9a47c58360b075
parentd968c92507a89d90ea8926658b139589683c59f9
fs: take i_mutex during prepare_binprm for set[ug]id executables

commit 8b01fc86b9f425899f8a3a8fc1c47d73c2c20543 upstream.

This prevents a race between chown() and execve(), where chowning a
setuid-user binary to root would momentarily make the binary setuid
root.

This patch was mostly written by Linus Torvalds.

Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/exec.c