PR_SET_NO_NEW_PRIVS(2const)
π PR_SET_NO_NEW_PRIVS β bestie's guide to the vibe-locking privilege switch π
okay so this is a page from the prctl(2) family, and it lives in the land of "let me lock my own vibes in place forever." Welcome to it. πΈ
β¨ NAME β¨
PR_SET_NO_NEW_PRIVS β sets the calling thread's no_new_privs attribute. That's it, that's the whole job, and it does it permanently. π
π LIBRARY π
Standard C library β that's libc, a.k.a. -lc. The classics. π
π«Ά SYNOPSIS π«Ά
#include <linux/prctl.h> /* Definition of PR_* constants */
#include <sys/prctl.h>
int prctl(PR_SET_NO_NEW_PRIVS, 1L, 0L, 0L, 0L);
look at that. Notice how the second argument is literally just 1L. That's not a coincidence, that's the whole plot. π
π DESCRIPTION π
So you're setting the calling thread's no_new_privs attribute. Cute. Here's the tea: once no_new_privs is set to 1, execve(2) makes a promise β it won't grant you privileges to do anything that couldn't already have been done without that execve(2) call. Which honestly? Iconic behavior.
What does that promise actually kill, you ask? Things like the set-user-ID and set-group-ID mode bits, and file capabilities β all rendered non-functional. π Yeah. They just stop working for you. That's the point.
and here's the part that lowkey changes your whole life: once no_new_privs is set, it cannot be unset. There is no undo. No take-backs. No "wait bestie let me reconsider." π¨
The setting of this attribute gets inherited by children created by fork(2) and clone(2), and it's preserved across execve(2). So it travels with you. It's a lifestyle. π¦
β RETURN VALUE β
- On success,
0is returned. slay. - On error,
-1is returned, anderrnois set to indicate the error. π
π ERRORS π
EINVALβ the second argument is not equal to1L. Like, read the room. It has to be1L. Nothing else. Not1, not2, not a vibe.1L. periodt. β¨
π FILES π
/proc/pid/statusβ since Linux 4.10, you can peek at a thread'sno_new_privsattribute by looking at theNoNewPrivsfield in this file. Stalker mode: activated. π
π STANDARDS π
Linux. That's the standard. Just Linux. π§
π°οΈ HISTORY π°οΈ
Linux 3.5. A classic from the archives. Old enough to be iconic, young enough to still be relevant. π
π₯ SEE ALSO π₯
prctl(2), PR_GET_NO_NEW_PRIVS(2const), seccomp(2)
(yeah PR_GET_NO_NEW_PRIVS exists, so you can read it back β you just can't flip it off. iykyk π
)
For more info, go read the kernel source file Documentation/userspace-api/no_new_privs.rst. Go on, it's right there.
omg and for the receipts: this whole thing is from Linux man-pages 6.20, dated 2026-02-08, and it's the PR_SET_NO_NEW_PRIVS(2const) page. stay safe out there, and remember β you can set it, but you can never set it back. πβ¨π«Ά
π¦ 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
- Copyright 2012-2015, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms