syzbot


general protection fault in percpu_ref_put
Status: fixed on 2022/03/08 16:11
Reported-by: syzbot+533f389d4026d86a2a95@syzkaller.appspotmail.com
Fix commit: 78cc316e9583 bpf, cgroup: Assign cgroup in cgroup_sk_alloc when called from interrupt
First crash: 252d, last: 238d

Cause bisection: introduced by (bisect log) :
commit 020250f31c4c75ac7687a673e29c00786582a5f4
Author: Dmitry Kadashev <dkadashev@gmail.com>
Date: Thu Jul 8 06:34:43 2021 +0000

  namei: make do_linkat() take struct filename

Crash: KASAN: use-after-free Read in __d_alloc (log)
Repro: syz .config

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000182: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000c10-0x0000000000000c17]
CPU: 1 PID: 148 Comm: kworker/u4:2 Not tainted 5.15.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
RIP: 0010:__ref_is_percpu include/linux/percpu-refcount.h:174 [inline]
RIP: 0010:percpu_ref_put_many include/linux/percpu-refcount.h:319 [inline]
RIP: 0010:percpu_ref_put+0x93/0x1d0 include/linux/percpu-refcount.h:338
Code: 01 48 c7 c7 40 58 52 8a be b1 02 00 00 48 c7 c2 80 58 52 8a e8 fe 18 e9 ff 49 bd 00 00 00 00 00 fc ff df 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 9e 73 52 00 48 8b 2b 48 89 ee 48
RSP: 0018:ffffc90000dc0b30 EFLAGS: 00010206
RAX: 0000000000000182 RBX: 0000000000000c10 RCX: ffff888016781c80
RDX: 0000000080000100 RSI: 0000000000000004 RDI: ffff8880b9d32508
RBP: 000000000000003f R08: dffffc0000000000 R09: ffffed10173a64a2
R10: ffffed10173a64a2 R11: 0000000000000000 R12: ffff88806df0a000
R13: dffffc0000000000 R14: 0000000000000000 R15: dffffc0000000000
FS:  0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f853d75b740 CR3: 00000000702e7000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 cgroup_bpf_put include/linux/cgroup.h:926 [inline]
 cgroup_sk_free+0x3c/0xa0 kernel/cgroup/cgroup.c:6613
 sk_prot_free net/core/sock.c:1852 [inline]
 __sk_destruct+0x541/0x820 net/core/sock.c:1943
 call_timer_fn+0xf6/0x210 kernel/time/timer.c:1421
 expire_timers kernel/time/timer.c:1466 [inline]
 __run_timers+0x71a/0x910 kernel/time/timer.c:1734
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1747
 __do_softirq+0x392/0x7a3 kernel/softirq.c:558
 __irq_exit_rcu+0xec/0x170 kernel/softirq.c:636
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648
 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1097
 </IRQ>
 asm_sysvec_apic_timer_interrupt+0x12/0x20
RIP: 0010:lock_acquire+0x21f/0x4d0 kernel/locking/lockdep.c:5629
Code: 08 4c 89 f7 e8 c2 d1 69 00 f6 84 24 81 00 00 00 02 0f 85 13 02 00 00 41 f7 c4 00 02 00 00 74 01 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 04 2f 00 00 00 00 43 c7 44 2f 09 00 00 00 00 43 c7 44 2f 11
RSP: 0018:ffffc9000170f8e0 EFLAGS: 00000206
RAX: 0000000000000001 RBX: 1ffff920002e1f2c RCX: ffff888016782670
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc9000170fa40 R08: dffffc0000000000 R09: fffffbfff1fa2fc1
R10: fffffbfff1fa2fc1 R11: 0000000000000000 R12: 0000000000000246
R13: 1ffff920002e1f24 R14: ffffc9000170f960 R15: dffffc0000000000
 rcu_lock_acquire+0x2a/0x30 include/linux/rcupdate.h:267
 rcu_read_lock include/linux/rcupdate.h:687 [inline]
 inet_twsk_purge+0x11b/0x890 net/ipv4/inet_timewait_sock.c:268
 ops_exit_list net/core/net_namespace.c:171 [inline]
 cleanup_net+0x7ec/0xc50 net/core/net_namespace.c:591
 process_one_work+0x853/0x1140 kernel/workqueue.c:2297
 worker_thread+0xac1/0x1320 kernel/workqueue.c:2444
 kthread+0x453/0x480 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30
Modules linked in:
---[ end trace 6ae4e3b5aac552a5 ]---
RIP: 0010:__ref_is_percpu include/linux/percpu-refcount.h:174 [inline]
RIP: 0010:percpu_ref_put_many include/linux/percpu-refcount.h:319 [inline]
RIP: 0010:percpu_ref_put+0x93/0x1d0 include/linux/percpu-refcount.h:338
Code: 01 48 c7 c7 40 58 52 8a be b1 02 00 00 48 c7 c2 80 58 52 8a e8 fe 18 e9 ff 49 bd 00 00 00 00 00 fc ff df 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 9e 73 52 00 48 8b 2b 48 89 ee 48
RSP: 0018:ffffc90000dc0b30 EFLAGS: 00010206
RAX: 0000000000000182 RBX: 0000000000000c10 RCX: ffff888016781c80
RDX: 0000000080000100 RSI: 0000000000000004 RDI: ffff8880b9d32508
RBP: 000000000000003f R08: dffffc0000000000 R09: ffffed10173a64a2
R10: ffffed10173a64a2 R11: 0000000000000000 R12: ffff88806df0a000
R13: dffffc0000000000 R14: 0000000000000000 R15: dffffc0000000000
FS:  0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f853d75b740 CR3: 000000000c68e000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	48 c7 c7 40 58 52 8a 	mov    $0xffffffff8a525840,%rdi
   7:	be b1 02 00 00       	mov    $0x2b1,%esi
   c:	48 c7 c2 80 58 52 8a 	mov    $0xffffffff8a525880,%rdx
  13:	e8 fe 18 e9 ff       	callq  0xffe91916
  18:	49 bd 00 00 00 00 00 	movabs $0xdffffc0000000000,%r13
  1f:	fc ff df
  22:	48 89 d8             	mov    %rbx,%rax
  25:	48 c1 e8 03          	shr    $0x3,%rax
* 29:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1) <-- trapping instruction
  2e:	74 08                	je     0x38
  30:	48 89 df             	mov    %rbx,%rdi
  33:	e8 9e 73 52 00       	callq  0x5273d6
  38:	48 8b 2b             	mov    (%rbx),%rbp
  3b:	48 89 ee             	mov    %rbp,%rsi
  3e:	48                   	rex.W

Crashes (412):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2021/09/18 18:06 upstream 4357f03d6611 70b76c1d .config log report syz C general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/18 05:36 upstream ddf21bd8ab98 70b76c1d .config log report syz general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/18 03:08 upstream ddf21bd8ab98 70b76c1d .config log report syz general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/10/01 02:03 upstream 02d5e016800d 1d849ab4 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/10/01 00:16 upstream 02d5e016800d 1d849ab4 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/30 23:05 upstream 02d5e016800d 1d849ab4 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/30 21:44 upstream 02d5e016800d 1d849ab4 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/30 20:17 upstream 02d5e016800d 1d849ab4 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/30 15:49 upstream 02d5e016800d be530f6c .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 20:10 upstream 02d5e016800d be530f6c .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 18:30 upstream 02d5e016800d be530f6c .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 17:28 upstream 02d5e016800d be530f6c .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 16:21 upstream 02d5e016800d be530f6c .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 15:20 upstream a4e6f95a891a be530f6c .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 08:15 upstream a4e6f95a891a d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 07:25 upstream a4e6f95a891a d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 06:08 upstream a4e6f95a891a d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/29 04:46 upstream a4e6f95a891a d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 21:39 upstream d33bec7b3dfa d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 18:19 upstream d33bec7b3dfa d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 16:59 upstream d33bec7b3dfa d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 15:45 upstream d33bec7b3dfa d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 14:37 upstream 0513e464f900 d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 13:21 upstream 0513e464f900 d82cb927 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 07:15 upstream 0513e464f900 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 06:00 upstream 0513e464f900 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 02:11 upstream 0513e464f900 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/28 00:56 upstream 0513e464f900 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 23:26 upstream 0513e464f900 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 19:31 upstream 5816b3e6577e 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 18:03 upstream 5816b3e6577e 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 12:32 upstream 5816b3e6577e 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 12:29 upstream 5816b3e6577e 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 11:22 upstream 5816b3e6577e 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 10:13 upstream 5816b3e6577e 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 07:37 upstream 996148ee05d0 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/27 06:24 upstream 996148ee05d0 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 23:59 upstream 996148ee05d0 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 22:52 upstream 996148ee05d0 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 21:50 upstream 996148ee05d0 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 20:44 upstream 996148ee05d0 78494d16 .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 15:25 upstream a3b397b4fffb 8cac236e .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 14:18 upstream a3b397b4fffb 8cac236e .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 13:02 upstream a3b397b4fffb 8cac236e .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 05:15 upstream a5e0aceabef6 8cac236e .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/26 03:19 upstream a5e0aceabef6 8cac236e .config log report info general protection fault in percpu_ref_put
ci-upstream-kasan-gce-smack-root 2021/09/17 02:51 upstream bdb575f87217 5b989942 .config log report info general protection fault in percpu_ref_put