linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: syzbot <syzbot+a9391462075ffb9f77c6@syzkaller.appspotmail.com>,
	 jack@suse.cz, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk
Subject: Re: [syzbot] [fs?] [mm?] WARNING in path_noexec (2)
Date: Mon, 6 Oct 2025 12:47:50 +0200	[thread overview]
Message-ID: <20251006-wachsen-zusendung-6cc31055eb75@brauner> (raw)
In-Reply-To: <202509301457.30490A014C@keescook>

On Tue, Sep 30, 2025 at 03:04:22PM -0700, Kees Cook wrote:
> On Tue, Sep 30, 2025 at 01:17:34PM -0700, syzbot wrote:
> > Reported-by: syzbot+a9391462075ffb9f77c6@syzkaller.appspotmail.com
> > 
> > ------------[ cut here ]------------
> > WARNING: CPU: 1 PID: 6000 at fs/exec.c:119 path_noexec+0x1af/0x200 fs/exec.c:118
> 
> Christian, this is:
> 
> bool path_noexec(const struct path *path)
> {
>         /* If it's an anonymous inode make sure that we catch any shenanigans. */
>         VFS_WARN_ON_ONCE(IS_ANON_FILE(d_inode(path->dentry)) &&
>                          !(path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC));
>         return (path->mnt->mnt_flags & MNT_NOEXEC) ||
>                (path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC);
> }
> 
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13e5fd6f980000
> 
> I think is from the created fd_dma_buf. I expect this would fix it:
> 
> 
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 2bcf9ceca997..6e2ab1a4560d 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -189,6 +189,8 @@ static int dma_buf_fs_init_context(struct fs_context *fc)
>  {
>  	struct pseudo_fs_context *ctx;
>  
> +	fc->s_iflags |= SB_I_NOEXEC;
> +	fc->s_iflags |= SB_I_NODEV;

Yeah, that seems like a good thing to do.
I'm quite happy that the VFS_WARN_ON_ONCE() in there is catching all
this!

Do you want to send a real patch I can pick up?

>  	ctx = init_pseudo(fc, DMA_BUF_MAGIC);
>  	if (!ctx)
>  		return -ENOMEM;
> 
> 
> Which reminds me, this still isn't landed either for secretmem:
> https://lore.kernel.org/all/20250707171735.GE1880847@ZenIV/

It should be in mainline as:
commit 98f99394a104cc80296da34a62d4e1ad04127013 ("secretmem: use SB_I_NOEXEC")


      reply	other threads:[~2025-10-06 10:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-30 20:17 syzbot
2025-09-30 22:04 ` Kees Cook
2025-10-06 10:47   ` Christian Brauner [this message]

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=20251006-wachsen-zusendung-6cc31055eb75@brauner \
    --to=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=kees@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+a9391462075ffb9f77c6@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --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