syzbot


KASAN: null-ptr-deref Write in kthread_use_mm

Status: fixed on 2020/11/20 14:54
Subsystems: fs io-uring
[Documentation on labels]
Reported-by: syzbot+b57abf7ee60829090495@syzkaller.appspotmail.com
Fix commit: 4b70cf9dea4c io_uring: ensure consistent view of original task ->mm from SQPOLL
First crash: 1496d, last: 1493d
Cause bisection: introduced by (bisect log) :
commit 4d004099a668c41522242aa146a38cc4eb59cb1e
Author: Peter Zijlstra <peterz@infradead.org>
Date: Fri Oct 2 09:04:21 2020 +0000

  lockdep: Fix lockdep recursion

Crash: BUG: using __this_cpu_read() in preemptible code in trace_hardirqs_on (log)
Repro: C syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH 5.9 000/255] 5.9.9-rc1 review 264 (264) 2020/11/19 12:14
[PATCHSET 0/4] io_uring patches queued up for 5.10 5 (5) 2020/11/03 20:28
KASAN: null-ptr-deref Write in kthread_use_mm 2 (3) 2020/11/02 17:38

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: null-ptr-deref in atomic_inc include/asm-generic/atomic-instrumented.h:240 [inline]
BUG: KASAN: null-ptr-deref in mmgrab include/linux/sched/mm.h:36 [inline]
BUG: KASAN: null-ptr-deref in kthread_use_mm+0x11c/0x2a0 kernel/kthread.c:1257
Write of size 4 at addr 0000000000000060 by task io_uring-sq/9432

CPU: 1 PID: 9432 Comm: io_uring-sq Not tainted 5.10.0-rc1-next-20201030-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+0x107/0x163 lib/dump_stack.c:118
 __kasan_report mm/kasan/report.c:549 [inline]
 kasan_report.cold+0x5/0x37 mm/kasan/report.c:562
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc include/asm-generic/atomic-instrumented.h:240 [inline]
 mmgrab include/linux/sched/mm.h:36 [inline]
 kthread_use_mm+0x11c/0x2a0 kernel/kthread.c:1257
 __io_sq_thread_acquire_mm fs/io_uring.c:1092 [inline]
 __io_sq_thread_acquire_mm+0x1c4/0x220 fs/io_uring.c:1085
 io_sq_thread_acquire_mm_files.isra.0+0x125/0x180 fs/io_uring.c:1104
 io_init_req fs/io_uring.c:6661 [inline]
 io_submit_sqes+0x89d/0x25f0 fs/io_uring.c:6757
 __io_sq_thread fs/io_uring.c:6904 [inline]
 io_sq_thread+0x462/0x1630 fs/io_uring.c:6971
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
==================================================================
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 9432 Comm: io_uring-sq Tainted: G    B             5.10.0-rc1-next-20201030-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+0x107/0x163 lib/dump_stack.c:118
 panic+0x306/0x73d kernel/panic.c:231
 end_report+0x58/0x5e mm/kasan/report.c:106
 __kasan_report mm/kasan/report.c:552 [inline]
 kasan_report.cold+0xd/0x37 mm/kasan/report.c:562
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc include/asm-generic/atomic-instrumented.h:240 [inline]
 mmgrab include/linux/sched/mm.h:36 [inline]
 kthread_use_mm+0x11c/0x2a0 kernel/kthread.c:1257
 __io_sq_thread_acquire_mm fs/io_uring.c:1092 [inline]
 __io_sq_thread_acquire_mm+0x1c4/0x220 fs/io_uring.c:1085
 io_sq_thread_acquire_mm_files.isra.0+0x125/0x180 fs/io_uring.c:1104
 io_init_req fs/io_uring.c:6661 [inline]
 io_submit_sqes+0x89d/0x25f0 fs/io_uring.c:6757
 __io_sq_thread fs/io_uring.c:6904 [inline]
 io_sq_thread+0x462/0x1630 fs/io_uring.c:6971
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/02 05:47 linux-next 4e78c578cb98 8bc4594f .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/10/30 21:47 linux-next 4e78c578cb98 a6e3ac3b .config console log report syz C ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.