Re: BUG: unable to handle kernel paging request in n_tty_open

From: Jiri Slaby
Date: Mon Feb 13 2023 - 01:18:36 EST


On 12. 02. 23, 18:00, Dipanjan Das wrote:
Hi,

We would like to report the following bug which has been found by our
modified version of syzkaller.

======================================================
description: BUG: unable to handle kernel paging request in n_tty_open
affected file: drivers/tty/tty_ldisc.c
kernel version: 6.2.0-rc5
kernel commit: 41c66f47061608dc1fd493eebce198f0e74cc2d7
git tree: kmsan
kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=a9a22da1efde3af6
crash reproducer: attached
======================================================
Crash log:
======================================================
RBP: 00007f7117670c30 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000d
R13: 00007f71165abf6c R14: 00007f71165abf60 R15: 00007f7117670d80
</TASK>
BUG: unable to handle page fault for address: ffffd10016bfa050
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 11410067 P4D 11410067 PUD 1157d067 PMD 31910067 PTE 0
Oops: 0002 [#1] PREEMPT SMP
CPU: 1 PID: 14496 Comm: syz-executor.4 Not tainted
6.2.0-rc5-00010-g41c66f470616 #8
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:n_tty_open+0xa5/0x240 drivers/tty/n_tty.c:1883

ldata = vzalloc(sizeof(*ldata));
if (!ldata)
return -ENOMEM;

ldata->overrun_time = jiffies;

COuld you explain how this assignment can ever fail? ldata is either allocated correctly (non-NULL) and the assignment cannot fail or not (NULL) and the assignment cannot fail (as it doesn't happen).

thanks,
--
js
suse labs