While mounting virtual console devices in a systemd container is a
recipe for disaster (I experienced it first hand), mounting serial
console devices, modems, and others should still be done by default
for privileged systemd-based containers.
v2, addressing the review from @fho:
- use backticks in the regular expression to remove backslashes
- pre-compile the regex at the package level
- drop IsVirtualTerminalDevice (not needed for a one-liner)
v3, addressing the review from @fho and @rhatdan:
- re-introduce a private function for matching the device names
- use path.Match rather than a regex not to slow down startup time
Closes#16925.
Fixes: 5a2405ae1b ("Don't mount /dev/tty* inside privileged...")
Cherry-picked from f4c81b0aa5 with
conflict resolution (accept incoming test updates) and additional
systemdMode handling for rootless: only skip /dev/ptmx, /dev/tty,
and virtual consoles (tty0, tty1, ...); pass non-vt TTYs (ttyS0,
ttyACM0, etc.) through to privileged rootless containers.
AI-Attribution: Created/Modified with the assistance of AI: Cursor <Auto>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Signed-off-by: Chris Evich <cevich@redhat.com>
Made-with: Cursor