xref: /freebsd/share/man/man4/mac_ddb.4 (revision 271171e0d97b88ba2a7c3bf750c9672b484c1c13)
1.\" Copyright (c) 2022 Klara Systems
2.\"
3.\" This software was developed by Mitchell Horne <mhorne@FreeBSD.org>
4.\" under sponsorship from Juniper Networks and Klara Systems.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd June 29, 2022
28.Dt MAC_DDB 4
29.Os
30.Sh NAME
31.Nm mac_ddb
32.Nd "Restricted kernel debugger interface policy"
33.Sh SYNOPSIS
34To compile the ddb policy
35into your kernel, place the following lines in your kernel
36configuration file:
37.Bd -ragged -offset indent
38.Cd "options MAC"
39.Cd "options MAC_DDB"
40.Ed
41.Pp
42Alternately, to load the ddb module at boot time, place the following line
43in your kernel configuration file:
44.Bd -ragged -offset indent
45.Cd "options MAC"
46.Ed
47.Pp
48and in
49.Xr loader.conf 5 :
50.Bd -literal -offset indent
51mac_ddb_load="YES"
52.Ed
53.Sh DESCRIPTION
54The
55.Nm
56policy module implements a MAC policy which restricts the set of commands that
57can be used at the
58.Xr ddb 4
59command prompt.
60The subset of permitted commands is limited to those which do not read or write
61to arbitrary memory locations.
62This is done to deter the possible extraction of system secrets while still
63allowing enough debugger functionality to diagnose a kernel panic.
64For example, the
65.Ic trace
66or
67.Ic show registers
68commands are allowed by this policy, but
69.Ic show Cm buffer Ar addr
70is not.
71.Pp
72All debugger commands that are declared with the
73.Va DB_CMD_MEMSAFE
74flag are allowed by
75.Nm .
76The policy provides validation functions to conditionally allow some additional
77commands, based on the user provided arguments.
78.Pp
79When loaded, the
80.Nm
81policy also ensures that only the
82.Xr ddb 4
83debugger backend may be executed;
84.Xr gdb 4
85may not.
86.Ss Label Format
87No labels are defined for
88.Nm .
89.Sh SEE ALSO
90.Xr ddb 4 ,
91.Xr mac 4 ,
92.Xr mac_biba 4 ,
93.Xr mac_bsdextended 4 ,
94.Xr mac_ifoff 4 ,
95.Xr mac_lomac 4 ,
96.Xr mac_mls 4 ,
97.Xr mac_none 4 ,
98.Xr mac_partition 4 ,
99.Xr mac_portacl 4 ,
100.Xr mac_seeotheruids 4 ,
101.Xr mac_test 4 ,
102.Xr mac 9
103.Sh BUGS
104While the MAC Framework design is intended to support the containment of
105the root user, not all attack channels are currently protected by entry
106point checks.
107As such, MAC Framework policies should not be relied on, in isolation,
108to protect against a malicious privileged user.
109