syzbot


KASAN: null-ptr-deref Read in percpu_ref_exit

Status: upstream: reported C repro on 2020/09/04 05:48
Reported-by: syzbot+4264ecfcf0f27a5e4180@syzkaller.appspotmail.com
First crash: 664d, last: 659d

Cause bisection: introduced by (bisect log) :
commit d0c567d60f3730b97050347ea806e1ee06445c78
Author: Ming Lei <ming.lei@redhat.com>
Date: Wed Sep 2 12:26:42 2020 +0000

  percpu_ref: reduce memory footprint of percpu_ref in fast path

Crash: BUG: unable to handle kernel NULL pointer dereference in percpu_ref_exit (log)
Repro: C syz .config
Patch testing requests:
Created Duration User Patch Repo Result
2021/03/15 04:45 17m ducheng2@gmail.com linux-next OK

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: null-ptr-deref in atomic64_read include/asm-generic/atomic-instrumented.h:837 [inline]
BUG: KASAN: null-ptr-deref in atomic_long_read include/asm-generic/atomic-long.h:29 [inline]
BUG: KASAN: null-ptr-deref in percpu_ref_exit+0x102/0x1f0 lib/percpu-refcount.c:136
Read of size 8 at addr 0000000000000000 by task syz-executor932/7175

CPU: 0 PID: 7175 Comm: syz-executor932 Not tainted 5.9.0-rc3-next-20200903-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x198/0x1fd lib/dump_stack.c:118
 __kasan_report mm/kasan/report.c:517 [inline]
 kasan_report.cold+0x5/0x37 mm/kasan/report.c:530
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 instrument_atomic_read include/linux/instrumented.h:71 [inline]
 atomic64_read include/asm-generic/atomic-instrumented.h:837 [inline]
 atomic_long_read include/asm-generic/atomic-long.h:29 [inline]
 percpu_ref_exit+0x102/0x1f0 lib/percpu-refcount.c:136
 hd_free_part block/partitions/../blk.h:391 [inline]
 part_release+0x9d/0xc0 block/partitions/core.c:262
 device_release+0x9f/0x240 drivers/base/core.c:1802
 kobject_cleanup lib/kobject.c:708 [inline]
 kobject_release lib/kobject.c:739 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x171/0x270 lib/kobject.c:756
 put_device+0x1b/0x30 drivers/base/core.c:3031
 add_partition+0x648/0xb00 block/partitions/core.c:493
 blk_add_partition block/partitions/core.c:685 [inline]
 blk_add_partitions+0x9db/0xe00 block/partitions/core.c:761
 bdev_disk_changed+0x208/0x390 fs/block_dev.c:1417
 loop_reread_partitions+0x29/0x50 drivers/block/loop.c:658
 loop_set_status+0x6da/0x1010 drivers/block/loop.c:1427
 loop_set_status64 drivers/block/loop.c:1547 [inline]
 lo_ioctl+0x900/0x1690 drivers/block/loop.c:1715
 __blkdev_driver_ioctl block/ioctl.c:224 [inline]
 blkdev_ioctl+0x28c/0x700 block/ioctl.c:620
 block_ioctl+0xf9/0x140 fs/block_dev.c:1870
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl fs/ioctl.c:739 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x446c27
Code: 48 83 c4 08 48 89 d8 5b 5d c3 66 0f 1f 84 00 00 00 00 00 48 89 e8 48 f7 d8 48 39 c3 0f 92 c0 eb 92 66 90 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 6d 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb6aa64db48 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000446c27
RDX: 00007fb6aa64dbe0 RSI: 0000000000004c04 RDI: 0000000000000004
RBP: 00000000200158a8 R08: fe03f80fe03f80ff R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fb6aa64e6d0
R13: 0000000000000003 R14: 0000000000000003 R15: 000a00d800050102
==================================================================

Crashes (11):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-linux-next-kasan-gce-root 2020/09/03 20:14 linux-next 7a6956579ce6 abf9ba4f .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/09/08 12:14 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/08 01:36 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/07 02:43 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/06 23:04 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/06 21:08 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/06 21:00 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/06 20:14 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/06 03:22 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/05 22:29 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/03 20:01 linux-next 7a6956579ce6 abf9ba4f .config log report