syzbot


KASAN: null-ptr-deref Read in refcount_sub_and_test_checked (2)

Status: fixed on 2020/02/18 10:28
Subsystems: media
[Documentation on labels]
Reported-by: syzbot+0468b73bdbb243217224@syzkaller.appspotmail.com
Fix commit: 62dcb4f41836 media: vb2: check memory model for VIDIOC_CREATE_BUFS
First crash: 2021d, last: 1819d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: BUG: unable to handle kernel NULL pointer dereference in vb2_vmalloc_put (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 62dcb4f41836bd3c44b5b651bb6df07ea4cb1551
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Thu Nov 8 12:23:37 2018 +0000

  media: vb2: check memory model for VIDIOC_CREATE_BUFS

  
Discussions (3)
Title Replies (including bot) Last reply
KASAN: null-ptr-deref Read in refcount_sub_and_test_checked (2) 0 (3) 2019/12/07 01:30
Reminder: 35 open syzbot bugs in media subsystem 1 (1) 2019/07/24 01:39
Reminder: 28 open syzbot bugs in media subsystem 1 (1) 2019/06/27 03:53
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: null-ptr-deref Read in refcount_sub_and_test_checked media C 31 2029d 2060d 11/26 fixed on 2018/11/12 21:25

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: null-ptr-deref in refcount_sub_and_test_checked+0x9d/0x310 lib/refcount.c:179
Read of size 4 at addr 0000000000000020 by task syz-executor487/6051

CPU: 0 PID: 6051 Comm: syz-executor487 Not tainted 4.20.0-rc2+ #333
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+0x244/0x39d lib/dump_stack.c:113
 kasan_report_error mm/kasan/report.c:352 [inline]
 kasan_report.cold.8+0x6d/0x309 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 kasan_check_read+0x11/0x20 mm/kasan/kasan.c:272
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 refcount_sub_and_test_checked+0x9d/0x310 lib/refcount.c:179
 refcount_dec_and_test_checked+0x1a/0x20 lib/refcount.c:212
 vb2_vmalloc_put+0x19/0x80 drivers/media/common/videobuf2/videobuf2-vmalloc.c:68
 __vb2_buf_mem_free+0x112/0x210 drivers/media/common/videobuf2/videobuf2-core.c:242
 __vb2_free_mem drivers/media/common/videobuf2/videobuf2-core.c:413 [inline]
 __vb2_queue_free+0x830/0xa30 drivers/media/common/videobuf2/videobuf2-core.c:458
 vb2_core_queue_release+0x62/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2231
 vb2_queue_release drivers/media/common/videobuf2/videobuf2-v4l2.c:837 [inline]
 _vb2_fop_release+0x1d2/0x2b0 drivers/media/common/videobuf2/videobuf2-v4l2.c:1010
 vb2_fop_release+0x77/0xc0 drivers/media/common/videobuf2/videobuf2-v4l2.c:1024
 vivid_fop_release+0x18e/0x440 drivers/media/platform/vivid/vivid-core.c:474
 v4l2_release+0x224/0x3a0 drivers/media/v4l2-core/v4l2-dev.c:456
 __fput+0x385/0xa30 fs/file_table.c:278
 ____fput+0x15/0x20 fs/file_table.c:309
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1ad6/0x26d0 kernel/exit.c:867
 do_group_exit+0x177/0x440 kernel/exit.c:970
 __do_sys_exit_group kernel/exit.c:981 [inline]
 __se_sys_exit_group kernel/exit.c:979 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:979
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x442c78
Code: Bad RIP value.
RSP: 002b:00007fff4ac5a278 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000442c78
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004c2848 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d4180 R14: 0000000000000000 R15: 0000000000000000
==================================================================

Crashes (916):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/11/13 14:41 upstream ccda4af0f4b9 5f5f6d14 .config console log report syz C ci-upstream-kasan-gce
2018/11/13 14:40 upstream ccda4af0f4b9 5f5f6d14 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2018/11/13 14:38 upstream ccda4af0f4b9 5f5f6d14 .config console log report syz C ci-upstream-kasan-gce-root
2018/11/13 14:38 upstream ccda4af0f4b9 5f5f6d14 .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/11/13 16:30 upstream ccda4af0f4b9 5f5f6d14 .config console log report syz C ci-upstream-kasan-gce-386
2018/11/13 13:54 linux-next 442b8cea2477 5f5f6d14 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/12/23 00:34 upstream 23203e3f34c9 e3bd7ab8 .config console log report ci-upstream-kasan-gce
2018/12/21 07:26 upstream 9097a058d49e 2b497001 .config console log report ci-upstream-kasan-gce-selinux-root
2018/12/13 07:49 upstream f5d582777bcb 02613a41 .config console log report ci-upstream-kasan-gce-smack-root
2018/12/10 08:56 upstream 0844895a2e51 96cc4c50 .config console log report ci-upstream-kasan-gce-root
2018/12/19 06:33 upstream ddfbab46539f 4edaba93 .config console log report ci-upstream-kasan-gce-386
2019/06/03 20:46 net-old afa0925c6fcc 63bf051f .config console log report ci-upstream-net-this-kasan-gce
2019/06/03 19:44 net-old afa0925c6fcc 63bf051f .config console log report ci-upstream-net-this-kasan-gce
2019/06/03 00:44 net-old 8c268598192d 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/06/02 20:22 net-old e8d67fa5696e 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/06/02 17:56 net-old e8d67fa5696e 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/06/02 15:05 net-old e8d67fa5696e 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/06/01 17:12 net-old e8d67fa5696e 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/06/01 07:20 net-old e8d67fa5696e 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/06/01 05:26 net-old e8d67fa5696e 53c81ea5 .config console log report ci-upstream-net-this-kasan-gce
2019/05/31 16:08 net-old 100f6d8e0990 142ce681 .config console log report ci-upstream-net-this-kasan-gce
2019/05/31 05:00 net-old 4b280531e84c d9aaf3c2 .config console log report ci-upstream-net-this-kasan-gce
2019/05/31 01:57 net-old 4b280531e84c d9aaf3c2 .config console log report ci-upstream-net-this-kasan-gce
2019/05/30 17:12 net-old 58e8b37069ff d9aaf3c2 .config console log report ci-upstream-net-this-kasan-gce
2019/05/30 15:23 net-old 58e8b37069ff d9aaf3c2 .config console log report ci-upstream-net-this-kasan-gce
2019/05/29 22:31 net-old a6cd0d2d493a 5457ef34 .config console log report ci-upstream-net-this-kasan-gce
2019/05/29 20:23 net-old a6cd0d2d493a 5457ef34 .config console log report ci-upstream-net-this-kasan-gce
2019/05/29 08:31 net-old a6cd0d2d493a 6bd61501 .config console log report ci-upstream-net-this-kasan-gce
2019/05/29 02:29 net-old d484e06e25eb 6bd61501 .config console log report ci-upstream-net-this-kasan-gce
2019/05/28 09:17 net-old 3e66b7cc50ef 6bd61501 .config console log report ci-upstream-net-this-kasan-gce
2019/05/28 06:35 net-old 3e66b7cc50ef 6bd61501 .config console log report ci-upstream-net-this-kasan-gce
2019/05/28 04:28 net-old 3e66b7cc50ef 6bd61501 .config console log report ci-upstream-net-this-kasan-gce
2019/05/27 23:11 net-old 3e66b7cc50ef 6bd61501 .config console log report ci-upstream-net-this-kasan-gce
2019/05/27 19:50 net-old 3e66b7cc50ef 562efd79 .config console log report ci-upstream-net-this-kasan-gce
2019/05/27 18:09 net-old 3e66b7cc50ef 562efd79 .config console log report ci-upstream-net-this-kasan-gce
2019/05/27 08:11 net-old 334031219a84 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/27 05:59 net-old 334031219a84 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/26 14:08 net-old f4bcf14e3997 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/26 12:40 net-old f4bcf14e3997 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/26 08:17 net-old f4bcf14e3997 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/26 00:12 net-old 4097e9d250fb 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/25 23:02 net-old 4097e9d250fb 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/25 13:25 net-old ce8d24f9a596 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/25 07:37 net-old ce8d24f9a596 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/24 21:45 net-old ce8d24f9a596 85c57315 .config console log report ci-upstream-net-this-kasan-gce
2019/05/24 13:17 net-old b5730061d105 0dadcd9d .config console log report ci-upstream-net-this-kasan-gce
2019/05/24 07:14 net-old b5730061d105 0dadcd9d .config console log report ci-upstream-net-this-kasan-gce
2019/06/01 12:03 net-next-old c9bb6165a16e 53c81ea5 .config console log report ci-upstream-net-kasan-gce
2019/06/01 08:29 net-next-old c9bb6165a16e 53c81ea5 .config console log report ci-upstream-net-kasan-gce
2019/05/31 10:08 net-next-old 517f4c49aafc d9aaf3c2 .config console log report ci-upstream-net-kasan-gce
2019/05/30 20:13 net-next-old 517f4c49aafc d9aaf3c2 .config console log report ci-upstream-net-kasan-gce
2019/05/30 10:24 net-next-old 7da33a8f87a4 d9aaf3c2 .config console log report ci-upstream-net-kasan-gce
2019/05/30 09:20 net-next-old 7da33a8f87a4 d9aaf3c2 .config console log report ci-upstream-net-kasan-gce
2019/05/29 18:42 net-next-old 36f18439ea16 5457ef34 .config console log report ci-upstream-net-kasan-gce
2019/05/26 16:50 net-next-old 22942498cceb 85c57315 .config console log report ci-upstream-net-kasan-gce
2019/05/25 21:46 net-next-old 22942498cceb 85c57315 .config console log report ci-upstream-net-kasan-gce
2019/05/24 09:36 net-next-old 16fa1cf1ed2a 0dadcd9d .config console log report ci-upstream-net-kasan-gce
2018/12/07 03:47 linux-next 442b8cea2477 dcf836b1 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/11/13 11:16 linux-next 442b8cea2477 5f5f6d14 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.