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

Unreachable on sending signal to dead process #10238

Open
Plecra opened this issue Nov 28, 2021 · 3 comments
Open

Unreachable on sending signal to dead process #10238

Plecra opened this issue Nov 28, 2021 · 3 comments
Labels
standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@Plecra
Copy link

Plecra commented Nov 28, 2021

.SRCH => unreachable, // always a race condition

Is there a way users are expected to handle this? Seems like there's no way to entirely avoid this branch when calling the function

@andrewrk andrewrk added the standard library This issue involves writing Zig code for the standard library. label Nov 29, 2021
@andrewrk andrewrk added this to the 0.11.0 milestone Nov 29, 2021
@andrewrk
Copy link
Member

This is always a race condition; if you hit this line your code has a fatal design flaw. The same pid could have been reallocated by the kernel, and you would end up sending the signal to an unrelated process.

@mrakh
Copy link
Contributor

mrakh commented Nov 30, 2021

This is always a race condition; if you hit this line your code has a fatal design flaw. The same pid could have been reallocated by the kernel, and you would end up sending the signal to an unrelated process.

What if the PID is user-supplied? What if I’m running as PID 1 in my own PID namespace and can guarantee PID allocation behavior? I expect to be able to handle a nonexistent PID gracefully.

@daurnimator
Copy link
Collaborator

This is always a race condition; if you hit this line your code has a fatal design flaw.

As much as it's a design flaw, it's required to e.g. implement the very well known kill command line tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

4 participants