[Android 6.1] KASAN: null-ptr-deref Write in __drop_extent_tree

3 views
Skip to first unread message

syzbot

unread,
May 20, 2023, 1:57:58 PM5/20/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cffbdd825e02 ANDROID: ABI: Update oplus symbol list
git tree: android14-6.1
console output: https://syzkaller.appspot.com/x/log.txt?x=1652d92e280000
kernel config: https://syzkaller.appspot.com/x/.config?x=772a621c45fe488b
dashboard link: https://syzkaller.appspot.com/bug?extid=83fc2c742f2ef6bab8ce
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=110e7836280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1725312e280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ed6179c04124/disk-cffbdd82.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ba554ef0cb8d/vmlinux-cffbdd82.xz
kernel image: https://storage.googleapis.com/syzbot-assets/514dd1219229/bzImage-cffbdd82.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/4053ea982e2d/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+83fc2c...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: null-ptr-deref in atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:541 [inline]
BUG: KASAN: null-ptr-deref in queued_write_lock include/asm-generic/qrwlock.h:98 [inline]
BUG: KASAN: null-ptr-deref in __raw_write_lock include/linux/rwlock_api_smp.h:210 [inline]
BUG: KASAN: null-ptr-deref in _raw_write_lock+0x97/0x170 kernel/locking/spinlock.c:300
Write of size 4 at addr 0000000000000030 by task syz-executor997/1845

CPU: 1 PID: 1845 Comm: syz-executor997 Not tainted 6.1.25-syzkaller-00258-gcffbdd825e02 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
print_report+0xe1/0x4e0 mm/kasan/report.c:398
kasan_report+0x13c/0x170 mm/kasan/report.c:495
kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
__kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:541 [inline]
queued_write_lock include/asm-generic/qrwlock.h:98 [inline]
__raw_write_lock include/linux/rwlock_api_smp.h:210 [inline]
_raw_write_lock+0x97/0x170 kernel/locking/spinlock.c:300
__drop_extent_tree+0x3db/0x680 fs/f2fs/extent_cache.c:1100
f2fs_drop_extent_tree+0x17/0x30 fs/f2fs/extent_cache.c:1116
f2fs_insert_range+0x455/0x560 fs/f2fs/file.c:1664
f2fs_fallocate+0x502/0x770 fs/f2fs/file.c:1838
vfs_fallocate+0x492/0x570 fs/open.c:324
ksys_fallocate fs/open.c:347 [inline]
__do_sys_fallocate fs/open.c:355 [inline]
__se_sys_fallocate fs/open.c:353 [inline]
__x64_sys_fallocate+0xc0/0x110 fs/open.c:353
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7faf27fddbb9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 18 00 00 90 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:00007faf27f81208 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007faf28060788 RCX: 00007faf27fddbb9
RDX: 0000000000000000 RSI: 0000000000000020 RDI: 0000000000000005
RBP: 00007faf28060780 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000010000 R11: 0000000000000246 R12: 00007faf2806078c
R13: 00007ffd07795a3f R14: 00007faf27f81300 R15: 0000000000022000
</TASK>
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000030
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 109bf9067 P4D 109bf9067 PUD 122011067 PMD 0
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 1845 Comm: syz-executor997 Tainted: G B 6.1.25-syzkaller-00258-gcffbdd825e02 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:543 [inline]
RIP: 0010:queued_write_lock include/asm-generic/qrwlock.h:98 [inline]
RIP: 0010:__raw_write_lock include/linux/rwlock_api_smp.h:210 [inline]
RIP: 0010:_raw_write_lock+0xb6/0x170 kernel/locking/spinlock.c:300
Code: ef be 04 00 00 00 e8 79 b9 ae fc 4c 89 ff be 04 00 00 00 e8 6c b9 ae fc 43 0f b6 04 26 84 c0 75 7d 8b 44 24 20 b9 ff 00 00 00 <f0> 41 0f b1 4d 00 75 33 48 c7 04 24 0e 36 e0 45 49 c7 04 1c 00 00
RSP: 0018:ffffc90004307be0 EFLAGS: 00010297
RAX: 0000000000000000 RBX: 1ffff92000860f7c RCX: 00000000000000ff
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc90004307c00
RBP: ffffc90004307c78 R08: dffffc0000000000 R09: 0000000000000003
R10: ffffffffffffffff R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000000000030 R14: 1ffff92000860f80 R15: ffffc90004307c00
FS: 00007faf27f81700(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000030 CR3: 000000011aa03000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__drop_extent_tree+0x3db/0x680 fs/f2fs/extent_cache.c:1100
f2fs_drop_extent_tree+0x17/0x30 fs/f2fs/extent_cache.c:1116
f2fs_insert_range+0x455/0x560 fs/f2fs/file.c:1664
f2fs_fallocate+0x502/0x770 fs/f2fs/file.c:1838
vfs_fallocate+0x492/0x570 fs/open.c:324
ksys_fallocate fs/open.c:347 [inline]
__do_sys_fallocate fs/open.c:355 [inline]
__se_sys_fallocate fs/open.c:353 [inline]
__x64_sys_fallocate+0xc0/0x110 fs/open.c:353
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7faf27fddbb9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 18 00 00 90 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:00007faf27f81208 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007faf28060788 RCX: 00007faf27fddbb9
RDX: 0000000000000000 RSI: 0000000000000020 RDI: 0000000000000005
RBP: 00007faf28060780 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000010000 R11: 0000000000000246 R12: 00007faf2806078c
R13: 00007ffd07795a3f R14: 00007faf27f81300 R15: 0000000000022000
</TASK>
Modules linked in:
CR2: 0000000000000030
---[ end trace 0000000000000000 ]---
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:543 [inline]
RIP: 0010:queued_write_lock include/asm-generic/qrwlock.h:98 [inline]
RIP: 0010:__raw_write_lock include/linux/rwlock_api_smp.h:210 [inline]
RIP: 0010:_raw_write_lock+0xb6/0x170 kernel/locking/spinlock.c:300
Code: ef be 04 00 00 00 e8 79 b9 ae fc 4c 89 ff be 04 00 00 00 e8 6c b9 ae fc 43 0f b6 04 26 84 c0 75 7d 8b 44 24 20 b9 ff 00 00 00 <f0> 41 0f b1 4d 00 75 33 48 c7 04 24 0e 36 e0 45 49 c7 04 1c 00 00
RSP: 0018:ffffc90004307be0 EFLAGS: 00010297
RAX: 0000000000000000 RBX: 1ffff92000860f7c RCX: 00000000000000ff
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc90004307c00
RBP: ffffc90004307c78 R08: dffffc0000000000 R09: 0000000000000003
R10: ffffffffffffffff R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000000000030 R14: 1ffff92000860f80 R15: ffffc90004307c00
FS: 00007faf27f81700(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000030 CR3: 000000011aa03000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: ef out %eax,(%dx)
1: be 04 00 00 00 mov $0x4,%esi
6: e8 79 b9 ae fc callq 0xfcaeb984
b: 4c 89 ff mov %r15,%rdi
e: be 04 00 00 00 mov $0x4,%esi
13: e8 6c b9 ae fc callq 0xfcaeb984
18: 43 0f b6 04 26 movzbl (%r14,%r12,1),%eax
1d: 84 c0 test %al,%al
1f: 75 7d jne 0x9e
21: 8b 44 24 20 mov 0x20(%rsp),%eax
25: b9 ff 00 00 00 mov $0xff,%ecx
* 2a: f0 41 0f b1 4d 00 lock cmpxchg %ecx,0x0(%r13) <-- trapping instruction
30: 75 33 jne 0x65
32: 48 c7 04 24 0e 36 e0 movq $0x45e0360e,(%rsp)
39: 45
3a: 49 rex.WB
3b: c7 .byte 0xc7
3c: 04 1c add $0x1c,%al


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
May 21, 2023, 3:52:29 AM5/21/23
to syzkaller-a...@googlegroups.com
syzbot has bisected this issue to:

commit 5ce7de6415c02b5d02731c7b2f27ba10ad566c1a
Author: Jaegeuk Kim <jae...@kernel.org>
Date: Fri Dec 2 21:51:09 2022 +0000

f2fs: allocate the extent_cache by default

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11d81039280000
start commit: cffbdd825e02 ANDROID: ABI: Update oplus symbol list
git tree: android14-6.1
final oops: https://syzkaller.appspot.com/x/report.txt?x=13d81039280000
console output: https://syzkaller.appspot.com/x/log.txt?x=15d81039280000
Reported-by: syzbot+83fc2c...@syzkaller.appspotmail.com
Fixes: 5ce7de6415c0 ("f2fs: allocate the extent_cache by default")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages