Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing parker PDEATHSIG to SIGKILL #49207

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/srv/reexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ func (o *osWrapper) newParker(ctx context.Context, credential syscall.Credential
}

// Perform OS-specific tweaks to the command.
reexecCommandOSTweaks(cmd)
parkerCommandOSTweaks(cmd)

if err := cmd.Start(); err != nil {
return trace.Wrap(err)
Expand Down
11 changes: 11 additions & 0 deletions lib/srv/reexec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ func reexecCommandOSTweaks(cmd *exec.Cmd) {
}
}

// if we ever need to run parkers on macOS or other platforms with no PDEATHSIG
// we should rework the parker to block on a pipe so it can exit when its parent
// is terminated
func parkerCommandOSTweaks(cmd *exec.Cmd) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a matching no-op function in reexec_other.go.

reexecCommandOSTweaks(cmd)

// parker processes can leak if their PDEATHSIG is SIGQUIT, otherwise we
// could just use reexecCommandOSTweaks
cmd.SysProcAttr.Pdeathsig = syscall.SIGKILL
}

func userCommandOSTweaks(cmd *exec.Cmd) {
if cmd.SysProcAttr == nil {
cmd.SysProcAttr = new(syscall.SysProcAttr)
Expand Down
2 changes: 2 additions & 0 deletions lib/srv/reexec_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (

func reexecCommandOSTweaks(cmd *exec.Cmd) {}

func parkerCommandOSTweaks(cmd *exec.Cmd) {}

func userCommandOSTweaks(cmd *exec.Cmd) {}

func setNeutralOOMScore() error { return nil }
Loading