vlock: ensure locked VT is active when locking all consoles

vlock -a is documented to lock all console sessions and disable VT
switching, telling the user that the entire console display is locked.
This guarantee relies entirely on holding VT_PROCESS mode on the active
VT because vlock refuses switch requests only when its own VT is in the
foreground (change_console() in the kernel consults only fg_console).

If a VT switch occurs before VT_SETMODE takes effect during startup,
or if vlock -a is invoked on a background VT (e.g. "chvt 2; vlock -a" or
via an idle timer), VT_SETMODE succeeds on the background terminal
without protecting anything. Another console remains active with
unrestricted switching, while vlock reports success and falsely claims
the display is locked.

Resolve the current VT number via TIOCGDEV and pull the terminal to
the foreground using VT_ACTIVATE and VT_WAITACTIVE after entering
VT_PROCESS mode. If the VT is already active, the kernel performs no
switch. If activation or waiting fails, restore the previous VT mode and
fail rather than claiming a lock that is not enforced.

Reported-by: Vitezslav Crhonek <vcrhonek@redhat.com>
Signed-off-by: Alexey Gladkov <legion@kernel.org>
1 file changed
tree: c00b83d33da277e359e57c817fd6827b4bbb2b15
  1. .github/
  2. config/
  3. contrib/
  4. data/
  5. docs/
  6. m4/
  7. po/
  8. src/
  9. tests/
  10. .clang-format
  11. .gitignore
  12. AUTHORS
  13. autogen.sh
  14. ChangeLog
  15. configure.ac
  16. CREDITS
  17. INSTALL
  18. LICENSE
  19. Makefile.am
  20. Makefile.common
  21. NEWS
  22. README.md
README.md

KBD (Linux keyboard tools) CI

This package contains tools for managing Linux console (Linux console, virtual terminals, keyboard, etc.) – mainly, what they do is loading console fonts and keyboard maps.

This distribution contains no binaries - the sources depend on the kernel version - compile them yourself.

The home site of this package:

Mailing list

To protect subscribers from spam, the mailing list requires a subscription.

Bug reporting

Report problems with this package to the mailing list or directly to the Alexey Gladkov <gladkov.alexey@gmail.com>.

Source code

The latest stable version of kbd can always be found on:

Web interface:

Versioning:

  • Standard releases: <major>.<minor>[.<maint>]

    • major -- fatal and deep changes;
    • minor -- typical release with new features;
    • maint -- bug fixes.
  • Development releases: <major>.<minor>-rc<N>

To summarize, the stable release is 2.1.0 while 2.0.9x is a pre-releases.

Git repository:

Git Branches: git branch -a

  • master branch

    • current development.
    • the source for stable releases when deemed ready.
  • for-master branch

    • unstable changes for master. These changes can be reversed or rolled back.

Tags: git tag

  • a new tag object is created for every release.
  • tag name: v<version>.
  • all tags are signed by the maintainer's PGP key.

See also:

NLS (PO translations)

PO files are maintained by: https://translationproject.org/domain/kbd.html

License

Kbd is licensed under the GNU General Public License (GPL), version 2, or at your option any later version.