Bug 684261 - RFE: command to clear scrollback buffer in linux terminal
Summary: RFE: command to clear scrollback buffer in linux terminal
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL: http://thread.gmane.org/gmane.linux.k...
Depends On:
Blocks: 683733 691406
TreeView+ depends on / blocked
Reported: 2011-03-11 15:58 UTC by Miroslav Lichvar
Modified: 2016-07-21 13:08 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 714684 (view as bug list)
Last Closed: 2011-07-19 14:46:28 UTC
Type: ---

Attachments (Terms of Use)
Proposed fix (1.31 KB, patch)
2011-03-23 15:47 UTC, Petr Pisar
no flags Details | Diff

Description Miroslav Lichvar 2011-03-11 15:58:50 UTC
Description of problem:
In some situations it would be good to clear the terminal's scrollback buffer, for example on new login or when the terminal is locked so someone else won't be able to see the previous content with shift-pgup. (bug #683733)

There are hacks can be used to force clearing the buffer, like switching to another console and back, or changing the size of the terminal, but all seem to have some drawbacks.

This is a request to add a new command like \E[3J which would reset the scrollback buffer and which could be added to the linux terminfo entry, either to the clear sequence or as a new string capability.

Comment 1 Petr Pisar 2011-03-23 15:47:52 UTC
Created attachment 487076 [details]
Proposed fix

This patch introduce new \E[J parameter 3 that allows to scramble
scroll-back buffer explicitly. Session locking programs (screen,
vlock) can use it to prevent attacker to browse locked console

Tested on VGA and FB_VGA16 console in qemu.

Comment 2 Dave Jones 2011-03-24 03:38:16 UTC
post it to linux-kernel.org

We'll pick it up when we rebase if it gets merged.

Comment 4 Miroslav Lichvar 2011-07-19 14:46:28 UTC
This seems to work with current kernels.

Comment 5 Jiri Slaby 2016-07-21 12:37:43 UTC
(In reply to Petr Pisar from comment #1)
> Created attachment 487076 [details]
> Proposed fix

Why do you divide the size by 2? This results in erasure of only half of the buffer... (Note scr_memsetw proper divides the size by 2.)

Comment 6 Petr Pisar 2016-07-21 12:53:49 UTC
I'm sorry, I don't recall after 5 years. Maybe this was not true at that time. Or there were some differences between text mode and frame buffer backed virtual console. I don't know.

Comment 7 Jiri Slaby 2016-07-21 13:08:52 UTC
scr_memsetw always accepted size, not count. So I assume it is a bug and I will fix it.

Note You need to log in before you can comment on or make changes to this bug.