lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM6JnLe88xf8hO0F=_Ni+irNt40+987tHmz9ZjppgxhnMnLxpw@mail.gmail.com>
Date:   Tue, 5 Nov 2019 01:03:23 -0800
From:   Or Cohen <orcohen@...oaltonetworks.com>
To:     Jiri Slaby <jslaby@...e.com>
Cc:     Nicolas Pitre <nico@...xnic.net>,
        Greg KH <gregkh@...uxfoundation.org>, textshell@...uujin.de,
        Daniel Vetter <daniel.vetter@...ll.ch>, sam@...nborg.org,
        mpatocka@...hat.com, ghalat@...hat.com,
        linux-kernel@...r.kernel.org, jwilk@...lk.net,
        Nadav Markus <nmarkus@...oaltonetworks.com>,
        syzkaller@...glegroups.com
Subject: Re: Bug report - slab-out-of-bounds in vcs_scr_readw

@Nicolas Pitre  - I agree with you, "vcs_size" may return a negative
error code, so the patch is correct but as @jslaby@...e.com  said it
won't fix the issue.
In my debugging session, "vcs_size" returns a positive integer ( 8000
decimal ) and the bug still triggers.

Maybe it's related to the following logic in "vcs_size"? ( not sure
about that.. )

221        if (use_attributes(inode)) {
222                if (use_unicode(inode))
223                        return -EOPNOTSUPP;
224                size = 2*size + HEADER_SIZE;
225       } else if (use_unicode(inode))
226               size *= 4;
227        return size;

Why in the case of "use_unicode(inode)" size is multiplied by 4 and
not 2?  ( as we can see in line 224 )





On Mon, Nov 4, 2019 at 10:54 PM Jiri Slaby <jslaby@...e.com> wrote:
>
> On 04. 11. 19, 19:33, Nicolas Pitre wrote:
> > On Mon, 4 Nov 2019, Or Cohen wrote:
> >
> >> @gregkh@...uxfoundation.org @nico@...xnic.net  - Thanks for the quick response.
> >> @gregkh@...uxfoundation.org  - Regarding your question, I don't think
> >> the 1 byte buffer is related to the problem. (  it's just was there in
> >> the initial reproducer the fuzzer created, and I forgot to remove it
> >> while reducing code from the reproducer ).
> >
> > I think I know what the problem is. I have no time to test it though.
> >
> > Please try this (untested) patch. Also please try running the same test
> > code but with vcsa6 in addition to vcsu6 to be sure.
> >
> > ---------- >8
> > Subject: [PATCH] vcs: add missing validation on vcs_size() returned value
> >
> > One usage instance didn't account for the fact that vcs_size() may
> > return a negative error code.
> >
> > Signed-off-by: Nicolas Pitre <npitre@...libre.com>
> >
> > diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
> > index 1f042346e7..fa07d79027 100644
> > --- a/drivers/tty/vt/vc_screen.c
> > +++ b/drivers/tty/vt/vc_screen.c
> > @@ -474,6 +474,10 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> >               goto unlock_out;
> >
> >       size = vcs_size(inode);
> > +     if (size < 0) {
> > +             ret = size;
> > +             goto unlock_out;
> > +     }
> >       ret = -EINVAL;
> >       if (pos < 0 || pos > size)
> >               goto unlock_out;
>
> pos must be >= 0, so "pos > size" would catch this case as a side
> effect, or am I missing something? That being said, the patch is
> correct, but won't fix the issue IMO.
>
> thanks,
> --
> js
> suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ