From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Date: Wed, 16 Sep 2020 07:44:41 +0000 Subject: Re: [PATCH] fbcon: Fix user font detection test at fbcon_resize(). Message-Id: <20200916074441.GT438822@phenom.ffwll.local> List-Id: References: <00000000000024be1505ad487cbb@google.com> <7c52e8cd-e4cb-cd0b-40d5-b9654aec09f3@I-love.SAKURA.ne.jp> In-Reply-To: <7c52e8cd-e4cb-cd0b-40d5-b9654aec09f3@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Tetsuo Handa Cc: linux-fbdev@vger.kernel.org, syzbot , b.zolnierkie@samsung.com, gregkh@linuxfoundation.org, syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, george.kennedy@oracle.com, daniel.vetter@ffwll.ch, natechancellor@gmail.com, jirislaby@kernel.org On Wed, Sep 16, 2020 at 09:01:06AM +0900, Tetsuo Handa wrote: > Greg, will you pick up this patch? >=20 > It seems that finding the real cause of [3] and actually fixing [3] will = be difficult. > Since I can't reproduce [3] locally, I will have to try flood of "#syz te= st" requests > for debug printk() patches. Grasping for straws, but have you retested with the scrollback code removed already? That was full of fail and we outright deleted it: 50145474f6ef ("fbcon: remove soft scrollback code") Cheers, Daniel >=20 > On 2020/09/11 7:57, Tetsuo Handa wrote: > > syzbot is reporting OOB read at fbcon_resize() [1], for > > commit 39b3cffb8cf31117 ("fbcon: prevent user font height or width chan= ge > > from causing potential out-of-bounds access") is by error using > > registered_fb[con2fb_map[vc->vc_num]]->fbcon_par->p->userfont (which was > > set to non-zero) instead of fb_display[vc->vc_num].userfont (which rema= ins > > zero for that display). > >=20 > > We could remove tricky userfont flag [2], for we can determine it by > > comparing address of the font data and addresses of built-in font data. > > But since that commit is failing to fix the original OOB read [3], this > > patch keeps the change minimal in case we decide to revert altogether. > >=20 > > [1] https://syzkaller.appspot.com/bug?id=EBcbbb6576958a496500fee9cf7aa8= 3ea00b5920 > > [2] https://syzkaller.appspot.com/text?tag=3DPatch&x=14030853900000 > > [3] https://syzkaller.appspot.com/bug?idoba8c186d97cf1011ab17660e633b1c= c4e080c9 > >=20 > > Reported-by: syzbot > > Signed-off-by: Tetsuo Handa > > Fixes: 39b3cffb8cf31117 ("fbcon: prevent user font height or width chan= ge from causing potential out-of-bounds access") > > Cc: George Kennedy > > --- > > drivers/video/fbdev/core/fbcon.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/cor= e/fbcon.c > > index 66167830fefd..dae7ae7f225a 100644 > > --- a/drivers/video/fbdev/core/fbcon.c > > +++ b/drivers/video/fbdev/core/fbcon.c > > @@ -2203,7 +2203,7 @@ static int fbcon_resize(struct vc_data *vc, unsig= ned int width, > > struct fb_var_screeninfo var =3D info->var; > > int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; > > =20 > > - if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) { > > + if (p->userfont && FNTSIZE(vc->vc_font.data)) { > > int size; > > int pitch =3D PITCH(vc->vc_font.width); > > =20 > >=20 >=20 --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch