2023-02-16 21:44:46

by Sanan Hasanov

[permalink] [raw]
Subject: general protection fault in blkg_destroy_all

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-rc7-next-20230213
Kernel config:?https://drive.google.com/file/d/1yVvlPL4-MMdjARqrwJ0QoKuPv_3lFQIR/view?usp=share_link
Unfortunately, we do not have a reproducer yet.

Thank you!

Best regards,
Sanan Hasanov

general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 10907 Comm: syz-executor.3 Not tainted 6.2.0-rc7-next-20230213+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:blkg_destroy_all+0xa5/0x260
Code: 7d c0 e8 7e 65 27 06 48 8b 45 b8 80 38 00 0f 85 a8 01 00 00 48 8b 45 c8 48 8b 98 80 05 00 00 4c 8d 63 f8 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 0f 85 7a 01 00 00 48 8b 03 48 39 5d d0 4c 8d 78 f8
RSP: 0018:ffffc9001ca5fcb8 EFLAGS: 00010056

RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff8168f15d
RDX: 1ffff11021b6cc29 RSI: 0000000000000004 RDI: ffffc9001ca5fc18
RBP: ffffc9001ca5fd08 R08: 0000000000000001 R09: 0000000000000003
R10: fffff5200394bf83 R11: 0000000000000001 R12: fffffffffffffff8
R13: dffffc0000000000 R14: ffffffff8ae21700 R15: ffff888080ff1090
FS: 00007f21d3837700(0000) GS:ffff88811a080000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb7b4ffcbd8 CR3: 00000001118c3000 CR4: 0000000000350ee0
Call Trace:
<TASK>
blkcg_exit_disk+0x1a/0x60
disk_release+0xec/0x4a0
device_release+0xae/0x250
kobject_put+0x1d8/0x2c0
put_device+0x24/0x30
put_disk+0x49/0x60
loop_add+0x91f/0xb20
loop_control_ioctl+0x13d/0x690
__x64_sys_ioctl+0x1a9/0x220
do_syscall_64+0x39/0x80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f21d268edcd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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:00007f21d3836bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f21d27bbf80 RCX: 00007f21d268edcd
RDX: 0000000000000000 RSI: 0000000000004c80 RDI: 0000000000000004
RBP: 00007f21d26fc59c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc7837a81f R14: 00007ffc7837a9c0 R15: 00007f21d3836d80
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:blkg_destroy_all+0xa5/0x260
Code: 7d c0 e8 7e 65 27 06 48 8b 45 b8 80 38 00 0f 85 a8 01 00 00 48 8b 45 c8 48 8b 98 80 05 00 00 4c 8d 63 f8 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 0f 85 7a 01 00 00 48 8b 03 48 39 5d d0 4c 8d 78 f8
RSP: 0018:ffffc9001ca5fcb8 EFLAGS: 00010056
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff8168f15d
RDX: 1ffff11021b6cc29 RSI: 0000000000000004 RDI: ffffc9001ca5fc18
RBP: ffffc9001ca5fd08 R08: 0000000000000001 R09: 0000000000000003
R10: fffff5200394bf83 R11: 0000000000000001 R12: fffffffffffffff8
R13: dffffc0000000000 R14: ffffffff8ae21700 R15: ffff888080ff1090
FS: 00007f21d3837700(0000) GS:ffff88811a080000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb7b4ffcbd8 CR3: 00000001118c3000 CR4: 0000000000350ee0
----------------
Code disassembly (best guess):
0: 7d c0 jge 0xffffffc2
2: e8 7e 65 27 06 call 0x6276585
7: 48 8b 45 b8 mov -0x48(%rbp),%rax
b: 80 38 00 cmpb $0x0,(%rax)
e: 0f 85 a8 01 00 00 jne 0x1bc
14: 48 8b 45 c8 mov -0x38(%rbp),%rax
18: 48 8b 98 80 05 00 00 mov 0x580(%rax),%rbx
1f: 4c 8d 63 f8 lea -0x8(%rbx),%r12
23: 48 89 d8 mov %rbx,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction
2f: 0f 85 7a 01 00 00 jne 0x1af
35: 48 8b 03 mov (%rbx),%rax
38: 48 39 5d d0 cmp %rbx,-0x30(%rbp)
3c: 4c 8d 78 f8 lea -0x8(%rax),%r15