Messages in this thread | | | From | Sanan Hasanov <> | Subject | WARNING: locking bug in pgd_free | Date | Tue, 24 Jan 2023 16:22:34 +0000 |
| |
Good day, dear maintainers,
We found a bug using a modified kernel configuration file used by syzbot.
We enhanced the coverage of the configuration file using our tool, klocalizer.
Kernel Branch: 6.2.0-rc3-next-20230112 Kernel config: https://drive.google.com/file/d/1Zg-NZ5s04wPVdO8cfpvQjatI-0VAVjZV/view?usp=sharing
Unfortunately, we do not have a reproducer yet.
Thank you!
Best regards, Sanan Hasanov
------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(1) WARNING: CPU: 5 PID: 7278 at kernel/locking/lockdep.c:232 hlock_class kernel/locking/lockdep.c:232 [inline] WARNING: CPU: 5 PID: 7278 at kernel/locking/lockdep.c:232 hlock_class kernel/locking/lockdep.c:221 [inline] WARNING: CPU: 5 PID: 7278 at kernel/locking/lockdep.c:232 check_deadlock kernel/locking/lockdep.c:3017 [inline] WARNING: CPU: 5 PID: 7278 at kernel/locking/lockdep.c:232 validate_chain kernel/locking/lockdep.c:3819 [inline] WARNING: CPU: 5 PID: 7278 at kernel/locking/lockdep.c:232 __lock_acquire+0x24b8/0x5170 kernel/locking/lockdep.c:5056 Modules linked in: CPU: 5 PID: 7278 Comm: systemd-udevd Not tainted 6.2.0-rc3-next-20230112 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:hlock_class kernel/locking/lockdep.c:232 [inline] RIP: 0010:hlock_class kernel/locking/lockdep.c:221 [inline] RIP: 0010:check_deadlock kernel/locking/lockdep.c:3017 [inline] RIP: 0010:validate_chain kernel/locking/lockdep.c:3819 [inline] RIP: 0010:__lock_acquire+0x24b8/0x5170 kernel/locking/lockdep.c:5056 Code: c0 03 38 d0 7c 08 84 d2 0f 85 61 20 00 00 83 3d 85 10 86 0a 00 75 ca 48 c7 c6 c0 d8 0c 89 48 c7 c7 20 d2 0c 89 e8 4d cd 39 07 <0f> 0b 31 db e9 e7 fd ff ff e8 fa e4 73 02 89 c3 e8 73 67 ff ff 85 RSP: 0018:ffffc90018207240 EFLAGS: 00010082 RAX: 0000000000000000 RBX: 0000000000000705 RCX: 0000000000000000 RDX: ffff88810c5ec340 RSI: ffffffff81671fdc RDI: fffff52003040e3a RBP: ffff88810c5ec340 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000002 R11: 0000000000000001 R12: ffff88810c5ecce0 R13: ffff88810c5ecd08 R14: ffffffff8bea82e8 R15: 0000000000000000 FS: 00007efddedb98c0(0000) GS:ffff88811a280000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fdb250c0de0 CR3: 0000000110ba2000 CR4: 0000000000350ee0 Call Trace: <TASK> lock_acquire.part.0+0x186/0x440 kernel/locking/lockdep.c:5669 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] pgd_dtor arch/x86/mm/pgtable.c:148 [inline] pgd_free+0x29/0x220 arch/x86/mm/pgtable.c:478 mm_free_pgd kernel/fork.c:737 [inline] __mmdrop+0xd7/0x3b0 kernel/fork.c:795 mmdrop include/linux/sched/mm.h:50 [inline] mmdrop_sched include/linux/sched/mm.h:78 [inline] finish_task_switch.isra.0+0x711/0xa60 kernel/sched/core.c:5205 context_switch kernel/sched/core.c:5304 [inline] __schedule+0x11df/0x2e10 kernel/sched/core.c:6619 schedule+0xe7/0x1c0 kernel/sched/core.c:6695 schedule_preempt_disabled+0x13/0x20 kernel/sched/core.c:6754 __mutex_lock_common kernel/locking/mutex.c:679 [inline] __mutex_lock+0xaca/0x1460 kernel/locking/mutex.c:747 devlink_compat_running_version+0xd5/0x6c0 net/devlink/leftover.c:12234 dev_ethtool+0x597/0x5340 net/ethtool/ioctl.c:3091 dev_ioctl+0x2d0/0x1010 net/core/dev_ioctl.c:524 sock_do_ioctl+0x1c0/0x250 net/socket.c:1183 sock_ioctl+0x211/0x6c0 net/socket.c:1286 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7efddcee1017 Code: 00 00 00 48 8b 05 81 7e 2b 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 51 7e 2b 00 f7 d8 64 89 01 48 RSP: 002b:00007fff73f33b88 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fff73f33bd0 RCX: 00007efddcee1017 RDX: 00007fff73f33ba0 RSI: 0000000000008946 RDI: 0000000000000007 RBP: 00007fff73f33d40 R08: 0000000000000000 R09: 00007efddcf2e160 R10: 0000000000000001 R11: 0000000000000246 R12: 0000557b0816f5b0 R13: 00007fff73f33ba0 R14: 0000000000000001 R15: 0000000000000000 </TASK> irq event stamp: 3491 hardirqs last enabled at (3491): [<ffffffff81592f3b>] raw_spin_rq_unlock_irq kernel/sched/sched.h:1379 [inline] hardirqs last enabled at (3491): [<ffffffff81592f3b>] finish_lock_switch kernel/sched/core.c:5059 [inline] hardirqs last enabled at (3491): [<ffffffff81592f3b>] finish_task_switch.isra.0+0x23b/0xa60 kernel/sched/core.c:5178 hardirqs last disabled at (3490): [<ffffffff88cc9af6>] __schedule+0x1656/0x2e10 kernel/sched/core.c:6518 softirqs last enabled at (2824): [<ffffffff814efe1b>] invoke_softirq kernel/softirq.c:445 [inline] softirqs last enabled at (2824): [<ffffffff814efe1b>] __irq_exit_rcu+0x19b/0x220 kernel/softirq.c:650 softirqs last disabled at (2809): [<ffffffff814efe1b>] invoke_softirq kernel/softirq.c:445 [inline] softirqs last disabled at (2809): [<ffffffff814efe1b>] __irq_exit_rcu+0x19b/0x220 kernel/softirq.c:650 ---[ end trace 0000000000000000 ]--- general protection fault, probably for non-canonical address 0xdffffc0000000008: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000040-0x0000000000000047] CPU: 5 PID: 7278 Comm: systemd-udevd Tainted: G W 6.2.0-rc3-next-20230112 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:check_prev_add kernel/locking/lockdep.c:3070 [inline] RIP: 0010:check_prevs_add kernel/locking/lockdep.c:3217 [inline] RIP: 0010:validate_chain kernel/locking/lockdep.c:3832 [inline] RIP: 0010:__lock_acquire+0x27d9/0x5170 kernel/locking/lockdep.c:5056 Code: 0f 83 06 0f 00 00 4f 8d 3c 7f 49 c1 e7 06 49 81 c7 20 c9 bf 8d 49 8d 7f 40 48 be 00 00 00 00 00 fc ff df 48 89 f8 48 c1 e8 03 <80> 3c 30 00 0f 85 ac 1c 00 00 49 83 7f 40 00 0f 84 af 07 00 00 48 RSP: 0018:ffffc90018207240 EFLAGS: 00010012 RAX: 0000000000000008 RBX: ffff88810c5ecce0 RCX: 0000000000000000 RDX: ffff88810c5ec340 RSI: dffffc0000000000 RDI: 0000000000000040 RBP: ffff88810c5ecd00 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: ffff88810c5ecd08 R14: ffffffff8bea82e8 R15: 0000000000000000 FS: 00007efddedb98c0(0000) GS:ffff88811a280000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fdb250c0de0 CR3: 0000000110ba2000 CR4: 0000000000350ee0 Call Trace: <TASK> lock_acquire.part.0+0x186/0x440 kernel/locking/lockdep.c:5669 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] pgd_dtor arch/x86/mm/pgtable.c:148 [inline] pgd_free+0x29/0x220 arch/x86/mm/pgtable.c:478 mm_free_pgd kernel/fork.c:737 [inline] __mmdrop+0xd7/0x3b0 kernel/fork.c:795 mmdrop include/linux/sched/mm.h:50 [inline] mmdrop_sched include/linux/sched/mm.h:78 [inline] finish_task_switch.isra.0+0x711/0xa60 kernel/sched/core.c:5205 context_switch kernel/sched/core.c:5304 [inline] __schedule+0x11df/0x2e10 kernel/sched/core.c:6619 schedule+0xe7/0x1c0 kernel/sched/core.c:6695 schedule_preempt_disabled+0x13/0x20 kernel/sched/core.c:6754 __mutex_lock_common kernel/locking/mutex.c:679 [inline] __mutex_lock+0xaca/0x1460 kernel/locking/mutex.c:747 devlink_compat_running_version+0xd5/0x6c0 net/devlink/leftover.c:12234 dev_ethtool+0x597/0x5340 net/ethtool/ioctl.c:3091 dev_ioctl+0x2d0/0x1010 net/core/dev_ioctl.c:524 sock_do_ioctl+0x1c0/0x250 net/socket.c:1183 sock_ioctl+0x211/0x6c0 net/socket.c:1286 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7efddcee1017 Code: 00 00 00 48 8b 05 81 7e 2b 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 51 7e 2b 00 f7 d8 64 89 01 48 RSP: 002b:00007fff73f33b88 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fff73f33bd0 RCX: 00007efddcee1017 RDX: 00007fff73f33ba0 RSI: 0000000000008946 RDI: 0000000000000007 RBP: 00007fff73f33d40 R08: 0000000000000000 R09: 00007efddcf2e160 R10: 0000000000000001 R11: 0000000000000246 R12: 0000557b0816f5b0 R13: 00007fff73f33ba0 R14: 0000000000000001 R15: 0000000000000000 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:check_prev_add kernel/locking/lockdep.c:3070 [inline] RIP: 0010:check_prevs_add kernel/locking/lockdep.c:3217 [inline] RIP: 0010:validate_chain kernel/locking/lockdep.c:3832 [inline] RIP: 0010:__lock_acquire+0x27d9/0x5170 kernel/locking/lockdep.c:5056 Code: 0f 83 06 0f 00 00 4f 8d 3c 7f 49 c1 e7 06 49 81 c7 20 c9 bf 8d 49 8d 7f 40 48 be 00 00 00 00 00 fc ff df 48 89 f8 48 c1 e8 03 <80> 3c 30 00 0f 85 ac 1c 00 00 49 83 7f 40 00 0f 84 af 07 00 00 48 RSP: 0018:ffffc90018207240 EFLAGS: 00010012 RAX: 0000000000000008 RBX: ffff88810c5ecce0 RCX: 0000000000000000 RDX: ffff88810c5ec340 RSI: dffffc0000000000 RDI: 0000000000000040 RBP: ffff88810c5ecd00 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: ffff88810c5ecd08 R14: ffffffff8bea82e8 R15: 0000000000000000 FS: 00007efddedb98c0(0000) GS:ffff88811a280000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fdb250c0de0 CR3: 0000000110ba2000 CR4: 0000000000350ee0 ---------------- Code disassembly (best guess): 0: 0f 83 06 0f 00 00 jae 0xf0c 6: 4f 8d 3c 7f lea (%r15,%r15,2),%r15 a: 49 c1 e7 06 shl $0x6,%r15 e: 49 81 c7 20 c9 bf 8d add $0xffffffff8dbfc920,%r15 15: 49 8d 7f 40 lea 0x40(%r15),%rdi 19: 48 be 00 00 00 00 00 movabs $0xdffffc0000000000,%rsi 20: fc ff df 23: 48 89 f8 mov %rdi,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 80 3c 30 00 cmpb $0x0,(%rax,%rsi,1) <-- trapping instruction 2e: 0f 85 ac 1c 00 00 jne 0x1ce0 34: 49 83 7f 40 00 cmpq $0x0,0x40(%r15) 39: 0f 84 af 07 00 00 je 0x7ee 3f: 48 rex.W
| |