mac_veriexec_proc_check_debug对应mpo_proc_check_debug槽位,其功能为:Check if a process is allowed to be debugged. If a process is not flagged with **VERIEXEC_NOTRACE**, then debugging is allowed:
/** * @internal * @brief Check if the requested process can be debugged * * @param cred credentials to use * @param p process to debug * * @return 0 if debugging is allowed, otherwise an error code. */ staticint mac_veriexec_proc_check_debug(struct ucred *cred, struct proc *p) { int error, flags;
/* If we are not enforcing veriexec, nothing for us to check */ if ((mac_veriexec_state & VERIEXEC_STATE_ENFORCE) == 0) return (0);
root@ns# sysctl -a | grep veriexec device veriexec security.mac.veriexec.algorithms: SHA256 security.mac.veriexec.state: security.mac.veriexec.debug: 0 root@ns# gdb /bin/ls GNU gdb (GDB) 10.1 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty"for details. This GDB was configured as "x86_64-unknown-freebsd11.4". Type "show configuration"for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>.
For help, type"help". Type "apropos word" to search for commands related to "word"... Reading symbols from /bin/ls... (No debugging symbols found in /bin/ls) (gdb) start Function "main" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Temporary breakpoint 1 (-qualified main) pending. Starting program: /bin/ls .nsva .version configdb nsconfig .snap boot dm0.img secboot .testing boot.config ns-14.1-47.46.gz [Inferior 1 (process 9857) exited normally] (gdb)