Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exec: Check __FMODE_EXEC instead of in_execve for LSMs
After commit 978ffcb ("execve: open the executable file before doing anything else"), current->in_execve was no longer in sync with the open(). This broke AppArmor and TOMOYO which depend on this flag to distinguish "open" operations from being "exec" operations. Instead of moving around in_execve, switch to using __FMODE_EXEC, which is where the "is this an exec?" intent is stored. Note that TOMOYO still uses in_execve around cred handling. Reported-by: Kevin Locke <[email protected]> Closes: https://lore.kernel.org/all/[email protected] Suggested-by: Linus Torvalds <[email protected]> Fixes: 978ffcb ("execve: open the executable file before doing anything else") Cc: Josh Triplett <[email protected]> Cc: John Johansen <[email protected]> Cc: Paul Moore <[email protected]> Cc: James Morris <[email protected]> Cc: Serge E. Hallyn <[email protected]> Cc: Kentaro Takeda <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Jan Kara <[email protected]> Cc: Eric Biederman <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information