From: John Johansen <john.johansen@canonical.com>
To: Kees Cook <keescook@chromium.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Kevin Locke <kevin@kevinlocke.name>,
Kentaro Takeda <takedakn@nttdata.co.jp>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Josh Triplett <josh@joshtriplett.org>,
Mateusz Guzik <mjguzik@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [6.8-rc1 Regression] Unable to exec apparmor_parser from virt-aa-helper
Date: Fri, 26 Jan 2024 21:17:22 -0800 [thread overview]
Message-ID: <ff9a525e-8c39-4590-9ace-57f4426cbe74@canonical.com> (raw)
In-Reply-To: <202401240958.8D9A11E8E@keescook>
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@linux-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...
>
next prev parent reply other threads:[~2024-01-27 5:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 16:19 Kevin Locke
2024-01-24 16:35 ` Kees Cook
2024-01-24 16:46 ` Linus Torvalds
2024-01-24 16:54 ` Linus Torvalds
2024-01-24 17:10 ` Linus Torvalds
2024-01-24 17:21 ` Kees Cook
2024-01-24 17:27 ` Linus Torvalds
2024-01-24 18:27 ` Linus Torvalds
2024-01-24 18:29 ` Linus Torvalds
2024-01-24 19:02 ` Kees Cook
2024-01-24 19:41 ` Linus Torvalds
2024-01-25 14:16 ` Tetsuo Handa
2024-01-25 17:17 ` Linus Torvalds
2024-01-27 7:04 ` Tetsuo Handa
2024-01-27 11:00 ` Tetsuo Handa
2024-01-27 11:23 ` Tetsuo Handa
2024-01-24 18:57 ` Kees Cook
2024-01-27 5:17 ` John Johansen [this message]
2024-01-24 17:15 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff9a525e-8c39-4590-9ace-57f4426cbe74@canonical.com \
--to=john.johansen@canonical.com \
--cc=josh@joshtriplett.org \
--cc=keescook@chromium.org \
--cc=kevin@kevinlocke.name \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=takedakn@nttdata.co.jp \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox