Re: [PATCH v10 3/4] console: Add persistent scrollback buffers for all VGA consoles
From: Manuel Schölling
Date: Thu Jan 19 2017 - 11:15:06 EST
On Thu, 2017-01-19 at 14:23 +0100, Greg KH wrote:
> On Fri, Jan 13, 2017 at 09:07:57PM +0100, Manuel SchÃlling wrote:
> > Add a scrollback buffers for each VGA console. The benefit is that
> > the scrollback history is not flushed when switching between
> > consoles
> > but is persistent.
> > The buffers are allocated on demand when a new console is opened.
> >
> > This breaks tools like clear_console that rely on flushing the
> > scrollback history by switching back and forth between consoles
> > which is why this feature is disabled by default.
> > Use the escape sequence \e[3J instead for flushing the buffer.
> >
> > Signed-off-by: Manuel SchÃlling <manuel.schoelling@xxxxxx>
> > Reviewed-by: Andrey Utkin <andrey_utkin@xxxxxxxxxxxx>
> > Tested-by: Andrey Utkin <andrey_utkin@xxxxxxxxxxxx>
> > Tested-by: Adam Borowski <kilobyte@xxxxxxxxxx>
> > ---
> > Âdrivers/video/console/KconfigÂÂ|ÂÂ25 +++++++-
> > Âdrivers/video/console/vgacon.c | 142 ++++++++++++++++++++++++++---
> > ------------
> > Â2 files changed, 111 insertions(+), 56 deletions(-)
> >
> > diff --git a/drivers/video/console/Kconfig
> > b/drivers/video/console/Kconfig
> > index c3f1fb9ee820..f500e58f7636 100644
> > --- a/drivers/video/console/Kconfig
> > +++ b/drivers/video/console/Kconfig
> > @@ -43,9 +43,28 @@ config VGACON_SOFT_SCROLLBACK_SIZE
> > ÂÂÂÂÂÂÂÂrange 1 1024
> > ÂÂÂÂÂÂÂÂdefault "64"
> > ÂÂÂÂÂÂÂÂhelp
> > -ÂÂÂÂÂÂÂÂÂEnter the amount of System RAM to allocate for the
> > scrollback
> > - Âbuffer.ÂÂEach 64KB will give you approximately 16 80x25
> > - Âscreenfuls of scrollback buffer
> > + ÂÂEnter the amount of System RAM to allocate for
> > scrollback
> > + ÂÂbuffers of VGA consoles. Each 64KB will give you
> > approximately
> > + ÂÂ16 80x25 screenfuls of scrollback buffer.
> > +
> > +config VGACON_SOFT_SCROLLBACK_PERSISTENT
> > + bool "Persistent Scrollback History for each console"
> > + depends on VGACON_SOFT_SCROLLBACK
> > + default n
> > + help
> > + ÂÂSay Y here if the scrollback history should persist when
> > switching
> > + ÂÂbetween consoles. Otherwise, the scrollback history will
> > be flushed
> > + ÂÂeach time the console is switched.
> > +
> > + ÂÂThis feature might break your tool of choice to flush
> > the scrollback
> > + ÂÂbuffer, e.g. clear(1) will work fine but Debian's
> > clear_console(1)
> > + ÂÂwill be broken, which might cause security issues.
> > + ÂÂYou can use the escape sequence \e[3J instead if this
> > feature is
> > + ÂÂactivated.
>
> This issue is the one that makes me the most worried.ÂÂWhy doesn't
> clear_console() work anymore?ÂÂWhy doesn't it use \e[3J ?
Well, clear_console() just switches from one console to another and
back again. It just assumes that the scrollback buffer is flushed when
switching.
My plan is to make a patch for clear_console() as soon as these patches
are in the kernel - it's chicken-and-egg problem.
Bye,
Manuel