[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ff9a525e-8c39-4590-9ace-57f4426cbe74@canonical.com>
Date: Fri, 26 Jan 2024 21:17:22 -0800
From: John Johansen <john.johansen@...onical.com>
To: Kees Cook <keescook@...omium.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Kevin Locke <kevin@...inlocke.name>,
Kentaro Takeda <takedakn@...data.co.jp>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Josh Triplett <josh@...htriplett.org>, Mateusz Guzik <mjguzik@...il.com>,
Al Viro <viro@...iv.linux.org.uk>, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [6.8-rc1 Regression] Unable to exec apparmor_parser from
virt-aa-helper
On 1/24/24 10:57, Kees Cook wrote:
> On Wed, Jan 24, 2024 at 09:10:58AM -0800, Linus Torvalds wrote:
>> On Wed, 24 Jan 2024 at 08:54, Linus Torvalds
>> <torvalds@...ux-foundation.org> wrote:
>>>
>>> Hmm. That whole thing is disgusting. I think it should have checked
>>> FMODE_EXEC, and I have no idea why it doesn't.
>>
>> Maybe because FMODE_EXEC gets set for uselib() calls too? I dunno. I
>> think it would be even better if we had the 'intent' flags from
>> 'struct open_flags' available, but they aren't there in the
>> file_open() security chain.
>
> I've tested AppArmor, and this works fine:
>
thanks. I also ran it through the regression test suit, to double
check so that Murphy doesn't bite.
that this even tripped a regression is a bug that I am going to
have to chase down. The file check at this point should just be
redundant.
thanks for the quick fix
> diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
> index 7717354ce095..ab104ce05f96 100644
> --- a/security/apparmor/lsm.c
> +++ b/security/apparmor/lsm.c
> @@ -470,7 +470,7 @@ static int apparmor_file_open(struct file *file)
> * implicit read and executable mmap which are required to
> * actually execute the image.
> */
> - if (current->in_execve) {
> + if (file->f_flags & __FMODE_EXEC) {
> fctx->allow = MAY_EXEC | MAY_READ | AA_EXEC_MMAP;
> return 0;
> }
>
> Converting TOMOYO is less obvious to me, though, as it has a helper that
> isn't strictly always called during open(). I haven't finished figuring
> out the call graphs for it...
>
Powered by blists - more mailing lists