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.
Created attachment 487076 [details]
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.
post it to linux-kernel.org
We'll pick it up when we rebase if it gets merged.
Merged to Linus' linux-2.6:
This seems to work with current kernels.
(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.)
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.
scr_memsetw always accepted size, not count. So I assume it is a bug and I will fix it.