WARNING in __alloc_frozen_pages_noprof
Subsystems (2)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: af2ea8ab7a54 Add linux-next specific files for 20241205 git tree: linux-next console+strace: https://syzkaller.appspot.com/x/log.txt?x=1369fde8580000 kernel config: https://syzkaller.appspot.com/x/.config?x=76f158395f6f15fd dashboard link: https://syzkaller.appspot.com/bug?extid=03fb58296859d8dbab4d compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15070820580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16e870f8580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8af0861258fa/disk-af2ea8ab.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ffb38cf7a344/vmlinux-af2ea8ab.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6fbd2e50358a/bzImage-af2ea8ab.xz
The issue was bisected to:
commit 3a34b13a88caeb2800ab44a4918f230041b37dd9
Author: Linus Torvalds <[email protected]> Date: Fri Jul 30 22:42:34 2021 +0000
pipe: make pipe writes always wake up readers
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10759c0f980000 final oops: https://syzkaller.appspot.com/x/report.txt?x=12759c0f980000 console output: https://syzkaller.appspot.com/x/log.txt?x=14759c0f980000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 5830 at mm/page_alloc.c:4728 __alloc_frozen_pages_noprof+0x3c5/0x710 mm/page_alloc.c:4728 Modules linked in: CPU: 0 UID: 0 PID: 5830 Comm: syz-executor405 Not tainted 6.13.0-rc1-next-20241205-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:__alloc_frozen_pages_noprof+0x3c5/0x710 mm/page_alloc.c:4728 Code: ff df 0f 85 09 01 00 00 44 89 e9 81 e1 7f ff ff ff a9 00 00 04 00 41 0f 44 cd 41 89 cd e9 f9 00 00 00 c6 05 87 3a 0c 0e 01 90 <0f> 0b 90 41 83 fc 0a 0f 86 13 fd ff ff 45 31 e4 48 c7 44 24 20 0e RSP: 0018:ffffc90003e8f940 EFLAGS: 00010246 RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc90003e8f9c8 RBP: ffffc90003e8fa50 R08: ffffc90003e8f9c7 R09: 0000000000000000 R10: ffffc90003e8f9a0 R11: fffff520007d1f39 R12: 0000000000000020 R13: 0000000000040d40 R14: 1ffff920007d1f30 R15: 1ffff920007d1f2c FS: 0000555587715480(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020001000 CR3: 000000003352e000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __alloc_pages_noprof+0xa/0x30 mm/page_alloc.c:4786 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] ___kmalloc_large_node+0x8b/0x1d0 mm/slub.c:4228 __kmalloc_large_node_noprof+0x1a/0x80 mm/slub.c:4255 __do_kmalloc_node mm/slub.c:4271 [inline] __kmalloc_noprof+0x339/0x4c0 mm/slub.c:4295 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] v9fs_fid_get_acl+0x4f/0x100 fs/9p/acl.c:32 __v9fs_get_acl fs/9p/acl.c:66 [inline] v9fs_get_acl+0x96/0x350 fs/9p/acl.c:92 v9fs_qid_iget_dotl fs/9p/vfs_inode_dotl.c:131 [inline] v9fs_inode_from_fid_dotl+0x22d/0x2c0 fs/9p/vfs_inode_dotl.c:154 v9fs_get_new_inode_from_fid fs/9p/v9fs.h:251 [inline] v9fs_mount+0x718/0xa90 fs/9p/vfs_super.c:142 legacy_get_tree+0xee/0x190 fs/fs_context.c:662 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f05fcd17de9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffc85e9b418 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f05fcd17de9 RDX: 0000000020000b80 RSI: 00000000200003c0 RDI: 0000000000000000 RBP: 000000000000ec55 R08: 0000000020000580 R09: 00007ffc85e9b450 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc85e9b450 R13: 00007ffc85e9b43c R14: 431bde82d7b634db R15: 00007f05fcd60087 </TASK>
---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot. For information about bisection process see: https://goo.gl/tpsmEJ#bisection
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
syzbot creates a pipe and writes some data to it. It then creates a v9fs mount using the pipe as transport. The data in the pipe specifies an ACL of size 9 TB (9895604649984 bytes) for the root inode, causing kmalloc to fail.
KMALLOC_MAX_SIZE is probably too loose of an upper bound for the size of an ACL, but I didn't see an existing limit for V9FS like in e.g. NFS:
include/linux/nfsacl.h:
Quoted 9 lines
/* Maximum number of ACL entries over NFS */
#defineNFS_ACL_MAX_ENTRIES1024#define
NFSACL_MAXWORDS(2*(2+3*NFS_ACL_MAX_ENTRIES))#define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \ >> PAGE_SHIFT)#define
NFS_ACL_MAX_ENTRIES_INLINE(5)
#defineNFS_ACL_INLINE_BUFSIZE((2*(2+3*NFS_ACL_MAX_ENTRIES_INLINE)) << 2)
#syz test
--- fs/9p/acl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/9p/acl.c +2 -0
@@ -28,6 +28,8 @@ static struct posix_acl *v9fs_fid_get_acl(struct p9_fid *fid, const char *name)return ERR_PTR (size);if (size ==0 )return ERR_PTR (-ENODATA ); +if (size >KMALLOC_MAX_SIZE ) +return ERR_PTR (-ERANGE ); value =kzalloc (size,GFP_NOFS );if (!value)
Signature · 1 line
2.43.0
syzbot
syzbotsyzbot tried to test the proposed patch but the build/boot failed:
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
drivers/gpu/drm/i915/gt/intel_rc6.c:139:19: error: static assertion expression is not an integral constant expression drivers/gpu/drm/i915/gt/intel_rc6.c:140:12: error: static assertion expression is not an integral constant expression fs/bcachefs/str_hash.c:164:2: error: expected expressionfs/bcachefs/str_hash.c:165:30: error: use of undeclared identifier 'inode' fs/bcachefs/str_hash.c:169:55: error: use of undeclared identifier 'inode' fs/bcachefs/str_hash.c:171:40: error: use of undeclared identifier 'inode'
Tested on:
commit: 91e71d60 Add linux-next specific files for 20241211 git tree: linux-next kernel config: https://syzkaller.appspot.com/x/.config?x=76f158395f6f15fd dashboard link: https://syzkaller.appspot.com/bug?extid=03fb58296859d8dbab4d compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 patch: https://syzkaller.appspot.com/x/patch.diff?x=12987544580000
[email protected]
maintainerAlloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
In reply to Leo StoneLeo Stone wrote on Wed, Dec 11, 2024 at 12:02:40PM -0800:
Quoted 4 lines
syzbot creates a pipe and writes some data to it. It then creates a v9fs mount using the pipe as transport. The data in the pipe specifies an ACL of size 9 TB (9895604649984 bytes) for the root inode, causing kmalloc to fail.
grmbl.
Sorry about that, there's been some paches ages ago to either cap xattrs allocations to XATTR_SIZE_MAX, KMALLOC_MAX_SIZE, look into vfs_getxattr_alloc or just flag the alloc __GFP_NOWARN:
https://lore.kernel.org/all/[email protected]/T/#u
and it was left forgotten because no decision was taken on something I don't have time to think about
I've re-added everyone involved in Ccs, let's pick one and be done with it.
Christian Schoenebeck's suggestion was something like this -- I guess that's good enough for now and won't break anything (e.g. ACLs bigger than XATTR_SIZE_MAX), so shall we go with that instead?
I don't care but let's get something in this cycle, the first patch is almost one year old and this is ridiculous...
fs/9p/xattr.c +2 -2
@@ -37,8 +37,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,if (attr_size > buffer_size) {if (buffer_size) retval = -ERANGE ; -else if (attr_size >SSIZE_MAX ) - retval = -EOVERFLOW ; +else if (attr_size >KMALLOC_MAX_SIZE ) + retval = -E2BIG ;else /* request to get the attr_size */ retval = attr_size; }else {
--
Dominique,
sleepy
Re: Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
Quoted 4 lines · On Wed, 11 Dec 2024 at 13:04, <[email protected]> wrote:
Christian Schoenebeck's suggestion was something like this -- I guess that's good enough for now and won't break anything (e.g. ACLs bigger than
XATTR_SIZE_MAX), so shall we go with that instead?
Please use XATTR_SIZE_MAX. The KMALLOC_MAX_SIZE limit seems to make no sense in this context.
Afaik the VFS layer doesn't allow getting an xattr bigger than XATTR_SIZE_MAX anyway, and would return E2BIG for them later regardless, so returning anything bigger wouldn't work anyway, even if p9 tried to return such a thing up to some bigger limit.
No?
Linus
Al Viro
maintainerRe: Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · On Wed, 11 Dec 2024 at 13:04, <[email protected]> wrote:
Christian Schoenebeck's suggestion was something like this -- I guess that's good enough for now and won't break anything (e.g. ACLs bigger than
XATTR_SIZE_MAX), so shall we go with that instead?
Quoted 7 lines
Please use
XATTR_SIZE_MAX. TheKMALLOC_MAX_SIZElimit seems to make no sense in this context.Afaik the VFS layer doesn't allow getting an xattr bigger than
XATTR_SIZE_MAXanyway, and would return E2BIG for them later regardless, so returning anything bigger wouldn't work anyway, even if p9 tried to return such a thing up to some bigger limit.
E2BIG on attempt to set, quiet cap to XATTR_SIZE_MAX on attempt to get (i.e. never asking more than that from fs) and if filesystem complains about XATTR_SIZE_MAX not being enough, E2BIG it is (instead of ERANGE normally expected on "your buffer is too small for that").
Christian Schoenebeck
reviewerRe: Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
Quoted 15 lines · CET Al Viro
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · On Wed, 11 Dec 2024 at 13:04, <[email protected]> wrote:
Christian Schoenebeck's suggestion was something like this -- I guess that's good enough for now and won't break anything (e.g. ACLs bigger than
XATTR_SIZE_MAX), so shall we go with that instead?Quoted 7 lines
Please use
XATTR_SIZE_MAX. TheKMALLOC_MAX_SIZElimit seems to make no sense in this context.Afaik the VFS layer doesn't allow getting an xattr bigger than
XATTR_SIZE_MAXanyway, and would return E2BIG for them later regardless, so returning anything bigger wouldn't work anyway, even if p9 tried to return such a thing up to some bigger limit.
Quoted 4 lines
E2BIG on attempt to set, quiet cap to
XATTR_SIZE_MAXon attempt to get (i.e. never asking more than that from fs) and if filesystem complains aboutXATTR_SIZE_MAXnot being enough, E2BIG it is (instead of ERANGE normally expected on "your buffer is too small for that").
So that cap is effective even if that xattr does not go out to user space?
I mean the concern I had was about ACLs on guest, which are often mapped with 9p to xattr on host and can become pretty big. So these were xattr not directly exposed to guest's user space.
/Christian
Christian Schoenebeck
reviewerRe: Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
Quoted 21 lines · CET Christian Schoenebeck
Quoted 15 lines · CET Al Viro
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · On Wed, 11 Dec 2024 at 13:04, <[email protected]> wrote:
Christian Schoenebeck's suggestion was something like this -- I guess that's good enough for now and won't break anything (e.g. ACLs bigger than
XATTR_SIZE_MAX), so shall we go with that instead?Quoted 7 lines
Please use
XATTR_SIZE_MAX. TheKMALLOC_MAX_SIZElimit seems to make no sense in this context.Afaik the VFS layer doesn't allow getting an xattr bigger than
XATTR_SIZE_MAXanyway, and would return E2BIG for them later regardless, so returning anything bigger wouldn't work anyway, even if p9 tried to return such a thing up to some bigger limit.Quoted 4 lines
E2BIG on attempt to set, quiet cap to
XATTR_SIZE_MAXon attempt to get (i.e. never asking more than that from fs) and if filesystem complains aboutXATTR_SIZE_MAXnot being enough, E2BIG it is (instead of ERANGE normally expected on "your buffer is too small for that").
Quoted 5 lines
So that cap is effective even if that xattr does not go out to user space?
I mean the concern I had was about ACLs on guest, which are often mapped with 9p to xattr on host and can become pretty big. So these were xattr not directly exposed to guest's user space.
AFAICS it is not capped in this particular case: v9fs_fid_get_acl() calls v9fs_fid_xattr_get() for getting the xattr, which in turn calls p9 client functions to retrieve the xattr directly from 9p server (host). So the regular Linux VFS layers are not involved here.
I also see no limit applied in fs/posix_acl.c when encoding/decoding ACLs.
And 9p server is not necessarily a Linux host, hence Linux's limit for xattr do not necessarily apply.
So to me KMALLOC_MAX_SIZE (or better: 9p client's msize - header) still looks right here, no?
/Christian
syzbot
syzbotFor archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: Re: [syzbot] [v9fs?] WARNING in __alloc_frozen_pages_noprof
Author: [email protected]
#syz test
fs/9p/acl.c +2 -0
@@ -28,6 +28,8 @@ static struct posix_acl *v9fs_fid_get_acl(struct p9_fid *fid, const char *name)return ERR_PTR (size);if (size ==0 )return ERR_PTR (-ENODATA ); +if (size >KMALLOC_MAX_SIZE ) +return ERR_PTR (-ERANGE ); value =kzalloc (size,GFP_NOFS );if (!value)
PATCH 1/1 9p: Limit xattr size to XATTR_SIZE_MAX
In reply to syzbotsyzbot triggered a warning in kmalloc by trying to mount a v9fs filesystem from a pipe, after specifying an ACL size of 9TB for the root inode in the data written to the pipe.
An xattr larger than XATTR_SIZE_MAX is considered invalid by the VFS layer anyway. See do_getxattr():
Quoted 5 lines
} else if (error == -ERANGE && ctx->size >= XATTR_SIZE_MAX) {
/* The file system tried to returned a value bigger
than XATTR_SIZE_MAX bytes. Not possible. */
error = -E2BIG;
}---
See: https://lore.kernel.org/all/[email protected]/T/
--- fs/9p/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/9p/xattr.c +2 -2
@@ -37,8 +37,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,if (attr_size > buffer_size) {if (buffer_size) retval = -ERANGE ; -else if (attr_size >SSIZE_MAX ) - retval = -EOVERFLOW ; +else if (attr_size >XATTR_SIZE_MAX ) + retval = -E2BIG ;else /* request to get the attr_size */ retval = attr_size; }else {
Signature · 1 line
2.43.0
syzbot
syzbotForwarded: Re: [PATCH RFC] drm/lease: Fix warning on large user-controlled allocations
In reply to syzbotFor archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: Re: [PATCH RFC] drm/lease: Fix warning on large user-controlled allocations
Author: [email protected]
... and after some more fixes
#syz upstream
Quoted 86 lines · syzbot' via syzkaller-upstream-moderation
In
drm_mode_create_lease_ioctl(), a user-providedobject_countis used to allocate memory forobject_idsand objects. When a user requests a massive number of objects, the allocation size can exceed the maximum contiguous physical memory limit (MAX_PAGE_ORDER). Sincekzalloc_objs()defaults toGFP_KERNELwithout__GFP_NOWARN, this triggers aWARN_ON_ONCE_GFPin the page allocator.To fix this, replace
kzalloc_objs()withkvzalloc_objs()infill_object_idr()andmemdup_array_user()withvmemdup_array_user()indrm_mode_create_lease_ioctl(). This allows the allocations to gracefully fall back to virtually contiguous memory (vmalloc) if the requested size is too large or physical memory is fragmented, preventing the warning and allowing large lease requests to succeed or fail gracefully with-ENOMEM. Update the correspondingkfree()calls tokvfree()accordingly.Fixes 62884cd386b876638720ef88374b31a84ca7ee5f ("drm: Add four ioctls for managing drm mode object leases [v7]")Assisted-by Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-previewReported-by [email protected]To: <[email protected]>
To: <[email protected]>
To: <[email protected]>
To: <[email protected]>
To: <[email protected]>
To: <[email protected]>
Cc: <[email protected]>---
drivers/gpu/drm/drm_lease.c +5
-5@@ -386,7 +386,7 @@ static int fill_object_idr(struct drm_device *dev,int ret;bool universal_planes =READ_ONCE (lessor_priv->universal_planes); - objects = kzalloc_objs(struct drm_mode_object *, object_count); + objects = kvzalloc_objs(struct drm_mode_object *, object_count);if (!objects)return -ENOMEM ;@@ -462,7 +462,7 @@ static int fill_object_idr(struct drm_device *dev,if (objects[o])drm_mode_object_put (objects[o]); } -kfree (objects); +kvfree (objects);return ret; }@@ -509,8 +509,8 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,/* Handle leased objects, if any */ idr_init (&leases);if (object_count !=0 ) { - object_ids =memdup_array_user (u64_to_user_ptr (cl->object_ids), - object_count,sizeof (__u32)); + object_ids =vmemdup_array_user (u64_to_user_ptr (cl->object_ids), + object_count,sizeof (__u32));if (IS_ERR (object_ids)) { ret =PTR_ERR (object_ids);idr_destroy (&leases);@@ -520,7 +520,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,/* fill and validate the object idr */ ret =fill_object_idr (dev, lessor_priv, &leases, object_count, object_ids); -kfree (object_ids); +kvfree (object_ids);if (ret) {drm_dbg_lease (dev,"lease object lookup failed: %i\n" , ret);idr_destroy (&leases);base-commit:
5d6919055dec134de3c40167a490f33c74c12581--
This is an AI-generated patch subject to moderation. Reply with '#syz upstream' to send it to the mailing list. Reply with '#syz reject' to reject it.See for more information.
--
You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/9cbc091e-97f8-41a3-97eb-c1f2137ccc53%40mail.kernel.org.
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/CANp29Y7xJRyazoWXRv%3DZdxFk%3Dgqek2LgN82Kr%3DdtDLdBnjn_Vw%40mail.gmail.com.