freebsd-nq/sys/security
Mark Johnston cab1056105 kdb: Modify securelevel policy
Currently, sysctls which enable KDB in some way are flagged with
CTLFLAG_SECURE, meaning that you can't modify them if securelevel > 0.
This is so that KDB cannot be used to lower a running system's
securelevel, see commit 3d7618d8bf.  However, the newer mac_ddb(4)
restricts DDB operations which could be abused to lower securelevel
while retaining some ability to gather useful debugging information.

To enable the use of KDB (specifically, DDB) on systems with a raised
securelevel, change the KDB sysctl policy: rather than relying on
CTLFLAG_SECURE, add a check of the current securelevel to kdb_trap().
If the securelevel is raised, only pass control to the backend if MAC
specifically grants access; otherwise simply check to see if mac_ddb
vetoes the request, as before.

Add a new secure sysctl, debug.kdb.enter_securelevel, to override this
behaviour.  That is, the sysctl lets one enter a KDB backend even with a
raised securelevel, so long as it is set before the securelevel is
raised.

Reviewed by:	mhorne, stevek
MFC after:	1 month
Sponsored by:	Juniper Networks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37122
2023-03-30 10:45:00 -04:00
..
audit vfs: retire KERN_VNODE 2023-03-17 16:21:45 +00:00
mac kdb: Modify securelevel policy 2023-03-30 10:45:00 -04:00
mac_biba IfAPI: Add if_get/setmaclabel() and use it. 2023-01-31 15:02:15 -05:00
mac_bsdextended
mac_ddb mac_ddb: Fix the show rman validator. 2022-08-12 10:20:05 -07:00
mac_ifoff IfAPI: Add if_get/setmaclabel() and use it. 2023-01-31 15:02:15 -05:00
mac_lomac IfAPI: Add if_get/setmaclabel() and use it. 2023-01-31 15:02:15 -05:00
mac_mls IfAPI: Add if_get/setmaclabel() and use it. 2023-01-31 15:02:15 -05:00
mac_none
mac_ntpd
mac_partition
mac_pimd mac_pimd: Support for privilege drop in pimd 2022-04-20 08:07:37 +02:00
mac_portacl
mac_priority Thread creation privilege for realtime group 2021-12-15 00:01:58 +02:00
mac_seeotheruids
mac_stub mac: kdb/ddb framework hooks 2022-07-18 22:06:13 +00:00
mac_test mac: kdb/ddb framework hooks 2022-07-18 22:06:13 +00:00
mac_veriexec veriexec: Improve comments 2023-03-14 23:00:16 -06:00
mac_veriexec_parser mac_veriexec_parser: fix build after 7e1d3eefd4. 2022-09-09 14:09:08 +02:00