mirror of
https://github.com/tailscale/tailscale.git
synced 2026-06-06 21:01:11 +08:00
The earlier SIGHUP work signalled cmd.Process.Pid, which is the
incubator. The user's shell is a grandchild and never saw the
signal, so any HUP-trapping cleanup the user installed was silently
skipped.
- newIncubatorCommand sets Setpgid:true so the incubator and any
children it spawns share a process group. The PTY path overrides
this in startWithPTY with Setsid, which also creates a new pgrp,
so PTY sessions get the property without further changes.
- new helper terminateSession (per-OS) sends the signal to the
negated PID so the kernel delivers it to every process in the
group; ESRCH maps to nil because that just means the session
already exited.
- plan9 lacks Unix-style process groups, so terminateSession there
falls back to Process.Signal.
- killProcessOnContextDone routes through terminateSession and
logs any error.
TestIntegrationSIGHUP was also broken: t.TempDir creates a
/tmp/<TestName>/NNN pair, both root-owned, with the parent at 0700
and the leaf at 0755. The incubator drops privileges to the test
user before running the trap, so the > redirect couldn't traverse
the parent or write the leaf; the trap fired but left no marker.
chmod the parent to 0755 and the leaf to 0777 so the dropped
shell can reach and write it. Cleanup stays with t.TempDir.
Updates #18256
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
|
||
|---|---|---|
| .. | ||
| testcontainers | ||
| accept_env_test.go | ||
| accept_env.go | ||
| auditd_linux_test.go | ||
| auditd_linux.go | ||
| c2n.go | ||
| hostkeys_test.go | ||
| hostkeys.go | ||
| incubator_linux.go | ||
| incubator_plan9.go | ||
| incubator.go | ||
| privs_test.go | ||
| tailssh_exitcodes_test.go | ||
| tailssh_integration_exitcodes_test.go | ||
| tailssh_integration_test.go | ||
| tailssh_test.go | ||
| tailssh.go | ||
| user.go | ||