P_CANDEBUG(9)
π P_CANDEBUG π
okay so bestie, this is a kernel developer's manual page, and we're talking about p_candebug β literally the function that answers the question every nosy process asks: can I peek at you tho? πβ¨
πΈ NAME πΈ
p_candebug β determine debuggability of a process
like, is this process debug-able or not, that's the whole vibe check π«Ά
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/proc.h>
int
p_candebug(struct thread *td, struct proc *p);
two args, one int back, no drama π
π¦ DESCRIPTION π¦
This function can be used to determine if a given process p is debuggable by the thread td.
that's it. that's the whole thing. you hand it a thread and a process, and it tells you whether that thread is allowed to debug that process. no cap. π₯
π SYSCTL VARIABLES π
These sysctl(8) variables directly influence the behaviour of p_candebug() β like, they are the main characters here, they run the show π
kern.securelevelβ Debugging of theinitprocess is not allowed if this variable is1or greater. so if you cranked this up, hands offinit, bestie, she's protected π‘οΈsecurity.bsd.unprivileged_proc_debugβ Must be set to a non-zero value to allow unprivileged processes access to the kernel's debug facilities. if this is0, unprivileged girlies are locked out of the debug party π
β RETURN VALUES β
The p_candebug() function returns 0 if the process denoted by p is debuggable by thread td, or a non-zero error return value otherwise.
so: 0 = yes queen, go debug π, non-zero = nope, and the number tells you why π
π ERRORS π
[EACCESS]β The MAC subsystem denied debuggability.[EAGAIN]β Processpis in the process of beingexec()'ed. like she's mid-transformation, give her a sec π§[EPERM]β Threadtdlacks super-user credentials and processpis executing a set-user-ID or set-group-ID executable.[EPERM]β Threadtdlacks super-user credentials and processp's group set is not a subset oftd's effective group set.[EPERM]β Threadtdlacks super-user credentials and processp's user IDs do not match threadtd's effective user ID.[EPERM]β Processpdenotes the initial processinitproc()and thesysctl(8)variablekern.securelevelis greater than zero.[ESRCH]β Processpis not visible to threadtdas determined bycr_seeotheruids(9)orcr_seeothergids(9).[ESRCH]β Threadtdhas been jailed and processpdoes not belong to the same jail astd.[ESRCH]β The MAC subsystem denied debuggability.
ngl there's a whole lot of [EPERM] up in here and yes, they are different reasons, don't merge them in your head, bestie, each one is its own little lore drop π
π SEE ALSO π
jail(2), sysctl(8), cr_seeothergids(9), cr_seeotheruids(9), mac(9), p_cansee(9), prison_check(9)
go read those too, iykyk πβ¨
and that's the whole page, periodt π
this one came from the Debian crew, dated November 19, 2006 β yeah she's an oldie but a goodie, vintage kernel lore fr fr ππ¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms