Skip to content

Instantly share code, notes, and snippets.

@EJSohn
Created April 28, 2019 11:13
Show Gist options
  • Save EJSohn/aab719aeae9bc0638f0c883a5ec98f0d to your computer and use it in GitHub Desktop.
Save EJSohn/aab719aeae9bc0638f0c883a5ec98f0d to your computer and use it in GitHub Desktop.
/*
* Superuser processes are usually more important, so we make it
* less likely that we kill those.
*/
if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_ADMIN) ||
p->uid == 0 || p->euid == 0)
points /= 4;
/*
* We don't want to kill a process with direct hardware access.
* Not only could that mess up the hardware, but usually users
* tend to only have this flag set on applications they think
* of as important.
*/
if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO))
points /= 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment