Re: Bug report - slab-out-of-bounds in vcs_scr_readw

From: Or Cohen
Date: Wed Nov 06 2019 - 12:02:06 EST


@dvyukov@xxxxxxxxxx - Regarding your question, the .config file I used
when fuzzing is attached.
I compared it and I don't think you are missing some good config in upstream.
I created my .config file just with "make defconfig make kvmconfig"
and added some features useful for debugging..

On Tue, Nov 5, 2019 at 3:44 PM Nicolas Pitre <nico@xxxxxxxxxxx> wrote:
>
> On Tue, 5 Nov 2019, Jiri Slaby wrote:
>
> > On 05. 11. 19, 10:33, Nicolas Pitre wrote:
> > > Subject: [PATCH] vcs: prevent write access to vcsu devices
> > >
> > > Commit d21b0be246bf ("vt: introduce unicode mode for /dev/vcs") guarded
> > > against using devices containing attributes as this is not yet
> > > implemented. It however failed to guard against writes to any devices
> > > as this is also unimplemented.
> > >
> > > Signed-off-by: Nicolas Pitre <npitre@xxxxxxxxxxxx>
> > > Cc: <stable@xxxxxxxxxxxxxxx> # v4.19+
> > >
> > > diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
> > > index fa07d79027..ef19b95b73 100644
> > > --- a/drivers/tty/vt/vc_screen.c
> > > +++ b/drivers/tty/vt/vc_screen.c
> > > @@ -456,6 +456,9 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> > > size_t ret;
> > > char *con_buf;
> > >
> > > + if (use_unicode(inode))
> > > + return -EOPNOTSUPP;
> >
> > Looks good to me. I am also thinking about a ban directly in open:
> >
> > if (use_unicode(inode) && (filp->f_flags & O_ACCMODE) != O_RDONLY)
> > return -EOPNOTSUPP;
> >
> > Would that break the unicode users?
>
> The user I know about uses a common helper that uses O_RDWR.
> So yes, in that case that would break it.
>
>
> Nicolas

Attachment: config_compile
Description: Binary data