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] [day] [month] [year] [list]
Message-ID: <CAJRQjoeOfiyacHcFfQOop5jJ9MspDKL8HTjQeAY-_Wbm9PnFGg@mail.gmail.com>
Date:   Sun, 29 Mar 2020 09:04:41 +0800
From:   Qiujun Huang <hqjagain@...il.com>
To:     Sam Ravnborg <sam@...nborg.org>
Cc:     Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Daniel Thompson <daniel.thompson@...aro.org>,
        ghalat@...hat.com, dri-devel <dri-devel@...ts.freedesktop.org>,
        Linux Fbdev development list <linux-fbdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fbcon: fix null-ptr-deref in fbcon_switch

On Sun, Mar 29, 2020 at 2:13 AM Sam Ravnborg <sam@...nborg.org> wrote:
>
> Hi Qiujun
>
> Thanks for looking into the sysbot bugs.
>
> On Sat, Mar 28, 2020 at 11:15:10PM +0800, Qiujun Huang wrote:
> > Add check for vc_cons[logo_shown].d, as it can be released by
> > vt_ioctl(VT_DISALLOCATE).
> >
> > Reported-by: syzbot+732528bae351682f1f27@...kaller.appspotmail.com
> > Signed-off-by: Qiujun Huang <hqjagain@...il.com>
> > ---
> >  drivers/video/fbdev/core/fbcon.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> > index bb6ae995c2e5..7ee0f7b55829 100644
> > --- a/drivers/video/fbdev/core/fbcon.c
> > +++ b/drivers/video/fbdev/core/fbcon.c
> > @@ -2254,7 +2254,7 @@ static int fbcon_switch(struct vc_data *vc)
> >               fbcon_update_softback(vc);
> >       }
> >
> > -     if (logo_shown >= 0) {
> > +     if (logo_shown >= 0 && vc_cons_allocated(logo_shown)) {
> >               struct vc_data *conp2 = vc_cons[logo_shown].d;
> >
> >               if (conp2->vc_top == logo_lines
> > @@ -2852,7 +2852,7 @@ static void fbcon_scrolldelta(struct vc_data *vc, int lines)
> >                       return;
> >               if (vc->vc_mode != KD_TEXT || !lines)
> >                       return;
> > -             if (logo_shown >= 0) {
> > +             if (logo_shown >= 0 && vc_cons_allocated(logo_shown)) {
> >                       struct vc_data *conp2 = vc_cons[logo_shown].d;
> >
> >                       if (conp2->vc_top == logo_lines
>
> I am not familiar with this code.
>
> But it looks like you try to avoid the sympton
> which is that logo_shown has a wrong value after a
> vc is deallocated, and do not fix the root cause.
>
> We have:
>
> vt_ioctl(VT_DISALLOCATE)
>  |
>  +- vc_deallocate()
>      |
>      +- visual_deinit()
>          |
>          +- vc->vc_sw->con_deinit(vc)
>              |
>              +- fbcon_deinit()
>
> Would it be better to update logo_shown
> in fbcon_deinit()?
> Then we will not try to do anything with
> the logo in fbcon_switch().
>
> fbcon_deinit() is called with console locked
> so there should not be any races.

Get that, thanks.

>
> I did not stare long enough on the code to come up with a patch,
> but this may be a better way to fix it.
>
>         Sam

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ