mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
cgroup-util: Don't try to open pidfd for kernel threads
The kernel might start returning -EINVAL when trying to open pidfd's for kernel threads so let's not try to open pidfd's for kernel threads.
This commit is contained in:
parent
0fbb569de1
commit
ead48ec35c
@ -149,7 +149,9 @@ int cg_read_pidref(FILE *f, PidRef *ret, CGroupFlags flags) {
|
||||
if (pid == 0)
|
||||
return -EREMOTE;
|
||||
|
||||
if (FLAGS_SET(flags, CGROUP_NO_PIDFD)) {
|
||||
/* We might read kernel thread pids from cgroup.procs for which we cannot create a pidfd so
|
||||
* catch those and don't try to create a pidfd for them. */
|
||||
if (FLAGS_SET(flags, CGROUP_NO_PIDFD) || pid_is_kernel_thread(pid) > 0) {
|
||||
*ret = PIDREF_MAKE_FROM_PID(pid);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user