PR_CAPBSET_DROP(2const)
π PR_CAPBSET_DROP β the prctl(2) const page, bestie edition β¨
okay so quick vibe check: this is PR_CAPBSET_DROP(2const), one of the prctl(2) operations, and it lives in the Standard C library (libc, link it with -lc). it's giving "security lock down era" and honestly? iconic. π
β¨ NAME β¨
PR_CAPBSET_DROP β drop a capability from the calling thread's capability bounding set π¦
like, you're literally telling the kernel "yeah no, take that one away from me and everyone who comes after me."
π LIBRARY π
Standard C library (libc, -lc) π
so like, normal libc stuff, no weird extra library to hunt down, periodt.
πΈ SYNOPSIS πΈ
#include <linux/prctl.h> /* Definition of PR_* constants */
#include <sys/prctl.h>
int prctl(PR_CAPBSET_DROP, long cap);
see how cap is a long? yeah. it's a long. we don't make the rules, we just inherit them from the kernel. π
π DESCRIPTION π
okay so the main character move here: you call prctl() with PR_CAPBSET_DROP, and you hand it cap β the capability you want gone. the kernel drops that capability specified by cap from the calling thread's capability bounding set. bye bestie, you will not be missed π
and here's the part that lowkey matters the most: any children of the calling thread will inherit the newly reduced bounding set.
like. the reduced one. not the old one. so if you were hoping to pop out a child process with the capability you just dropped? not happening. the vibe is permanently downgraded for the whole bloodline, fr fr. π«Ά
π₯ RETURN VALUE π₯
- On success,
0is returned. slay, we love a zero. β¨ - On error,
-1is returned, anderrnois set to indicate the error. not slay, but at leasterrnotells you what went wrong. π
π ERRORS π
EINVALβ File capabilities are not enabled in the kernel. so the whole feature is just... off? not a you problem, a kernel config problem.EINVALβ cap does not specify a valid capability. you passed a number that isn't a real capability. that's not a capability, that's just a number, bestie. πEPERMβ The caller does not have theCAP_SETPCAPcapability. you needCAP_SETPCAPto even play this game. main character energy requires main character permissions. π
π¦ VERSIONS π¦
good news: if this low-level thing feels like a lot (it is, a little), there's a glow-up version. a higher-level interface layered on top of this operation is provided in the libcap(3) library, in the form of cap_drop_bound(3). so like, same energy, nicer wrapping paper π
π STANDARDS π
Linux. that's it. that's the whole standard. π§
π HISTORY π
Linux 2.6.25. ancient in internet years, still serving. β¨
π SEE ALSO π
prctl(2), PR_CAPBSET_READ(2const), libcap(3), cap_drop_bound(3)
ngl if you're doing anything serious with this, go read PR_CAPBSET_READ(2const) too, because knowing what's still in the bounding set is kind of the whole point. iykyk π§
okay that's the page!! mwah π this was brought to you by Linux man-pages 6.20, dated 2026-02-08 β go forth and drop those capabilities responsibly, bestie, and don't forget that CAP_SETPCAP check. periodt. ππ¦πΈ
π¦ 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 2008-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