syzbot


KASAN: null-ptr-deref Read in filp_close

Status: fixed on 2021/03/10 01:48
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+96cfd2b22b3213646a93@syzkaller.appspotmail.com
Fix commit: fec8a6a69103 close_range: unshare all fds for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC 6abc20f8f879 selftests/core: add regression test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC
First crash: 1396d, last: 1394d
Cause bisection: introduced by (bisect log) :
commit 582f1fb6b721facf04848d2ca57f34468da1813e
Author: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Wed Nov 18 10:47:45 2020 +0000

  fs, close_range: add flag CLOSE_RANGE_CLOEXEC

Crash: BUG: unable to handle kernel NULL pointer dereference in filp_close (log)
Repro: C syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH 4/4] selftests/core: add regression test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC 1 (1) 2020/12/18 14:54
[PATCH] close_range: cap range for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC 1 (1) 2020/12/17 21:33
KASAN: null-ptr-deref Read in filp_close 1 (2) 2020/12/17 16:44
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: null-ptr-deref Read in filp_close (2) fs C 3 1188d 1297d 20/28 fixed on 2021/11/10 13:22
Last patch testing requests (2)
Created Duration User Patch Repo Result
2020/12/19 11:55 17m christian.brauner@ubuntu.com git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git vfs OK
2020/12/17 19:41 18m christian.brauner@ubuntu.com git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git 3274183b76d169a0807413dc325e4e39a670a662 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 filp_close+0x22/0x170 fs/open.c:1274
Read of size 8 at addr 0000000000000077 by task syz-executor511/8522

CPU: 1 PID: 8522 Comm: syz-executor511 Not tainted 5.10.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:120
 __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 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]
 filp_close+0x22/0x170 fs/open.c:1274
 close_files fs/file.c:402 [inline]
 put_files_struct fs/file.c:417 [inline]
 put_files_struct+0x1cc/0x350 fs/file.c:414
 exit_files+0x12a/0x170 fs/file.c:435
 do_exit+0xb4f/0x2a00 kernel/exit.c:818
 do_group_exit+0x125/0x310 kernel/exit.c:920
 get_signal+0x428/0x2100 kernel/signal.c:2792
 arch_do_signal_or_restart+0x2a8/0x1eb0 arch/x86/kernel/signal.c:811
 handle_signal_work kernel/entry/common.c:147 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x124/0x200 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x447039
Code: Unable to access opcode bytes at RIP 0x44700f.
RSP: 002b:00007f1b1225cdb8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: 0000000000000001 RBX: 00000000006dbc28 RCX: 0000000000447039
RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 00000000006dbc2c
RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 00007fff223b6bef R14: 00007f1b1225d9c0 R15: 00000000006dbc2c
==================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/12/17 02:16 upstream 5e60366d56c6 04201c06 .config console log report syz C ci-upstream-kasan-gce
2020/12/19 14:22 upstream 3644e2d2dda7 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/19 11:45 upstream 3644e2d2dda7 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/19 04:46 upstream a409ed156a90 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/18 13:47 upstream d64c6f96ba86 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/17 17:11 upstream accefff5b547 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/17 14:20 upstream accefff5b547 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/17 08:09 upstream 5e60366d56c6 04201c06 .config console log report info ci-upstream-kasan-gce
2020/12/17 01:53 upstream 5e60366d56c6 04201c06 .config console log report info ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.