Dear developers and maintainers, We encountered a general protection fault while using our modified Syzkaller. It is tested against latest upstream Linux (6.9-rc3). Kernel config and C repro are attached to this email. The Kernel crash log is listed below. ``` Syzkaller hit 'general protection fault in mod_objcg_mlstate' bug. general protection fault, probably for non-canonical address 0xdffffc00400000cb: 0000 [#1] PREEMPT SMP KASAN KASAN: probably user-memory-access in range [0x0000000200000658-0x000000020000065f] CPU: 1 PID: 8107 Comm: syz-executor203 Not tainted 6.7.0-rc7 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:mem_cgroup_lruvec include/linux/memcontrol.h:754 [inline] RIP: 0010:mod_objcg_mlstate+0xef/0x260 mm/memcontrol.c:2955 Code: 80 3c 02 00 0f 85 7f 01 00 00 4a 8b ac f5 40 0c 00 00 48 8d bd 58 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 41 01 00 00 48 3b 9d 58 06 00 00 0f 85 1e 01 00 RSP: 0018:ffffc900001c8ce8 EFLAGS: 00010002 RAX: dffffc0000000000 RBX: ffff88813fff7000 RCX: 1ffff92000039167 RDX: 00000000400000cb RSI: 0000000000000101 RDI: 0000000200000659 RBP: 0000000200000001 R08: 0000000000000000 R09: fffffbfff23e8bd0 R10: ffffffff91f45e87 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000828 R14: 0000000000000001 R15: 0000000000000000 FS: 00005555571dd3c0(0000) GS:ffff888135c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fe24f656790 CR3: 000000001b539000 CR4: 0000000000750ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: drain_obj_stock+0x126/0x390 mm/memcontrol.c:3438 refill_obj_stock+0xea/0x500 mm/memcontrol.c:3487 memcg_slab_free_hook+0x14f/0x2b0 mm/slab.h:572 slab_free mm/slub.c:3804 [inline] __kmem_cache_free+0xa9/0x1a0 mm/slub.c:3822 __d_free_external+0x43/0x60 fs/dcache.c:304 rcu_do_batch kernel/rcu/tree.c:2158 [inline] rcu_core+0x817/0x1670 kernel/rcu/tree.c:2431 __do_softirq+0x1d4/0x85e kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu kernel/softirq.c:632 [inline] irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x99/0xb0 arch/x86/kernel/apic/apic.c:1076 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:memmove+0x28/0x1b0 arch/x86/lib/memmove_64.S:44 Code: c3 90 f3 0f 1e fa 48 89 f8 48 39 fe 7d 0f 49 89 f0 49 01 d0 49 39 f8 0f 8f b5 00 00 00 48 83 fa 20 0f 82 01 01 00 00 48 89 d1 a4 c3 48 81 fa a8 02 00 00 72 05 40 38 fe 74 47 48 83 ea 20 48 RSP: 0018:ffffc90001b9ef40 EFLAGS: 00010286 RAX: ffff8881172d8fb4 RBX: 0000000000000002 RCX: fffffffffbad8f94 RDX: ffffffffffffffe0 RSI: ffff88811b7ffff0 RDI: ffff88811b800000 RBP: 0000000000000010 R08: ffff8881172d8f84 R09: 0000766972705f73 R10: 667265736965722e R11: 0000766972705f73 R12: 0000000000000001 R13: ffff8881172d8f84 R14: ffff8881172d8fa4 R15: 0000000000000010 leaf_paste_entries+0x442/0x910 fs/reiserfs/lbalance.c:1377 balance_leaf_finish_node_paste_dirent fs/reiserfs/do_balan.c:1295 [inline] balance_leaf_finish_node_paste fs/reiserfs/do_balan.c:1321 [inline] balance_leaf_finish_node fs/reiserfs/do_balan.c:1364 [inline] balance_leaf+0x9669/0xd750 fs/reiserfs/do_balan.c:1452 do_balance+0x318/0x810 fs/reiserfs/do_balan.c:1888 reiserfs_paste_into_item+0x637/0x7d0 fs/reiserfs/stree.c:2158 reiserfs_add_entry+0x8ce/0xd10 fs/reiserfs/namei.c:565 reiserfs_mkdir+0x683/0x990 fs/reiserfs/namei.c:860 create_privroot fs/reiserfs/xattr.c:891 [inline] reiserfs_xattr_init+0x4e4/0xaf0 fs/reiserfs/xattr.c:1007 reiserfs_fill_super+0x2140/0x2ea0 fs/reiserfs/super.c:2175 mount_bdev+0x201/0x2f0 fs/super.c:1650 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x91/0x380 fs/super.c:1771 do_new_mount fs/namespace.c:3337 [inline] path_mount+0x675/0x1e40 fs/namespace.c:3664 do_mount fs/namespace.c:3677 [inline] __do_sys_mount fs/namespace.c:3886 [inline] __se_sys_mount fs/namespace.c:3863 [inline] __x64_sys_mount+0x283/0x300 fs/namespace.c:3863 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fe80d8f6c7e Code: 48 c7 c0 ff ff ff ff eb aa e8 0e 08 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 f3 0f 1e fa 49 89 ca b8 a5 00 00 00 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:00007fff1ac97688 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00005555571dd378 RCX: 00007fe80d8f6c7e RDX: 0000000020001100 RSI: 0000000020001140 RDI: 00007fff1ac976a0 RBP: 00007fff1ac976a0 R08: 00007fff1ac976e0 R09: 00000000000010e9 R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000000000 R13: 00007fff1ac976e0 R14: 0000000000000003 R15: 0000000000000000 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:mem_cgroup_lruvec include/linux/memcontrol.h:754 [inline] RIP: 0010:mod_objcg_mlstate+0xef/0x260 mm/memcontrol.c:2955 Code: 80 3c 02 00 0f 85 7f 01 00 00 4a 8b ac f5 40 0c 00 00 48 8d bd 58 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 41 01 00 00 48 3b 9d 58 06 00 00 0f 85 1e 01 00 RSP: 0018:ffffc900001c8ce8 EFLAGS: 00010002 RAX: dffffc0000000000 RBX: ffff88813fff7000 RCX: 1ffff92000039167 RDX: 00000000400000cb RSI: 0000000000000101 RDI: 0000000200000659 RBP: 0000000200000001 R08: 0000000000000000 R09: fffffbfff23e8bd0 R10: ffffffff91f45e87 R11: 0000000000000000 R12: 0000000000000005 R13: 0000000000000828 R14: 0000000000000001 R15: 0000000000000000 FS: 00005555571dd3c0(0000) GS:ffff888135c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fe24f656790 CR3: 000000001b539000 CR4: 0000000000750ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 ---------------- Code disassembly (best guess): 0: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 4: 0f 85 7f 01 00 00 jne 0x189 a: 4a 8b ac f5 40 0c 00 mov 0xc40(%rbp,%r14,8),%rbp 11: 00 12: 48 8d bd 58 06 00 00 lea 0x658(%rbp),%rdi 19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 20: fc ff df 23: 48 89 fa mov %rdi,%rdx 26: 48 c1 ea 03 shr $0x3,%rdx * 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction 2e: 0f 85 41 01 00 00 jne 0x175 34: 48 3b 9d 58 06 00 00 cmp 0x658(%rbp),%rbx 3b: 0f .byte 0xf 3c: 85 1e test %ebx,(%rsi) 3e: 01 00 add %eax,(%rax) ``` We analyzed the cause of this problem. In function leaf_paste_entries of fs/reiserfs/lbalance.c, in line 1377, while memmove dest to src, the size n is -32, which means insert_point is before deh. insert_point is calculated in line 1349, and deh_location of deh[before - 1] is 0, so that insert_point equals item location. On the other hand, deh move to 32 bytes after, which is of two struct reiserfs_de_head. If you have any question, please contact us. Reported by: Yue Sun Reported by: xingwei lee Best Regards, Yue