[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2105151733090.3032@angie.orcam.me.uk>
Date: Sat, 15 May 2021 18:11:46 +0200 (CEST)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
cc: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Linux Fbdev development list <linux-fbdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Daniel Vetter <daniel@...ll.ch>,
syzbot <syzbot+1f29e126cf461c4de3b3@...kaller.appspotmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Colin King <colin.king@...onical.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jani Nikula <jani.nikula@...el.com>,
Jiri Slaby <jirislaby@...nel.org>,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>,
"Antonino A. Daplas" <adaplas@...il.com>
Subject: Re: [PATCH] video: fbdev: vga16fb: fix OOB write in
vga16fb_imageblit()
On Fri, 14 May 2021, Linus Torvalds wrote:
> > Overall I think it does make sense to resize the text console at any
> > time, even if the visible console (VT) chosen is in the graphics mode,
>
> It might make sense, but only if we call the function to update the
> low-level data.
>
> Not calling it, and then starting to randomly use the (wrong)
> geometry, and just limiting it so that it's all within the buffer -
> THAT does not make sense.
>
> So I think your patch is fundamentally wrong. It basically says "let's
> use random stale incorrect data, but just make sure that the end
> result is still within the allocated buffer".
I guess you mean Tetsuo-san's patch, right? I haven't sent any in this
discussion.
> My patch is at least conceptually sane.
>
> An alternative would be to just remove the "vcmode != KD_GRAPHICS"
> check entirely, and always call con_resize() to update the low-level
> data, but honestly, that seems very likelty to break something very
> fundamentally, since it's not how any of fbcon has ever been tested,
Umm, there isn't much to change as far as console data structures are
concerned with a resize: obviously the width and the height, which affect
the size of the character/attribute buffer, and maybe some cursor data
such as the size and screen coordinates.
For vgacon we have:
if (con_is_visible(c) && !vga_is_gfx) /* who knows */
vgacon_doresize(c, width, height);
in `vgacon_resize' already, following all the sanity checks, so the CRTC
isn't poked at if `vga_is_gfx', exactly as we want.
I can see fbcon does not have equivalent code and instead has relied on
the KD_GRAPHICS check made by the caller. Which I think has been a bug
since fbcon's inception. Instead I think `fbcon_resize' ought to make all
the sanity checks I can see it does and only then check for KD_GRAPHICS
and if so, then exit without poking at hardware. Then upon exit from the
gfx mode the `fb_set_var' call made from `fbcon_blank' will DTRT.
I can try verifying the latter hypothesis, though my framebuffer setups
(with DECstation hardware) have always been somewhat incomplete. I do
believe I have a MIPS fbdev X server binary somewhere to fiddle with,
which should work with that TGA/SFB+ video adapter I mentioned before.
> Another alternative would be to just delay the resize to when vcmode
> is put back to text mode again. That sounds somewhat reasonable to me,
> but it's a pretty big thing.
Methinks it works exactly like that already. On exit from the graphics
mode (a VT switch or gfx program termination) hardware is reprogrammed
according to the console geometry previously set. We just must not break
it.
Maciej
Powered by blists - more mailing lists