Re: WARNING: zero-size vmalloc in sel_write_load

From: Paul Moore
Date: Mon Jul 29 2024 - 22:41:45 EST


On Sun, Jul 28, 2024 at 11:15 PM Ubisectech Sirius
<bugreport@xxxxxxxxxxxxxx> wrote:
>
> Hello.
> We are Ubisectech Sirius Team, the vulnerability lab of China ValiantSec. Recently, our team has discovered a issue in Linux kernel 6.8. Attached to the email were a PoC file of the issue.
>
> Stack dump:
>
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 13730 at mm/vmalloc.c:3247 __vmalloc_node_range+0x10a4/0x1490 mm/vmalloc.c:3247
> Modules linked in:
> CPU: 1 PID: 13730 Comm: syz.2.627 Not tainted 6.8.0 #1
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> RIP: 0010:__vmalloc_node_range+0x10a4/0x1490 mm/vmalloc.c:3247
> Code: 25 28 00 00 00 0f 85 9f 02 00 00 48 81 c4 70 01 00 00 4c 89 e0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc e8 ad e2 b4 ff 90 <0f> 0b 90 45 31 e4 eb 9d e8 9f e2 b4 ff 48 8b 4c 24 40 31 f6 45 31
> RSP: 0018:ffffc90001847978 EFLAGS: 00010212
> RAX: 00000000000018a9 RBX: dffffc0000000000 RCX: ffffc9000bb89000
> RDX: 0000000000040000 RSI: ffffffff81d5ca03 RDI: 0000000000000007
> RBP: 0000000000000000 R08: 0000000000000007 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000001 R12: ffff888000deeb48
> R13: dffffc0000000000 R14: 0000000000000000 R15: 1ffff92000308faf
> FS: 00007f7457ffb640(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000000 CR3: 000000001ef56000 CR4: 0000000000750ef0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> PKRU: 55555554
> Call Trace:
> <TASK>
> __vmalloc_node mm/vmalloc.c:3385 [inline]
> vmalloc+0x6b/0x90 mm/vmalloc.c:3418
> sel_write_load+0x286/0x1b60 security/selinux/selinuxfs.c:592
> vfs_write+0x2b2/0x1090 fs/read_write.c:588
> ksys_write+0x122/0x250 fs/read_write.c:643
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83
> entry_SYSCALL_64_after_hwframe+0x6f/0x77
> RIP: 0033:0x7f74571958cd
> Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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 a8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f7457ffafa8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
> RAX: ffffffffffffffda RBX: 00007f7457333f60 RCX: 00007f74571958cd
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
> RBP: 00007f745721bb06 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> R13: 000000000000000b R14: 00007f7457333f60 R15: 00007f7457fdb000
> </TASK>
>
> Thank you for taking the time to read this email and we look forward to working with you further.

Similar to your other report, this warning/panic appears to be the
result of attempting to load a bogus SELinux policy with panic_on_warn
enabled, and similar to the other report I would expect the system to
gracefully fail to load the bogus/empty policy in those cases where
panic_on_warn is disabled. Have you noticed any unexpected behavior
with panic_on_warn disabled?

--
paul-moore.com