PR_GET_NO_NEW_PRIVS(2const)

πŸ’… PR_GET_NO_NEW_PRIVS(2const) πŸ’…

okay bestie, welcome to the PR_GET_NO_NEW_PRIVS page from the <linux/prctl.h> const-adjacent universe β€” this is a 2const page, so it's one of those little focused blorbos that lives alongside its sibling prctl(2) pages 🫢


✨ NAME ✨

PR_GET_NO_NEW_PRIVS β€” get the calling thread's no_new_privs attribute

no cap, that's literally it. you asking, kernel answering, no drama 🌸


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc)

yep, plain ol' libc, nothing exotic, we love that for us πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(PR_GET_NO_NEW_PRIVS, 0L, 0L, 0L, 0L);

not me passing four 0Ls like a little ritual πŸ•―οΈ they're all just zero, bestie, they're placeholders. prctl() has a fixed five-argument shape and this operation only cares about arg number one, so the rest are filler ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So like. This one returns the value of the no_new_privs attribute for the calling thread. That's it. That's the whole plot πŸ‘‘

And the value it hands back is a boolean, so let's vibe check the two possible readings:

  • 0 β€” this means the regular execve(2) behavior. everything normal, no extra restrictions riding along.
  • 1 β€” this means execve(2) will operate in the privilege-restricting mode described over in PR_SET_NO_NEW_PRIVS(2const).

like, 1 is the "we locked it down" reading and 0 is the "we did not" reading. simple. iconic. periodt πŸ’…

hot tip: if you want the full lore on what that privilege-restricting mode actually does and how to turn it ON, go read PR_SET_NO_NEW_PRIVS(2const) β€” this page is just the getter, it's the reader, not the writer ✨


πŸ‘‘ RETURN VALUE πŸ‘‘

On success, PR_GET_NO_NEW_PRIVS returns the boolean value described above (so, 0 or 1, you know the drill).

On error, -1 is returned, and errno is set to indicate the error. classic. 😭


πŸ“ FILES πŸ“

  • /proc/pid/status β€” since Linux 4.10, the value of a thread's no_new_privs attribute can be viewed via the NoNewPrivs field in this file.

ngl, peeking at NoNewPrivs in /proc/pid/status is the low-key way to check on a running thing without calling anything. absolutely obsessed with a file-based side quest 🌈


⭐ STANDARDS ⭐

Linux.

just Linux. she's Linux-only and she knows it πŸ’œ


🌸 HISTORY 🌸

Linux 3.5.

so she's been around since 3.5, an elder statesman of a tiny getter, respect 🫢


πŸ”₯ SEE ALSO πŸ”₯


⚠️ real talk though: this page documents a getter. The 0 vs 1 meaning only fully clicks once you've read PR_SET_NO_NEW_PRIVS(2const), so don't skip your homework, bestie 😀

and that's the whole page, mwah πŸ’‹ this was Linux man-pages version 6.20, dated 2026-02-08 β€” tysm for reading, go forth and get your no_new_privs responsibly πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms