From: Dmitry Vyukov <dvyukov@google.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Greg KH <gregkh@linuxfoundation.org>,
syzbot <syzbot+f4f1e871965064ae689e@syzkaller.appspotmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
asierra@xes-inc.com, ext-kimmo.rautkoski@vaisala.com,
Jiri Slaby <jslaby@suse.com>,
kai heng feng <kai.heng.feng@canonical.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
mika.westerberg@linux.intel.com, o.barta89@gmail.com,
paulburton@kernel.org, sr@denx.de,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
yegorslists@googlemail.com
Subject: Re: BUG: unable to handle kernel NULL pointer dereference in mem_serial_out
Date: Wed, 18 Dec 2019 07:53:48 +0100 [thread overview]
Message-ID: <CACT4Y+ZiOF0cwy4sDVw7T5wCpX-M9KarRj5S=rFY8zrHbrLFxA@mail.gmail.com> (raw)
In-Reply-To: <201912180055.xBI0txro079201@www262.sakura.ne.jp>
On Wed, Dec 18, 2019 at 1:56 AM Tetsuo Handa
<penguin-kernel@i-love.sakura.ne.jp> wrote:
>
> Hmm, this is a surprising bug. syzbot provided a C reproducer, but the definition
> of "struct serial_struct" used in that reproducer is wrong. As a result, syzbot was
> reporting crash caused by passing wrong arguments. ;-)
We are on it:
https://github.com/google/syzkaller/blob/master/sys/linux/dev_ptmx.txt.warn#L20-L25
> close_delay field used in the C reproducer is sizeof(unsigned int) bytes rather than
> sizeof(unsigned short) bytes, thus fields after close_delay field are incorrectly
> interpreted.
>
> ----------------------------------------
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <linux/serial.h>
>
> struct bad_serial_struct {
> int type;
> int line;
> unsigned int port;
> int irq;
> int flags;
> int xmit_fifo_size;
> int custom_divisor;
> int baud_base;
> unsigned int close_delay; /* Correct type is "unsigned short". */
> char io_type;
> char reserved_char[1];
> int hub6;
> unsigned short closing_wait;
> unsigned short closing_wait2;
> unsigned char *iomem_base;
> unsigned short iomem_reg_shift;
> unsigned int port_high;
> unsigned long iomap_base;
> };
>
> int main(int argc, char *argv[])
> {
> struct bad_serial_struct ss = { };
> int fd = open("/dev/ttyS3", O_RDONLY);
> ss.type = 0xa;
> ss.line = 0x400000;
> ss.port = 0x100;
> ss.irq = 0;
> ss.flags = 0x400000;
> ss.xmit_fifo_size = 0;
> ss.custom_divisor = 0;
> ss.baud_base = 0x80000;
> ss.close_delay = 0x200ff;
> ss.io_type = 0;
> ss.reserved_char[0] = 0x41;
> ss.hub6 = 3;
> ss.closing_wait = 0;
> ss.closing_wait2 = 0x7c5;
> ss.iomem_base = NULL;
> ss.iomem_reg_shift = 0;
> ss.port_high = 0;
> ss.iomap_base = 0;
> ioctl(fd, TIOCSSERIAL, &ss);
> return 0;
> }
> ----------------------------------------
prev parent reply other threads:[~2019-12-18 6:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-07 6:25 BUG: unable to handle kernel NULL pointer dereference in mem_serial_out syzbot
2019-12-12 10:57 ` Greg KH
2019-12-13 9:02 ` Dmitry Vyukov
2019-12-13 9:33 ` Greg KH
2019-12-13 10:00 ` Dmitry Vyukov
2019-12-13 10:10 ` Greg KH
2019-12-13 10:39 ` Dmitry Vyukov
2019-12-13 11:26 ` Greg KH
2019-12-17 10:48 ` Dmitry Vyukov
2020-01-07 17:02 ` Dmitry Vyukov
2019-12-13 14:31 ` Tetsuo Handa
2019-12-13 16:07 ` Greg KH
2019-12-14 0:48 ` Tetsuo Handa
2019-12-14 7:55 ` Greg KH
2019-12-14 8:39 ` Tetsuo Handa
2019-12-14 9:09 ` Greg KH
2019-12-14 10:28 ` Tetsuo Handa
2019-12-14 11:25 ` Greg KH
2019-12-18 0:55 ` Tetsuo Handa
2019-12-18 6:53 ` Dmitry Vyukov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACT4Y+ZiOF0cwy4sDVw7T5wCpX-M9KarRj5S=rFY8zrHbrLFxA@mail.gmail.com' \
--to=dvyukov@google.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=asierra@xes-inc.com \
--cc=ext-kimmo.rautkoski@vaisala.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=o.barta89@gmail.com \
--cc=paulburton@kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=sr@denx.de \
--cc=syzbot+f4f1e871965064ae689e@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=yegorslists@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).