Re: [PATCH] dma-buf: set SB_I_NOEXEC and SB_I_NODEV on dmabuf filesystem

From: AceLan Kao

Date: Thu Oct 01 2026 - 02:03:51 EST


AceLan Kao <acelan.kao@xxxxxxxxxxxxx> 於 2026年4月13日週一 下午4:10寫道:
>
> Chia-Lin Kao (AceLan) <acelan.kao@xxxxxxxxxxxxx> 於 2026年1月14日週三 上午9:19寫道:
> >
> > The VFS now warns if an inode flagged with S_ANON_INODE is located on a
> > filesystem that does not have SB_I_NOEXEC set. dmabuf inodes are
> > created using alloc_anon_inode(), which sets S_ANON_INODE.
> >
> > This triggers a warning in path_noexec() when a dmabuf is mmapped, for
> > example by GStreamer's v4l2src element.
> >
> > [ 60.061328] WARNING: CPU: 2 PID: 2803 at fs/exec.c:125 path_noexec+0xa0/0xd0
> > ...
> > [ 60.061637] do_mmap+0x2b5/0x680
> >
> > The warning was introduced by commit 1e7ab6f67824 ("anon_inode: rework
> > assertions") which added enforcement that anonymous inodes must be on
> > filesystems with SB_I_NOEXEC set.
> >
> > Fix this by setting SB_I_NOEXEC and SB_I_NODEV on the dmabuf filesystem
> > context, following the same pattern as commit ce7419b6cf23d ("anon_inode:
> > raise SB_I_NODEV and SB_I_NOEXEC") and commit 98f99394a104c ("secretmem:
> > use SB_I_NOEXEC").
> >
> > Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@xxxxxxxxxxxxx>
> > ---
> > drivers/dma-buf/dma-buf.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> > index a4d8f2ff94e46..dea79aaab10ce 100644
> > --- a/drivers/dma-buf/dma-buf.c
> > +++ b/drivers/dma-buf/dma-buf.c
> > @@ -221,6 +221,8 @@ static int dma_buf_fs_init_context(struct fs_context *fc)
> > if (!ctx)
> > return -ENOMEM;
> > ctx->dops = &dma_buf_dentry_ops;
> > + fc->s_iflags |= SB_I_NOEXEC;
> > + fc->s_iflags |= SB_I_NODEV;
> > return 0;
> > }
> >
> > --
> > 2.51.0
> >
> Hi all,
>
> Please help to review this patch.
> It does the same thing as
> ce7419b6cf23d ("anon_inode: raise SB_I_NODEV and SB_I_NOEXEC")
> and
> 98f99394a104c ("secretmem: use SB_I_NOEXEC")
> Thanks.

A gentle ping

--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)