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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 19 Apr 2015 20:46:21 +0000 (13:46 -0700)
commit8b01fc86b9f425899f8a3a8fc1c47d73c2c20543
tree99e05c7758aed78cfaf10556cbe7057efaa5c02c
parent5224b9613b91d937c6948fe977023247afbcc04e
fs: take i_mutex during prepare_binprm for set[ug]id executables

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>
fs/exec.c