]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/man/man9/p_candebug.9
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / share / man / man9 / p_candebug.9
1 .\"
2 .\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
3 .\"
4 .\" All rights reserved.
5 .\"
6 .\" This program is free software.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd November 19, 2006
31 .Dt P_CANDEBUG 9
32 .Os
33 .Sh NAME
34 .Nm p_candebug
35 .Nd determine debuggability of a process
36 .Sh SYNOPSIS
37 .In sys/param.h
38 .In sys/proc.h
39 .Ft int
40 .Fn p_candebug "struct thread *td" "struct proc *p"
41 .Sh DESCRIPTION
42 This function can be used to determine if a given process
43 .Fa p
44 is debuggable by the thread
45 .Fa td .
46 .Sh SYSCTL VARIABLES
47 The following
48 .Xr sysctl 8
49 variables directly influence the behaviour of
50 .Fn p_candebug :
51 .Bl -tag -width indent
52 .It Va kern.securelevel
53 Debugging of the init process is not allowed if this variable is
54 .Li 1
55 or greater.
56 .It Va security.bsd.unprivileged_proc_debug
57 Must be set to a non-zero value to allow unprivileged processes
58 access to the kernel's debug facilities.
59 .El
60 .Sh RETURN VALUES
61 The
62 .Fn p_candebug
63 function
64 returns
65 .Li 0
66 if the process denoted by
67 .Fa p
68 is debuggable by thread
69 .Fa td ,
70 or a non-zero error return value otherwise.
71 .Sh ERRORS
72 .Bl -tag -width Er
73 .It Bq Er EACCESS
74 The MAC subsystem denied debuggability.
75 .It Bq Er EAGAIN
76 Process
77 .Fa p
78 is in the process of being
79 .Fn exec Ns 'ed.
80 .It Bq Er EPERM
81 Thread
82 .Fa td
83 lacks super-user credentials and process
84 .Fa p
85 is executing a set-user-ID or set-group-ID executable.
86 .It Bq Er EPERM
87 Thread
88 .Fa td
89 lacks super-user credentials and process
90 .Fa p Ns 's
91 group set is not a subset of
92 .Fa td Ns 's
93 effective group set.
94 .It Bq Er EPERM
95 Thread
96 .Fa td
97 lacks super-user credentials and process
98 .Fa p Ns 's
99 user IDs do not match thread
100 .Fa td Ns 's
101 effective user ID.
102 .It Bq Er EPERM
103 Process
104 .Fa p
105 denotes the initial process
106 .Fn initproc
107 and the
108 .Xr sysctl 8
109 variable
110 .Va kern.securelevel
111 is greater than zero.
112 .It Bq Er ESRCH
113 Process
114 .Fa p
115 is not visible to thread
116 .Fa td
117 as determined by
118 .Xr cr_seeotheruids 9
119 or
120 .Xr cr_seeothergids 9 .
121 .It Bq Er ESRCH
122 Thread
123 .Fa td
124 has been jailed and process
125 .Fa p
126 does not belong to the same jail as
127 .Fa td .
128 .It Bq Er ESRCH
129 The MAC subsystem denied debuggability.
130 .El
131 .Sh SEE ALSO
132 .Xr jail 2 ,
133 .Xr sysctl 8 ,
134 .Xr cr_seeothergids 9 ,
135 .Xr cr_seeotheruids 9 ,
136 .Xr mac 9 ,
137 .Xr p_cansee 9 ,
138 .Xr prison_check 9