Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: corrupted list in insert_work
list_add corruption. prev->next should be next (ffff8881f725c060), but was ffff88811373a870. (prev=ffff88811373a870).
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:28!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 644 Comm: syz-executor.2 Not tainted 5.10.116-syzkaller-986966-g0577ff1c6970 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__list_add_valid+0xc6/0xd0 lib/list_debug.c:26
Code: 48 c7 c7 00 d8 43 85 4c 89 e6 4c 89 f1 31 c0 e8 2d 25 40 02 0f 0b 48 c7 c7 c0 d8 43 85 4c 89 f6 4c 89 e1 31 c0 e8 17 25 40 02 <0f> 0b 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 41 54 53 49
RSP: 0018:ffffc90000007a00 EFLAGS: 00010046
RAX: 0000000000000075 RBX: ffff8881f725c068 RCX: 7da71253f0399400
RDX: 0000000000000102 RSI: 0000000000000102 RDI: 0000000000000000
RBP: ffffc90000007a28 R08: ffffffff8153a998 R09: ffffed103ee4a5d8
R10: ffffed103ee4a5d8 R11: 1ffff1103ee4a5d7 R12: ffff88811373a870
R13: dffffc0000000000 R14: ffff8881f725c060 R15: ffff88811373a870
FS: 00007fa388d49700(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f222c584ff8 CR3: 0000000113d68000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
__list_add include/linux/list.h:67 [inline]
list_add_tail include/linux/list.h:100 [inline]
insert_work+0x107/0x330 kernel/workqueue.c:1352
__queue_work+0x971/0xd30 kernel/workqueue.c:1514
queue_work_on+0xf2/0x150 kernel/workqueue.c:1541
queue_work include/linux/workqueue.h:513 [inline]
css_release+0xae/0xc0 kernel/cgroup/cgroup.c:5161
percpu_ref_put_many include/linux/percpu-refcount.h:322 [inline]
percpu_ref_put include/linux/percpu-refcount.h:338 [inline]
percpu_ref_call_confirm_rcu lib/percpu-refcount.c:162 [inline]
percpu_ref_switch_to_atomic_rcu+0x5a2/0x5b0 lib/percpu-refcount.c:199
rcu_do_batch+0x59e/0xc40 kernel/rcu/tree.c:2485
rcu_core+0x59b/0xe30 kernel/rcu/tree.c:2726
rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2739
__do_softirq+0x27e/0x596 kernel/softirq.c:305
asm_call_irq_on_stack+0xf/0x20
</IRQ>
__run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
do_softirq_own_stack+0x60/0x80 arch/x86/kernel/irq_64.c:77
invoke_softirq kernel/softirq.c:402 [inline]
__irq_exit_rcu+0x128/0x150 kernel/softirq.c:432
irq_exit_rcu+0x9/0x10 kernel/softirq.c:444
sysvec_apic_timer_interrupt+0xbf/0xe0 arch/x86/kernel/apic/apic.c:1095
asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635
RIP: 0010:native_restore_fl arch/x86/include/asm/irqflags.h:41 [inline]
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/irqflags.h:84 [inline]
RIP: 0010:console_unlock+0xb5c/0xf20 kernel/printk/printk.c:2555
Code: 85 db 4c 8d b4 24 60 01 00 00 0f 85 82 03 00 00 e8 49 6e 00 00 48 8b 44 24 30 48 89 84 24 90 00 00 00 ff b4 24 90 00 00 00 9d <48> 8b 44 24 38 42 80 3c 38 00 74 08 4c 89 f7 e8 f0 e0 52 00 48 c7
RSP: 0018:ffffc900018f7180 EFLAGS: 00000246
RAX: 0000000000000246 RBX: 0000000000000000 RCX: ffff88811481bb40
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffffc900018f7410 R08: ffffffff8153a4db R09: 0000000000000003
R10: fffff5200031ee21 R11: 1ffff9200031ee20 R12: ffffc900018f7380
R13: 1ffffffff0c3ad81 R14: ffffc900018f72e0 R15: dffffc0000000000
vprintk_emit+0x44b/0x640 kernel/printk/printk.c:2063
vprintk_default+0x26/0x30 kernel/printk/printk.c:2080
vprintk_func+0x19d/0x1e0 kernel/printk/printk_safe.c:401
printk+0xcf/0x10f kernel/printk/printk.c:2111
fail_dump lib/fault-inject.c:45 [inline]
should_fail+0x398/0x510 lib/fault-inject.c:146
__should_failslab+0x9f/0xe0 mm/failslab.c:33
should_failslab+0x9/0x20 mm/slab_common.c:1229
slab_pre_alloc_hook mm/slab.h:558 [inline]
slab_alloc_node mm/slub.c:2877 [inline]
slab_alloc mm/slub.c:2964 [inline]
kmem_cache_alloc_trace+0x3a/0x330 mm/slub.c:2981
kmalloc include/linux/slab.h:552 [inline]
kzalloc include/linux/slab.h:664 [inline]
percpu_ref_init+0xd0/0x330 lib/percpu-refcount.c:75
css_create kernel/cgroup/cgroup.c:5259 [inline]
cgroup_apply_control_enable+0x3a2/0x12f0 kernel/cgroup/cgroup.c:3110
cgroup_apply_control+0x93/0x710 kernel/cgroup/cgroup.c:3192
cgroup_subtree_control_write+0xd19/0x1310 kernel/cgroup/cgroup.c:3350
cgroup_file_write+0x28e/0x590 kernel/cgroup/cgroup.c:3793
kernfs_fop_write_iter+0x2d0/0x410 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:1947 [inline]
new_sync_write fs/read_write.c:518 [inline]
vfs_write+0xc1c/0xf40 fs/read_write.c:605
ksys_write+0x198/0x2c0 fs/read_write.c:658
__do_sys_write fs/read_write.c:670 [inline]
__se_sys_write fs/read_write.c:667 [inline]
__x64_sys_write+0x7b/0x90 fs/read_write.c:667
do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fa388df4049
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa388d49168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fa388f07030 RCX: 00007fa388df4049
RDX: 0000000000000006 RSI: 0000000020000140 RDI: 0000000000000004
RBP: 00007fa388d491d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffc6b6af9af R14: 00007fa388d49300 R15: 0000000000022000
Modules linked in:
---[ end trace 00d6773322cde607 ]---
RIP: 0010:__list_add_valid+0xc6/0xd0 lib/list_debug.c:26
Code: 48 c7 c7 00 d8 43 85 4c 89 e6 4c 89 f1 31 c0 e8 2d 25 40 02 0f 0b 48 c7 c7 c0 d8 43 85 4c 89 f6 4c 89 e1 31 c0 e8 17 25 40 02 <0f> 0b 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 41 54 53 49
RSP: 0018:ffffc90000007a00 EFLAGS: 00010046
RAX: 0000000000000075 RBX: ffff8881f725c068 RCX: 7da71253f0399400
RDX: 0000000000000102 RSI: 0000000000000102 RDI: 0000000000000000
RBP: ffffc90000007a28 R08: ffffffff8153a998 R09: ffffed103ee4a5d8
R10: ffffed103ee4a5d8 R11: 1ffff1103ee4a5d7 R12: ffff88811373a870
R13: dffffc0000000000 R14: ffff8881f725c060 R15: ffff88811373a870
FS: 00007fa388d49700(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f222c584ff8 CR3: 0000000113d68000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 85 db test %ebx,%ebx
2: 4c 8d b4 24 60 01 00 lea 0x160(%rsp),%r14
9: 00
a: 0f 85 82 03 00 00 jne 0x392
10: e8 49 6e 00 00 callq 0x6e5e
15: 48 8b 44 24 30 mov 0x30(%rsp),%rax
1a: 48 89 84 24 90 00 00 mov %rax,0x90(%rsp)
21: 00
22: ff b4 24 90 00 00 00 pushq 0x90(%rsp)
29: 9d popfq
* 2a: 48 8b 44 24 38 mov 0x38(%rsp),%rax <-- trapping instruction
2f: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1)
34: 74 08 je 0x3e
36: 4c 89 f7 mov %r14,%rdi
39: e8 f0 e0 52 00 callq 0x52e12e
3e: 48 rex.W
3f: c7 .byte 0xc7
Tested on:
commit: 0577ff1c Merge 5.10.116 into android12-5.10-lts
git tree: android12-5.10-lts
console output:
https://syzkaller.appspot.com/x/log.txt?x=102643bef00000
kernel config:
https://syzkaller.appspot.com/x/.config?x=d069c16600471585