syzbot


KASAN: user-memory-access Write in zram_slot_lock

Status: fixed on 2023/07/01 16:05
Subsystems: block reiserfs
[Documentation on labels]
Reported-by: syzbot+b8d61a58b7c7ebd2c8e0@syzkaller.appspotmail.com
Fix commit: 3eb96946f0be block: make bio_check_eod work for zero sized devices
First crash: 506d, last: 506d
Cause bisection: introduced by (bisect log) :
commit 9fe95babc7420722d39a1ded379027a1e1825d3a
Author: Christoph Hellwig <hch@lst.de>
Date: Tue Apr 11 17:14:44 2023 +0000

  zram: remove valid_io_request

Crash: KASAN: user-memory-access Write in zram_slot_lock (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] block: make bio_check_eod work for zero sized devices 2 (2) 2023/05/24 14:19
[syzbot] [block?] [reiserfs?] KASAN: user-memory-access Write in zram_slot_lock 0 (2) 2023/05/23 09:34

Sample crash report:
loop0: detected capacity change from 0 to 8192
REISERFS warning:  read_super_block: reiserfs filesystem is deprecated and scheduled to be removed from the kernel in 2025
REISERFS (device loop0): found reiserfs format "3.5" with non-standard journal
REISERFS (device loop0): using ordered data mode
reiserfs: using flush barriers
==================================================================
BUG: KASAN: user-memory-access in instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
BUG: KASAN: user-memory-access in test_and_set_bit_lock include/asm-generic/bitops/instrumented-lock.h:57 [inline]
BUG: KASAN: user-memory-access in bit_spin_lock include/linux/bit_spinlock.h:27 [inline]
BUG: KASAN: user-memory-access in zram_slot_lock+0x57/0x150 drivers/block/zram/zram_drv.c:67
Write of size 8 at addr 0000000000004128 by task syz-executor326/4993

CPU: 1 PID: 4993 Comm: syz-executor326 Not tainted 6.4.0-rc3-syzkaller #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+0x1e7/0x2d0 lib/dump_stack.c:106
 print_report+0xe6/0x540 mm/kasan/report.c:465
 kasan_report+0x176/0x1b0 mm/kasan/report.c:572
 kasan_check_range+0x283/0x290 mm/kasan/generic.c:187
 instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
 test_and_set_bit_lock include/asm-generic/bitops/instrumented-lock.h:57 [inline]
 bit_spin_lock include/linux/bit_spinlock.h:27 [inline]
 zram_slot_lock+0x57/0x150 drivers/block/zram/zram_drv.c:67
 zram_read_page drivers/block/zram/zram_drv.c:1362 [inline]
 zram_bvec_read drivers/block/zram/zram_drv.c:1409 [inline]
 zram_bio_read drivers/block/zram/zram_drv.c:1883 [inline]
 zram_submit_bio+0x18bc/0x26d0 drivers/block/zram/zram_drv.c:1933
 __submit_bio+0x205/0x2e0 block/blk-core.c:598
 __submit_bio_noacct block/blk-core.c:641 [inline]
 submit_bio_noacct_nocheck+0x467/0xc60 block/blk-core.c:704
 submit_bh fs/buffer.c:2782 [inline]
 __bread_slow fs/buffer.c:1226 [inline]
 __bread_gfp+0x1ec/0x380 fs/buffer.c:1419
 __bread include/linux/buffer_head.h:471 [inline]
 journal_init+0xf61/0x24b0 fs/reiserfs/journal.c:2788
 reiserfs_fill_super+0x1039/0x2620 fs/reiserfs/super.c:2022
 mount_bdev+0x274/0x3a0 fs/super.c:1380
 legacy_get_tree+0xef/0x190 fs/fs_context.c:610
 vfs_get_tree+0x8c/0x270 fs/super.c:1510
 do_new_mount+0x28f/0xae0 fs/namespace.c:3039
 do_mount fs/namespace.c:3382 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f185eef5b0a
Code: 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe122853a8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f185eef5b0a
RDX: 0000000020000080 RSI: 0000000020000140 RDI: 00007ffe122853b0
RBP: 00007ffe122853b0 R08: 00007ffe122853f0 R09: 0000000000001121
R10: 000000000120c083 R11: 0000000000000286 R12: 0000000000000004
R13: 00005555570882c0 R14: 00007ffe122853f0 R15: 0000000000000000
 </TASK>
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/22 13:34 upstream 44c026a73be8 4bce1a3e .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: user-memory-access Write in zram_slot_lock
2023/05/22 13:43 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci f1fcbaa18b28 4bce1a3e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 KASAN: user-memory-access Write in zram_slot_lock
2023/05/22 13:19 upstream 44c026a73be8 4bce1a3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: user-memory-access Write in zram_slot_lock
* Struck through repros no longer work on HEAD.