Open
Description
This is in specific reference to the KERN_PROCARGS2
sysctl
call that's made in this function:
That sysctl call is a little finicky, and will return a generic EINVAL
error for three main cases:
- It doesn't have permission
- It's called against a zombie process
- The PID no longer exists.
The error handling should better distinguish between these three cases. The logic will probably need to look something like this:
if EINVAL{
if not pidExists(pid) {
return "PID does not exist"
}
if our_UID() != root or our_UID() != pid.UID {
return "permission denied"
}
return "process is a zombie, skipping"
}