From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>,
syzbot <syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com>
Cc: apopple@nvidia.com, byungchul@sk.com, david@kernel.org,
gourry@gourry.net, joshua.hahnjy@gmail.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
matthew.brost@intel.com, rakie.kim@sk.com,
syzkaller-bugs@googlegroups.com, ying.huang@linux.alibaba.com,
ziy@nvidia.com, dri-devel@lists.freedesktop.org,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Subject: [PATCH] drm/lease: Limit amount of maximum objects per lease.
Date: Wed, 27 May 2026 11:58:53 +0200 [thread overview]
Message-ID: <b3390013-f0de-4e23-a915-23340594fb49@linux.intel.com> (raw)
In-Reply-To: <20260526125818.d78b7db78d26df094258f8dd@linux-foundation.org>
Hey,
Den 2026-05-26 kl. 21:58, skrev Andrew Morton:
> On Mon, 25 May 2026 19:49:23 -0700 syzbot <syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com> wrote:
>
>> Hello,
>>
>> syzbot found the following issue on:
>>
>> HEAD commit: 4cbfe4502e3d Merge tag 'v7.1-rc5-ksmbd-server-fixes' of gi..
>> git tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master
>> console output: https://syzkaller.appspot.com/x/log.txt?x=146c161f980000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=9475bd041c93289
>> dashboard link: https://syzkaller.appspot.com/bug?extid=5d32c8bd82427f9c77cc
>> compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
>> userspace arch: arm64
>> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11026336580000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14ab9796580000
>
> Thanks.
>
>> Downloadable assets:
>> disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/fa3fbcfdac58/non_bootable_disk-4cbfe450.raw.xz
>> vmlinux: https://storage.googleapis.com/syzbot-assets/e825a08fb48d/vmlinux-4cbfe450.xz
>> kernel image: https://storage.googleapis.com/syzbot-assets/55037c053ec3/Image-4cbfe450.gz.xz
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com
>>
>> ------------[ cut here ]------------
>> WARNING: mm/page_alloc.c:5202 at __alloc_frozen_pages_noprof+0x734/0x1144 mm/page_alloc.c:5202, CPU#0: syz.2.17/3592
>
> if (WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER, gfp))
>
>> Modules linked in:
>> CPU: 0 UID: 0 PID: 3592 Comm: syz.2.17 Not tainted syzkaller #0 PREEMPT
>> Hardware name: linux,dummy-virt (DT)
>> pstate: 21402009 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
>> pc : __alloc_frozen_pages_noprof+0x734/0x1144 mm/page_alloc.c:5202
>> lr : alloc_pages_mpol+0x70/0x1a4 mm/mempolicy.c:2490
>> sp : ffff800085d93900
>> x29: ffff800085d93a00 x28: 000000000000000b x27: 0000000000000000
>> x26: 0000000000000000 x25: fcf0000014c00000 x24: 0000000000040dc0
>> x23: 0000000000000000 x22: 0000000000000000 x21: 000000000000000b
>> x20: ffffffffffffffff x19: 0000000000000000 x18: 0000000000000002
>> x17: 0000000000000000 x16: 0000000000000000 x15: 0000000020000200
>> x14: ffff8000828b2000 x13: ffffc1ffc0000000 x12: 0000000000000001
>> x11: 0000000000000000 x10: ffff800082b6f4e8 x9 : 0000000000000000
>> x8 : 0000000000000030 x7 : ffff800082e9b430 x6 : 0000000000000001
>> x5 : 0000000000000000 x4 : f3f00000065c90c0 x3 : 0000000000000000
>> x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffff800082dfd000
>> Call trace:
>> __alloc_frozen_pages_noprof+0x734/0x1144 mm/page_alloc.c:5202 (P)
>> alloc_pages_mpol+0x70/0x1a4 mm/mempolicy.c:2490
>> alloc_frozen_pages_noprof+0x48/0xd4 mm/mempolicy.c:2561
>> ___kmalloc_large_node+0x11c/0x13c mm/slub.c:5237
>> __kmalloc_large_node_noprof mm/slub.c:5268 [inline]
>> __do_kmalloc_node mm/slub.c:5284 [inline]
>> __kmalloc_noprof+0x450/0x560 mm/slub.c:5308
>> kmalloc_noprof include/linux/slab.h:954 [inline]
>> kzalloc_noprof include/linux/slab.h:1188 [inline]
>> fill_object_idr drivers/gpu/drm/drm_lease.c:389 [inline]
>> drm_mode_create_lease_ioctl+0x184/0x93c drivers/gpu/drm/drm_lease.c:521
>> drm_ioctl_kernel+0xc0/0x130 drivers/gpu/drm/drm_ioctl.c:804
>> drm_ioctl+0x258/0x580 drivers/gpu/drm/drm_ioctl.c:901
>> vfs_ioctl fs/ioctl.c:51 [inline]
>
> Methinks drm_mode_create_lease_ioctl() wants some more arg checking.
>
> otoh, memdup_user() passes __GFP_NOWARN, so perhaps
> __alloc_frozen_pages_noprof() should be taught to honor that.
>
A lot of places assume max 32 planes, connectors and crtc's per device.
drm_plane_mask(), drm_connector_mask and drm_crtc_mask are an example.
It wouldn't be too hard to cap it to 96 (or 8 * sizeof(drm_plane_mask(NULL) + ...)
in case it changes. Anything above it will need fixing in a lot of places anyway.
Kind regards,
~Maarten Lankhorst
What about the below?
>> __do_sys_ioctl fs/ioctl.c:597 [inline]
>> __se_sys_ioctl fs/ioctl.c:583 [inline]
>> __arm64_sys_ioctl+0xac/0x104 fs/ioctl.c:583
>> __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
>> invoke_syscall+0x54/0x10c arch/arm64/kernel/syscall.c:49
>> el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:121
>> do_el0_svc+0x1c/0x34 arch/arm64/kernel/syscall.c:140
>> el0_svc+0x38/0x140 arch/arm64/kernel/entry-common.c:740
>> el0t_64_sync_handler+0xa0/0xf0 arch/arm64/kernel/entry-common.c:759
>> el0t_64_sync+0x1a4/0x1a8 arch/arm64/kernel/entry.S:594
>> ---[ end trace 0000000000000000 ]---
>
-- >8 --
There's no practical limit currently to the amount of objects inside the lease ioctl.
Limit it to 96 for now, the maximum of plane_mask + crtc_mask + connector_mask.
I believe this is sufficient on all platforms, and fixes the backtrace below.
------------[ cut here ]------------
WARNING: mm/page_alloc.c:5202 at __alloc_frozen_pages_noprof+0x734/0x1144 mm/page_alloc.c:5202, CPU#0: syz.2.17/3592
if (WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER, gfp))
Modules linked in:
CPU: 0 UID: 0 PID: 3592 Comm: syz.2.17 Not tainted syzkaller #0 PREEMPT
Hardware name: linux,dummy-virt (DT)
pstate: 21402009 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
pc : __alloc_frozen_pages_noprof+0x734/0x1144 mm/page_alloc.c:5202
lr : alloc_pages_mpol+0x70/0x1a4 mm/mempolicy.c:2490
sp : ffff800085d93900
x29: ffff800085d93a00 x28: 000000000000000b x27: 0000000000000000
x26: 0000000000000000 x25: fcf0000014c00000 x24: 0000000000040dc0
x23: 0000000000000000 x22: 0000000000000000 x21: 000000000000000b
x20: ffffffffffffffff x19: 0000000000000000 x18: 0000000000000002
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000020000200
x14: ffff8000828b2000 x13: ffffc1ffc0000000 x12: 0000000000000001
x11: 0000000000000000 x10: ffff800082b6f4e8 x9 : 0000000000000000
x8 : 0000000000000030 x7 : ffff800082e9b430 x6 : 0000000000000001
x5 : 0000000000000000 x4 : f3f00000065c90c0 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffff800082dfd000
Call trace:
__alloc_frozen_pages_noprof+0x734/0x1144 mm/page_alloc.c:5202 (P)
alloc_pages_mpol+0x70/0x1a4 mm/mempolicy.c:2490
alloc_frozen_pages_noprof+0x48/0xd4 mm/mempolicy.c:2561
___kmalloc_large_node+0x11c/0x13c mm/slub.c:5237
__kmalloc_large_node_noprof mm/slub.c:5268 [inline]
__do_kmalloc_node mm/slub.c:5284 [inline]
__kmalloc_noprof+0x450/0x560 mm/slub.c:5308
kmalloc_noprof include/linux/slab.h:954 [inline]
kzalloc_noprof include/linux/slab.h:1188 [inline]
fill_object_idr drivers/gpu/drm/drm_lease.c:389 [inline]
drm_mode_create_lease_ioctl+0x184/0x93c drivers/gpu/drm/drm_lease.c:521
drm_ioctl_kernel+0xc0/0x130 drivers/gpu/drm/drm_ioctl.c:804
drm_ioctl+0x258/0x580 drivers/gpu/drm/drm_ioctl.c:901
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__arm64_sys_ioctl+0xac/0x104 fs/ioctl.c:583
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x54/0x10c arch/arm64/kernel/syscall.c:49
el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:121
do_el0_svc+0x1c/0x34 arch/arm64/kernel/syscall.c:140
el0_svc+0x38/0x140 arch/arm64/kernel/entry-common.c:740
el0t_64_sync_handler+0xa0/0xf0 arch/arm64/kernel/entry-common.c:759
el0t_64_sync+0x1a4/0x1a8 arch/arm64/kernel/entry.S:594
---[ end trace 0000000000000000 ]---
Reported-by: syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 5d2cf724cbd7b..9d0ccc8e0274f 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -486,6 +486,10 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
struct drm_file *lessee_priv;
int fd = -1;
uint32_t *object_ids;
+ static const size_t max_objects =
+ 8 * sizeof(drm_crtc_mask(NULL)) +
+ 8 * sizeof(drm_plane_mask(NULL)) +
+ 8 * sizeof(drm_connector_mask(NULL));
/* Can't lease without MODESET */
if (!drm_core_check_feature(dev, DRIVER_MODESET))
@@ -505,6 +509,11 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
}
object_count = cl->object_count;
+ if (object_count > max_objects) {
+ drm_dbg_lease(dev, "too many objects (%ld)\n", object_count);
+ ret = -EINVAL;
+ goto out_lessor;
+ }
/* Handle leased objects, if any */
idr_init(&leases);
next prev parent reply other threads:[~2026-05-27 9:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6a150a33.2b0a0220.185dbd.0005.GAE@google.com>
2026-05-26 19:58 ` [syzbot] [mm?] WARNING in alloc_frozen_pages_noprof (2) Andrew Morton
2026-05-27 9:58 ` Maarten Lankhorst [this message]
2026-05-28 2:30 ` Claude review: drm/lease: Limit amount of maximum objects per lease Claude Code Review Bot
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=b3390013-f0de-4e23-a915-23340594fb49@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=david@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=rakie.kim@sk.com \
--cc=simona@ffwll.ch \
--cc=syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tzimmermann@suse.de \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.com \
/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