2024-05-13 02:06:47

by Sam Sun

[permalink] [raw]
Subject: [Linux kernel bug] general protection fault in gfs2_unstuffer_folio

Dear developers and maintainers,

We encountered a general protection fault in function
gfs2_unstuffer_folio. It was tested against the latest upstream linux.
C repro and kernel config are attached to this email. Kernel crash log
is listed below.
```
general protection fault, probably for non-canonical address
0x80ff888064f0e190: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 1 PID: 8099 Comm: syz-executor163 Not tainted 6.9.0-rc6 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:memcpy_orig+0x64/0x120 arch/x86/lib/memcpy_64.S:94
Code: 57 10 4c 89 5f 18 48 8d 7f 20 73 d4 83 c2 20 eb 4c 48 01 d6 48
01 d7 48 83 ea 20 66 2e 0f 1f 84 00 00 00 00 00 90 48 83 ea 20 <4c> 8b
46 f8 4c 8b 4e f0 4c 8b 56 e8 4c 8b 5e e0 48 8d 76 e0 4c 89
RSP: 0018:ffffc9000273f5a0 EFLAGS: 00010282
RAX: ffff888064108000 RBX: ffff88807a48eea8 RCX: dffffc0000000000
RDX: 8100000000000070 RSI: 80ff888064f0e198 RDI: 80ff8880641080b0
RBP: ffff888064108000 R08: ffffffff83beadf4 R09: 1ffffd4000320840
R10: dffffc0000000000 R11: fffff94000320841 R12: 1ffffd4000320840
R13: ffffea0001904200 R14: 81000000000000b0 R15: 1ffffd4000320841
FS: 0000000000000000(0000) GS:ffff8880be400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555b742d7000 CR3: 0000000066974000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
gfs2_unstuffer_folio+0x147/0x900 fs/gfs2/bmap.c:63
__gfs2_unstuff_inode fs/gfs2/bmap.c:119 [inline]
gfs2_unstuff_dinode+0x3d4/0xb50 fs/gfs2/bmap.c:166
gfs2_adjust_quota+0x28b/0x8f0 fs/gfs2/quota.c:879
do_sync+0x83c/0xea0 fs/gfs2/quota.c:990
gfs2_quota_sync+0x41e/0x5f0 fs/gfs2/quota.c:1370
gfs2_sync_fs+0x4d/0xb0 fs/gfs2/super.c:669
sync_filesystem+0xed/0x230 fs/sync.c:56
generic_shutdown_super+0x72/0x2d0 fs/super.c:620
kill_block_super+0x44/0x90 fs/super.c:1675
deactivate_locked_super+0xcb/0x120 fs/super.c:472
cleanup_mnt+0x3e5/0x470 fs/namespace.c:1267
task_work_run+0x23b/0x300 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa2e/0x26a0 kernel/exit.c:878
do_group_exit+0x201/0x2b0 kernel/exit.c:1027
__do_sys_exit_group kernel/exit.c:1038 [inline]
__se_sys_exit_group kernel/exit.c:1036 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1036
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xe4/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x67/0x6f
RIP: 0033:0x7f9bf50e33e6
Code: Unable to access opcode bytes at 0x7f9bf50e33bc.
RSP: 002b:00007ffc059a4038 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f9bf5175210 RCX: 00007f9bf50e33e6
RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
RBP: 0000000000000001 R08: 00000000000000e7 R09: ffffffffffffffc0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9bf5175210
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:memcpy_orig+0x64/0x120 arch/x86/lib/memcpy_64.S:94
Code: 57 10 4c 89 5f 18 48 8d 7f 20 73 d4 83 c2 20 eb 4c 48 01 d6 48
01 d7 48 83 ea 20 66 2e 0f 1f 84 00 00 00 00 00 90 48 83 ea 20 <4c> 8b
46 f8 4c 8b 4e f0 4c 8b 56 e8 4c 8b 5e e0 48 8d 76 e0 4c 89
RSP: 0018:ffffc9000273f5a0 EFLAGS: 00010282
RAX: ffff888064108000 RBX: ffff88807a48eea8 RCX: dffffc0000000000
RDX: 8100000000000070 RSI: 80ff888064f0e198 RDI: 80ff8880641080b0
RBP: ffff888064108000 R08: ffffffff83beadf4 R09: 1ffffd4000320840
R10: dffffc0000000000 R11: fffff94000320841 R12: 1ffffd4000320840
R13: ffffea0001904200 R14: 81000000000000b0 R15: 1ffffd4000320841
FS: 0000000000000000(0000) GS:ffff8880be400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4bf9631fe0 CR3: 00000000186b0000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
----------------
Code disassembly (best guess):
0: 57 push %rdi
1: 10 4c 89 5f adc %cl,0x5f(%rcx,%rcx,4)
5: 18 48 8d sbb %cl,-0x73(%rax)
8: 7f 20 jg 0x2a
a: 73 d4 jae 0xffffffe0
c: 83 c2 20 add $0x20,%edx
f: eb 4c jmp 0x5d
11: 48 01 d6 add %rdx,%rsi
14: 48 01 d7 add %rdx,%rdi
17: 48 83 ea 20 sub $0x20,%rdx
1b: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
22: 00 00 00
25: 90 nop
26: 48 83 ea 20 sub $0x20,%rdx
* 2a: 4c 8b 46 f8 mov -0x8(%rsi),%r8 <-- trapping instruction
2e: 4c 8b 4e f0 mov -0x10(%rsi),%r9
32: 4c 8b 56 e8 mov -0x18(%rsi),%r10
36: 4c 8b 5e e0 mov -0x20(%rsi),%r11
3a: 48 8d 76 e0 lea -0x20(%rsi),%rsi
3e: 4c rex.WR
3f: 89 .byte 0x89
```
If you have any questions, please contact us.

Reported by Yue Sun <[email protected]>
Reported by xingwei lee <[email protected]>

Best Regards,
Yue


Attachments:
gfs2_unstuffer_folio.c (364.49 kB)
config (242.11 kB)
Download all attachments