P_CANDEBUG(9)
π NAME π
okay so bestie, P_CANDEBUG(9) is the Kernel Developer's Manual page for p_candebug β literally determine debuggability of a process. π
β¨
π SYNOPSIS π
#include <sys/param.h>
#include <sys/proc.h>
int
p_candebug(struct thread *td, struct proc *p);
π DESCRIPTION π
So this function determines if a given process p is debuggable by some thread td. That's the whole vibe check: can td debug p, yes or no? π
The following sysctl(8) variables directly influence the behaviour of p_candebug():
security.bsd.unprivileged_proc_debugβ must be set to a non-zero value to allow unprivileged processes access to the kernel's debug facilities. πkern.securelevelβ debugging of theinitprocess is not allowed if this variable is1or greater. π«
Other such variables indirectly influence it; see cr_bsd_visible(9). π«Ά
π 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. Slay when it's 0, sigh when it's not. π
π ERRORS π
if the vibe check fails, here are the error returns β and yes, every single one is iconic and included:
[EPERM]β an unprivileged process attempted to debug another process but the system is configured to deny it (seesysctl(8)variablesecurity.bsd.unprivileged_proc_debugabove). π«[ESRCH]β Threadtdhas been jailed and the process to debug does not belong to the same jail or one of its sub-jails, as determined byprison_check(9). π[ESRCH]βcr_bsd_visible(9)denied visibility according to the BSD security policies in force. π[EPERM]β Threadtdlacks superuser credentials and its (effective) group set is not a superset of processp's whole group set (including real, effective and saved group IDs). π[EPERM]β Threadtdlacks superuser credentials and its (effective) user ID does not match all user IDs of processp. πͺͺ[EPERM]β Threadtdlacks superuser credentials and processpis executing a set-user-ID or set-group-ID executable. β οΈ[EPERM]β Processpdenotes the initial processinitproc()and thesysctl(8)variablekern.securelevelis greater than zero. π§¨[EBUSY]β Processpis in the process of beingexec()'ed. β³[EPERM]β Processpdenied debuggability (seeprocctl(2), commandPROC_TRACE_CTL). π
π SEE ALSO π
mwah π this page was served by Debian, dated August 18, 2023, and its whole title is P_CANDEBUG(9) β bye bestie, go debug responsibly! πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
- Copyright (c) 2023 Olivier Certner <olce.freebsd@certner.fr>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms