mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
[TOB-K8S-027] Fix Incorrect isKernelPid check
isKernelPid should explicitly check the error returned from os.Readlink and return true only if the error value is ENOENT. Without this fix, if Readlink returned say ENAMETOOLONG or EACESS, we would still count the process as a kernel process (which is not true).
This commit is contained in:
parent
1e962072f1
commit
bd925d6611
@ -888,7 +888,7 @@ func ensureSystemCgroups(rootCgroupPath string, manager *fs.Manager) error {
|
||||
func isKernelPid(pid int) bool {
|
||||
// Kernel threads have no associated executable.
|
||||
_, err := os.Readlink(fmt.Sprintf("/proc/%d/exe", pid))
|
||||
return err != nil
|
||||
return err != nil && os.IsNotExist(err)
|
||||
}
|
||||
|
||||
func (cm *containerManagerImpl) GetCapacity() v1.ResourceList {
|
||||
|
Loading…
Reference in New Issue
Block a user