Repository navigation
Conversation
kwtty login execs the login shell with the signal dispositions it was started with, unlike login(1). Debian's kw-init, a bash script, starts it as a background command, which a non-interactive bash runs with SIGINT and SIGQUIT ignored, so the shell and every program it ran inherited that, and Ctrl-C could not stop programs such as sleep or python3 -m http.server. Reset every signal to its default and unblock them all, as kwtty serve already does for its sessions, and check the console's SigIgn on every image. The Alpine image was not affected, since busybox init resets signals for the programs it starts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On the Debian image, Ctrl-C at the console does not stop the program in the foreground:
sleep 20runs to the end, andpython3 -m http.serverkeeps running.What changed
kwtty loginexecs the login shell with the signal dispositions it was started with. login(1) resets SIGINT and SIGQUIT first. Debian's kw-init is a bash script and startskwtty loginas a background command. A non-interactive bash runs background commands with SIGINT and SIGQUIT ignored. The login shell and every program it runs inherit that (SigIgn 0x6), so Ctrl-C stops nothing.The change touches two files:
guest/src/kwtty.c:shell_child()already reset every signal to SIG_DFL and cleared the mask forkwtty servesessions. That reset is nowdefault_signals(), andlogin()calls it beforeexecv().test/distro.test.ts: the console test checks that a program started from the console ignores no signal (SigIgnall zero), on every image. The check goes through the console, becausekwtty servealready resets signals forvm.execsessions.Scope
The Alpine image is not affected, because busybox init resets signals for the programs it starts. kw-init is unchanged. kwtty ships in the base bundle, so the fix reaches the page with the next release's bundle.
Verification
On Linux,
pnpm test:distrowith the old kwtty fails on Debian only (SigIgn: 0000000000000006). With this change,pnpm test:distro,pnpm test:tty, andpnpm test:apipass.Thanks for unkernel. Running a real Linux with networking in a browser tab is really impressive. Happy to adjust anything, or feel free to apply it your own way.