Re: kernel BUG in __folio_start_writeback

From: Ryusuke Konishi
Date: Thu Jun 06 2024 - 06:46:02 EST


On Thu, Jun 6, 2024 at 7:01 PM Ubisectech Sirius 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:
> __vm_munmap+0x13d/0x390 mm/mmap.c:2990
> __do_sys_munmap mm/mmap.c:3007 [inline]
> __se_sys_munmap mm/mmap.c:3004 [inline]
> __x64_sys_munmap+0x62/0x90 mm/mmap.c:3004
> 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
> ------------[ cut here ]------------
> kernel BUG at mm/page-writeback.c:2991!
> invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
> CPU: 1 PID: 12198 Comm: segctord Not tainted 6.8.0 #1
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> RIP: 0010:__folio_start_writeback+0x6f3/0xad0 mm/page-writeback.c:2991
> Code: e8 a2 28 ce ff 48 89 ef e8 aa ed 1d 00 49 89 c7 e9 67 fd ff ff e8 8d 28 ce ff 48 c7 c6 e0 91 d7 8a 48 89 ef e8 7e 7c 0d 00 90 <0f> 0b e8 76 28 ce ff e8 c1 eb d9 08 e9 4b fb ff ff e8 67 28 ce ff
> RSP: 0018:ffffc900020ffa00 EFLAGS: 00010293
> RAX: 0000000000000000 RBX: ffff88804246c1f8 RCX: ffffc900020ff860
> RDX: ffff888018964980 RSI: ffffffff81bc8432 RDI: 0000000000000000
> RBP: ffffea00018b57c0 R08: 0000000000000001 R09: fffffbfff1eb0742
> R10: ffffffff8f583a17 R11: 0000000000000001 R12: 1ffff9200041ff45
> R13: 0000000000000000 R14: 0000000000000001 R15: ffffea00018b57c0
> FS: 0000000000000000(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f9cb42f0088 CR3: 00000000454c0000 CR4: 0000000000750ef0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> PKRU: 55555554
> Call Trace:
> <TASK>
> nilfs_segctor_prepare_write fs/nilfs2/segment.c:1697 [inline]
> nilfs_segctor_do_construct+0x1c10/0x78a0 fs/nilfs2/segment.c:2113
> nilfs_segctor_construct+0x8c7/0xb10 fs/nilfs2/segment.c:2418
> nilfs_segctor_thread_construct fs/nilfs2/segment.c:2526 [inline]
> nilfs_segctor_thread+0x3cc/0xf30 fs/nilfs2/segment.c:2610
> kthread+0x2cc/0x3b0 kernel/kthread.c:388
> ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
> ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:243
> </TASK>
...
>
> Thank you for taking the time to read this email and we look forward to working with you further.

I believe this issue will be fixed by the following bug fix, which is
currently in the mm tree and will be merged into the mainline soon:

https://lkml.kernel.org/r/20240530141556.4411-1-konishi.ryusuke@xxxxxxxxx

After the merge, it will also be sent to the stable trees.

Please wait a little while until then.

Thanks,
Ryusuke Konishi