projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f2a2e60
)
pidref: we never have to verify PID 1
author
Lennart Poettering
<lennart@poettering.net>
Mon, 16 Oct 2023 21:11:58 +0000
(23:11 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 18 Oct 2023 12:39:33 +0000
(14:39 +0200)
The process exists as long as the kernel/userns exists at all, hence we
don't have to verify a pidfd to it.
src/basic/pidref.c
patch
|
blob
|
history
diff --git
a/src/basic/pidref.c
b/src/basic/pidref.c
index db58a3d809d61e5f2ac8ea689273ec292be8d4dd..3e37cce0ccd8ae891acda84148e6277695667151 100644
(file)
--- a/
src/basic/pidref.c
+++ b/
src/basic/pidref.c
@@
-250,6
+250,9
@@
int pidref_verify(const PidRef *pidref) {
if (!pidref_is_set(pidref))
return -ESRCH;
+ if (pidref->pid == 1)
+ return 1; /* PID 1 can never go away, hence never be recycled to a different process → return 1 */
+
if (pidref->fd < 0)
return 0; /* If we don't have a pidfd we cannot validate it, hence we assume it's all OK → return 0 */