[PATCH] exec: Check __FMODE_EXEC instead of in_execve for LSMs

Kevin Locke kevin at kevinlocke.name
Wed Jan 24 19:39:38 UTC 2024


On Wed, 2024-01-24 at 11:22 -0800, Kees Cook wrote:
> After commit 978ffcbf00d8 ("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.

It solves the AppArmor issue I was experiencing and I don't notice any
other issues.

Tested-by: Kevin Locke <kevin at kevinlocke.name>

Thanks!
Kevin



More information about the Linux-security-module-archive mailing list