opnsense-src/sys
Olivier Certner 89958992b6
MAC/do: Check executable path from the current jail's root
Contrary to my initial belief, vn_fullpath() does return a vnode's path
from the current chroot, and not from the global root (which would have
been a bug also, but without security consequences).  This enables
a "confused deputy"-like scenario where a chroot(2) can change which
executable can be authorized by MAC/do, which is even more problematic
for unprivileged chroot(2).

This was found by re-examining the code following two close events:
1. Shawn Webb sent a mail to freebsd-hackers@ on 08/05 saying that in
   HardenedBSD they had added a check on P2_NO_NEW_PRIVS (in
   mac_do_priv_grant()), which I responded to on 08/20 saying that
   P2_NO_NEW_PRIVS was not necessary for mac_do(4), with a correct
   reasoning but based on the wrong above-mentioned assumption about
   vn_fullpath().
2. I reviewed some code by Kushagra Srivastava (GSoC 2025 student
   working on mac_do(4)/mdo(1)) adding the ability to specify which
   executables can spawn processes that mac_do(4) may decide to
   authorize (others are simply ignored), which currently is hardcoded
   to '/usr/bin/mdo'.

MFC after:      3 days
Event:          EuroBSDCon 2025
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52758

(cherry picked from commit 9f269a0a771aff4f0a735211907a52c52fc0661b)
2025-10-02 18:57:19 +02:00
..
amd64 amd64: add wrmsr_early_safe(9) 2025-10-01 06:00:08 +03:00
arm gpio: implement bus_setup_intr and bus_teardown_intr 2025-10-01 12:37:36 +03:00
arm64 gpio: implement bus_setup_intr and bus_teardown_intr 2025-10-01 12:37:36 +03:00
bsm
cam cam(3): Fix a common typo in source code comments 2025-08-25 10:35:01 +02:00
cddl dtrace: Use a size_t to represent a buffer size in the printm action 2025-09-30 09:43:08 +00:00
compat LinuxKPI: pci: implementation of [lkpi_]pci_get_slot() 2025-09-30 21:45:29 +00:00
conf u2f(4): Invert U2F_MAKE_UHID_ALIAS kernel build option 2025-09-27 13:25:11 +03:00
contrib libnv: Fix handling of nvlist_dump() and nvlist_send() for child nvlists 2025-09-30 09:43:08 +00:00
crypto random: Make random_source definitions const 2025-08-19 14:06:02 +00:00
ddb ddb ps: Print again the effective GID, separately 2025-09-18 10:50:22 +02:00
dev snd_hda: Implement automatic redirection between associations 2025-10-02 09:31:29 +02:00
dts
fs fusefs: fix a kernel panic regarding SCM_RIGHTS 2025-09-26 12:11:37 -06:00
gdb
geom geom: only set TDP_GEOM for user threads 2025-09-16 05:45:12 +03:00
gnu
i386 x86: directly use clflushopt mnemonic in cpufunc.h 2025-09-28 03:43:20 +03:00
isa isa: Fix a typo in a source code comment 2025-08-17 11:28:20 +02:00
kern vfs cache: Add vn_fullpath_jail(), factor out common code 2025-10-02 18:57:19 +02:00
kgssapi kgssapi: Fix the kgssapi so that it can use MIT Kerberos 2025-08-07 14:02:32 -07:00
libkern libkern: Drop incorrect qsort optimization 2025-08-16 01:23:35 +02:00
modules dtraceall: Enable kinst for aarch64 and riscv as well 2025-09-30 11:17:26 +02:00
net pf: Fix rule and state counters 2025-10-01 18:00:31 +02:00
net80211 [net80211] clean up M_SEQNO_SET and M_SEQNO_GET() to always limit to the sequence number range 2025-09-01 20:29:30 -07:00
netgraph ng_tty: copy to the correct mbuf 2025-10-01 12:37:35 +03:00
netinet tcp: refactor tcp_send_challenge_ack() 2025-09-28 11:10:00 +02:00
netinet6 ip6: add SO_BINTIME support 2025-09-29 15:03:02 +00:00
netipsec
netlink netlink: Bypass refcounting when setting promiscuity 2025-08-26 00:40:17 +02:00
netpfil pf: Fix interface counters for af-to rules 2025-10-01 18:00:47 +02:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed
opencrypto
powerpc arm, powerpc, riscv: implement atomic_set/clear_16 2025-09-28 03:43:20 +03:00
riscv vmm: Suspend the VM before destroying it 2025-09-30 09:43:08 +00:00
rpc Revert "Remove Secure RPC DES authentication" 2025-08-15 17:59:18 +01:00
security MAC/do: Check executable path from the current jail's root 2025-10-02 18:57:19 +02:00
sys vfs cache: Add vn_fullpath_jail(), factor out common code 2025-10-02 18:57:19 +02:00
teken
tests
tools vdso: Build without debug info 2025-08-22 20:50:26 +00:00
ufs ffs(3): Fix a typo in a source code comment 2025-08-25 10:37:27 +02:00
vm vm/vm_fault.c: update and split comments for vm_fault() and vm_fault_trap() 2025-09-23 03:40:33 +03:00
x86 ucode: use wrmsr_early_safe() for early CPU microcode update 2025-10-01 17:00:13 -07:00
xdr
xen
Makefile
README.md

FreeBSD Kernel Source:

This directory contains the source files and build glue that make up the FreeBSD kernel and its modules, including both original and contributed software.

Kernel configuration files are located in the conf/ subdirectory of each architecture. GENERIC is the configuration used in release builds. NOTES contains documentation of all possible entries. LINT is a compile-only configuration used to maximize build coverage and detect regressions.

Documentation:

Source code documentation is maintained in a set of man pages, under section 9. These pages are located in share/man/man9, from the top-level of the src tree. Consult intro(9) for an overview of existing pages.

Some additional high-level documentation of the kernel is maintained in the Architecture Handbook.

Source Roadmap:

Directory Description
amd64 AMD64 (64-bit x86) architecture support
arm 32-bit ARM architecture support
arm64 64-bit ARM (AArch64) architecture support
cam Common Access Method storage subsystem - cam(4) and ctl(4)
cddl CDDL-licensed optional sources such as DTrace
conf kernel build glue
compat Linux compatibility layer, FreeBSD 32-bit compatibility
contrib 3rd-party imported software such as OpenZFS
crypto crypto drivers
ddb interactive kernel debugger - ddb(4)
fs most filesystems, excluding UFS, NFS, and ZFS
dev device drivers and other arch independent code
gdb kernel remote GDB stub - gdb(4)
geom GEOM framework - geom(4)
i386 i386 (32-bit x86) architecture support
kern main part of the kernel
libkern libc-like and other support functions for kernel use
modules kernel module infrastructure
net core networking code
net80211 wireless networking (IEEE 802.11) - net80211(4)
netgraph graph-based networking subsystem - netgraph(4)
netinet IPv4 protocol implementation - inet(4)
netinet6 IPv6 protocol implementation - inet6(4)
netipsec IPsec protocol implementation - ipsec(4)
netpfil packet filters - ipfw(4), pf(4), and ipfilter(4)
opencrypto OpenCrypto framework - crypto(7)
powerpc PowerPC/POWER (32 and 64-bit) architecture support
riscv 64-bit RISC-V architecture support
security security facilities - audit(4) and mac(4)
sys kernel headers
tests kernel unit tests
ufs Unix File System - ffs(4)
vm virtual memory system
x86 code shared by AMD64 and i386 architectures