From: Christian Brauner <brauner@kernel.org>
To: syzbot <syzbot+7666ed2c3d42196bf7e3@syzkaller.appspotmail.com>
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
viro@zeniv.linux.org.uk, Jason Gunthorpe <jgg@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>,
iommu@lists.linux.dev
Subject: Re: [syzbot] [fs?] memory leak in path_openat (4)
Date: Fri, 4 Sep 2026 11:18:02 +0200 [thread overview]
Message-ID: <20260904-clown-zersplittern-sequenz-987f972a607b@brauner> (raw)
In-Reply-To: <6a8efe2e.1d9ded08.62e62.00b2.GAE@google.com>
On Wed, Aug 26, 2026 at 07:54:38AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 26260251022f Merge tag 'livepatching-for-7.3' of git://git..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1196a179580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6c1b5958b2d1207f
> dashboard link: https://syzkaller.appspot.com/bug?extid=7666ed2c3d42196bf7e3
> compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=139f7179580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/0f75e7622b1f/disk-26260251.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/2bbff9fd7b60/vmlinux-26260251.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/95d733004907/bzImage-26260251.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+7666ed2c3d42196bf7e3@syzkaller.appspotmail.com
#syz set subsystems: iommufd
This seems to be a reference cycle in iommufd. path_openat() and
alloc_empty_file() is just the place where the file is allocated.
The reproducer does:
r0 = openat$iommufd(AT_FDCWD, "/dev/iommu", 0, 0) /* → fd 4 */
ioctl$IOMMU_IOAS_ALLOC(r0, 0x3b81, {size=0xc}) /* → ioas_id 1 */
ioctl(r0, 0x3b8f, "2800...0400000000...0010") /* IOMMU_IOAS_MAP_FILE */
So that last payload can be decoded as:
iommu_ioas_map_file: size=40, flags=R|W, ioas_id=1, fd=4, start=0, length=0x1000
So fd is r0 itself which is the iommufd fd which is handed back to IOMMU_IOAS_MAP_FILE.
That causes a cycle:
iopt_map_file_pages() does fget(fd) without worrying what it calls it
on. So that does iopt_alloc_file_pages() which takes a long-term reference in pages->file = get_file(file)
The reference is dropped in iopt_release_pages() in fput(pages->file)
from the IOAS teardown. That in turn runs from iommufd_fops_release().
TL;DR:
struct file(/dev/iommu)->private_data-> ictx->objects->ioas->iopt->area->iopt_pages
^ ^
|____________________________ get_file() ____________________________|
Closing the fd does nothing. The hex dump shows the same pattern btw:
- obj1 struct file @ ffff88812811f9c0, obj2 its LSM blob
- obj3 iommufd_ctx @ ffff88811161cd80, first word = ffff88812811f9c0 → ictx->file is obj1
- obj5 xa_node, its ->array = ffff88811161cd88 = &ictx->objects
- obj4 iommufd_object: shortterm_users=1, users=1, type=4, id=1 → the IOAS with ioas_id == 1 from the repro
- obj6 iopt_pages, kref == 1
Likely caused by f4986a72d6e4 ("iommufd: Add IOMMU_IOAS_MAP_FILE")
Afaic,t, this should either reject based on file->f_op == &iommufd_fops.
But iiuc there's other cycles that can be formed.
For example, via a vfio device fd that's bound to the iommufd. It holds an iommufd_ctx reference via iommufd_ctx_from_fd().
So mapping a bound but unattached vfio fd builds the same cycle.
So probably this should do validation what type of file can actually be
used like shmem and hugepage file.
next prev parent reply other threads:[~2026-09-04 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 14:54 [syzbot] [fs?] memory leak in path_openat (4) syzbot
2026-09-04 9:18 ` Christian Brauner [this message]
2026-09-04 9:18 ` syzbot
2026-09-04 9:57 ` Aleksandr Nogikh
2026-09-04 11:47 ` Jason Gunthorpe
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=20260904-clown-zersplittern-sequenz-987f972a607b@brauner \
--to=brauner@kernel.org \
--cc=iommu@lists.linux.dev \
--cc=jack@suse.cz \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+7666ed2c3d42196bf7e3@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