KASAN: null-ptr-deref Write in kthread_stop

5 views
Skip to first unread message

syzbot

unread,
Apr 22, 2019, 5:52:06 PM4/22/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: c98875d9 Linux 4.19.36
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16bac31d200000
kernel config: https://syzkaller.appspot.com/x/.config?x=5e40ac5fbcc6366d
dashboard link: https://syzkaller.appspot.com/bug?extid=59bfbd6d2dceb3f47ced
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+59bfbd...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: null-ptr-deref in atomic_inc
include/asm-generic/atomic-instrumented.h:109 [inline]
BUG: KASAN: null-ptr-deref in kthread_stop+0x78/0x6d0 kernel/kthread.c:545
Write of size 4 at addr 0000000000000020 by task syz-executor.2/9501

CPU: 0 PID: 9501 Comm: syz-executor.2 Not tainted 4.19.36 #4
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+0x172/0x1f0 lib/dump_stack.c:113
kasan_report_error mm/kasan/report.c:352 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x19f/0x2ba mm/kasan/report.c:396
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
atomic_inc include/asm-generic/atomic-instrumented.h:109 [inline]
kthread_stop+0x78/0x6d0 kernel/kthread.c:545
sdr_cap_stop_streaming+0x213/0x330
drivers/media/platform/vivid/vivid-sdr-cap.c:301
__vb2_queue_cancel+0xb4/0x970
drivers/media/common/videobuf2/videobuf2-core.c:1662
vb2_core_streamoff+0x60/0x140
drivers/media/common/videobuf2/videobuf2-core.c:1796
__vb2_cleanup_fileio+0x78/0x170
drivers/media/common/videobuf2/videobuf2-core.c:2323
vb2_core_queue_release+0x20/0x80
drivers/media/common/videobuf2/videobuf2-core.c:2050
vb2_queue_release drivers/media/common/videobuf2/videobuf2-v4l2.c:671
[inline]
_vb2_fop_release+0x1cf/0x2a0
drivers/media/common/videobuf2/videobuf2-v4l2.c:842
vb2_fop_release+0x75/0xc0
drivers/media/common/videobuf2/videobuf2-v4l2.c:856
vivid_fop_release+0x18e/0x430 drivers/media/platform/vivid/vivid-core.c:474
v4l2_release+0xfb/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:448
__fput+0x2df/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x14a/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:166
prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4129e1
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 e4 1a 00 00 c3 48
83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48
89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007fff59764ee0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 00000000004129e1
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00000000007409e0 R08: ffffffff81009aae R09: 000000000981a614
R10: 00007fff59764fb0 R11: 0000000000000293 R12: 0000000000000001
R13: 000000000002fb94 R14: 000000000002fbc1 R15: 000000000073bf0c
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Apr 22, 2019, 7:16:06 PM4/22/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: c98875d9 Linux 4.19.36
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=162efc7f200000
kernel config: https://syzkaller.appspot.com/x/.config?x=5e40ac5fbcc6366d
dashboard link: https://syzkaller.appspot.com/bug?extid=59bfbd6d2dceb3f47ced
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11482780a00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1216ed28a00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+59bfbd...@syzkaller.appspotmail.com

audit: type=1400 audit(1555974739.590:36): avc: denied { map } for
pid=7926 comm="syz-executor133" path="/root/syz-executor133330678"
dev="sda1" ino=1426 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: null-ptr-deref in atomic_inc
include/asm-generic/atomic-instrumented.h:109 [inline]
BUG: KASAN: null-ptr-deref in kthread_stop+0x78/0x6d0 kernel/kthread.c:545
Write of size 4 at addr 0000000000000020 by task syz-executor133/7955

CPU: 0 PID: 7955 Comm: syz-executor133 Not tainted 4.19.36 #4
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x933/0x2fa0 kernel/exit.c:876
do_group_exit+0x135/0x370 kernel/exit.c:979
__do_sys_exit_group kernel/exit.c:990 [inline]
__se_sys_exit_group kernel/exit.c:988 [inline]
__x64_sys_exit_group+0x44/0x50 kernel/exit.c:988
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443b68
Code: 00 00 be 3c 00 00 00 eb 19 66 0f 1f 84 00 00 00 00 00 48 89 d7 89 f0
0f 05 48 3d 00 f0 ff ff 77 21 f4 48 89 d7 44 89 c0 0f 05 <48> 3d 00 f0 ff
ff 76 e0 f7 d8 64 41 89 01 eb d8 0f 1f 84 00 00 00
RSP: 002b:00007ffc11459ff8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000443b68
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004c34d0 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 000000000000000f R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d5180 R14: 0000000000000000 R15: 0000000000000000
==================================================================

syzbot

unread,
Dec 3, 2019, 9:18:02 AM12/3/19
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit 467052f6ea5a51524992e43f02b543550495c391
Author: Alexander Popov <alex....@linux.com>
Date: Sun Nov 3 22:17:19 2019 +0000

media: vivid: Fix wrong locking that causes race conditions on
streaming stop

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=174f51bce00000
start commit: c98875d9 Linux 4.19.36
git tree: linux-4.19.y
If the result looks correct, please mark the bug fixed by replying with:

#syz fix: media: vivid: Fix wrong locking that causes race conditions on
streaming stop

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages