FreeBSD/src f5fce0bsys/kern kern_exec.c

kern_exec.c: explicitly include sys/limits.h for UINT_MAX

While there, remove unneeded manual inclusion of sys/cdefs.h.

Fixes:  e1a84b7708c2 ("execve_block(): a mechanism for mutual exclusion with execve() on the process")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+1-1sys/kern/kern_exec.c
+1-11 files

FreeBSD/src f6b3bd1tests/sys/sound mmap.c

sound tests: Remove trailing PROT_EXEC

Fixes:          730eaf466493 ("sound tests: Add PROT_EXEC rejection test")
Reported by:    Oliver Pinter <oliver.pntr at gmail.com>
Sponsored by:   The FreeBSD Foundation
MFC after:      6 days
DeltaFile
+1-1tests/sys/sound/mmap.c
+1-11 files

FreeBSD/src c7e5802sys/amd64/amd64 exception.S

amd64: do not restore fsbase/gsbase for 32bit processes

There is no WRFSBASE and WRGSBASE 32bit variants at all. As such, the
fsbase and gsbase must always be equal to the bases in the corresponding
segment descriptor, same as on real i386.

If a 32bit program reloads either %fs or %gs using setcontext(9) or
sigreturn(9), restoring bases from the syscall entry time is wrong.
In all other cases, hardware already does the right action when the
segment register is loaded, and the bases for the ufssel/ugssel in GDT
are updated on the context switch.

Reviewed by:    markj (previous version)
Tested by:      terehovv at mail.ru
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57611
DeltaFile
+31-0sys/amd64/amd64/exception.S
+31-01 files

FreeBSD/src 5db31f1sys/compat/linprocfs linprocfs.c, sys/fs/procfs procfs_map.c procfs_mem.c

procfs, linprocfs: ensure target process vmspace stability

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+7-10sys/fs/procfs/procfs_map.c
+5-11sys/compat/linprocfs/linprocfs.c
+1-5sys/fs/procfs/procfs_mem.c
+13-263 files

FreeBSD/src d0384f5sys/kern kern_prot.c

sys_set*id(9): wait for the execblocks to pass

to ensure stability of the process uid/gids during the
p_cansee()/p_candebug()-protected regions.

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+10-0sys/kern/kern_prot.c
+10-01 files

FreeBSD/src e41c28esys/compat/linux linux_misc.c

linux_prlimit(): block execve for the target

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+15-0sys/compat/linux/linux_misc.c
+15-01 files

FreeBSD/src 5a91fa5sys/kern kern_proc.c

kern_proc.c: disallow execve around sysctl kern.proc.rlimit

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  htts://reviews.freebsd.org/D57497
DeltaFile
+16-10sys/kern/kern_proc.c
+16-101 files

FreeBSD/src 31fa677sys/kern kern_proc.c

kern_proc.c: ensure stability of the vmspace for sysctl kern.proc.vm_layout

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+10-2sys/kern/kern_proc.c
+10-21 files

FreeBSD/src 4c0a090sys/fs/pseudofs pseudofs_vnops.c

pfs_readdir(): block the target process from execing

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+9-1sys/fs/pseudofs/pseudofs_vnops.c
+9-11 files

FreeBSD/src 8367498sys/kern kern_resource.c

kern_resource.c: disallow execve around sysctl kern.proc.rlimitusage

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  htts://reviews.freebsd.org/D57497
DeltaFile
+19-8sys/kern/kern_resource.c
+19-81 files

FreeBSD/src 8b5abd9sys/kern kern_proc.c

kern_proc.c: disallow execve around sysctl kern.proc.kstacks

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  htts://reviews.freebsd.org/D57497
DeltaFile
+16-12sys/kern/kern_proc.c
+16-121 files

FreeBSD/src 80626f3sys/kern kern_proc.c

kern_proc.c: make kern.proc.osrel atomic

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+22-23sys/kern/kern_proc.c
+22-231 files

FreeBSD/src a4993basys/fs/pseudofs pseudofs_vnops.c

pseudofs: ensure that the target process vmspace is stable for VOP_READ/WRITE

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+41-18sys/fs/pseudofs/pseudofs_vnops.c
+41-181 files

FreeBSD/src 6a57292sys/kern kern_procctl.c

kern_procctl(PROC_WX_MAPPINGS_PERMIT): ensure stability of the target vmspace

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+14-7sys/kern/kern_procctl.c
+14-71 files

FreeBSD/src 79b384bsys/kern kern_event.c

kern_event: block the target process from execing for sysctl kern.proc.kqueue

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+17-5sys/kern/kern_event.c
+17-51 files

FreeBSD/src e1b0d05sys/fs/cuse cuse.c, sys/fs/procfs procfs_mem.c

proc: Allow to make proc_rwmem() operate on a consistent address space

Provide proc_vmspace_ref() to safely obtain the reference to the target
process vmspace, optionally
- requiring that the target cannot execve(2) and thus cannot change its
  vmspace until vmspace in unreferenced
- requiring the check of permissions of the caller after the vmspace
  reference is obtained, since the process lock might have been dropped
  in the process.

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+107-20sys/kern/sys_process.c
+14-1sys/sys/ptrace.h
+5-5sys/kern/kern_prot.c
+2-2sys/fs/cuse/cuse.c
+1-1sys/fs/procfs/procfs_mem.c
+129-295 files

FreeBSD/src 5fe6e08sys/kern kern_proc.c

kern_proc.c: ensure stability of the vmspace for sysctl kern.proc.vmmap

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+12-8sys/kern/kern_proc.c
+12-81 files

FreeBSD/src e1a84b7sys/kern kern_exec.c kern_thread.c, sys/sys imgact.h proc.h

execve_block(): a mechanism for mutual exclusion with execve() on the process

A consumer of execve_block(9) is synchorized with the execution of
execve(2) family of syscalls, ensuring that execve_block region is
mutually exclusive with the execve processing. Either execve_block() or
execve() would sleep until other finishes.

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+67-2sys/kern/kern_exec.c
+2-2sys/kern/kern_thread.c
+3-0sys/sys/imgact.h
+2-1sys/sys/proc.h
+1-0sys/kern/kern_exit.c
+75-55 files

FreeBSD/src a22c044sys/kern kern_proc.c

kern_proc.c: ensure stability of the vmspace we read the strings from

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+38-22sys/kern/kern_proc.c
+38-221 files

FreeBSD/src 450fe67sys/kern kern_exec.c, sys/sys imgact.h

execve_block_pass(9): a helper to wait for the execblock to pass

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57497
DeltaFile
+16-4sys/kern/kern_exec.c
+1-0sys/sys/imgact.h
+17-42 files

FreeBSD/src 9f9f0d3lib/libc/net protocols

protocols: Update with IANA list

- Update /etc/protocols with IANA list updated 2026-03-09.
- Document that 240 (pfsync) is not assigned by IANA.
- Document deprecated protocols.

PR:             295739
Reviewed by:    des
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D57445

(cherry picked from commit e3fa020202d8e040242016bda275dde83c058549)
DeltaFile
+11-6lib/libc/net/protocols
+11-61 files

FreeBSD/src d661121lib/libc/net protocols

protocols: Update with IANA list

- Update /etc/protocols with IANA list updated 2026-03-09.
- Document that 240 (pfsync) is not assigned by IANA.
- Document deprecated protocols.

PR:             295739
Reviewed by:    des
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D57445

(cherry picked from commit e3fa020202d8e040242016bda275dde83c058549)
DeltaFile
+11-6lib/libc/net/protocols
+11-61 files

FreeBSD/src 9d43654sys/sys vnode.h rangelock.h

struct vnode: assign v_rl.resv1 as v_type and v_rl.resv2 as v_state

(cherry picked from commit da6aa0648c0265d6f7bcba44a26f13ed0453dd7a)
DeltaFile
+8-2sys/sys/vnode.h
+4-0sys/sys/rangelock.h
+12-22 files

FreeBSD/src b8044a0sys/kern vfs_subr.c, sys/sys vnode.h mount.h

vnode: move VIRF_KNOTE to v_v2flag

(cherry picked from commit 64467d2ec3ede11430554fea68b317d27bf4b5c3)
DeltaFile
+4-3sys/sys/vnode.h
+2-3sys/kern/vfs_subr.c
+2-2sys/sys/mount.h
+8-83 files

FreeBSD/src ce6cc3bsys/sys mount.h

sys/mount.h: restore KNF_NOKQLOCK in VFS_KNOTE_{,UN}LOCKED() call to KNOTE()

(cherry picked from commit 43a8585cb2bb0e284df672174a57780e53107d27)
DeltaFile
+4-4sys/sys/mount.h
+4-41 files

FreeBSD/src eb810besys/sys rangelock.h

sys/rangelock.h: explicitly enumerate padding at the end of the structure

(cherry picked from commit 3d505310b1bb259c3e5f39d8c88a465cf1403934)
DeltaFile
+6-0sys/sys/rangelock.h
+6-01 files

FreeBSD/src d56df1fsys/sys vnode.h

sys/vnode.h: remove stale comment

(cherry picked from commit 5e4947f7e08a90ba50f9e8cea9ae5e128717cb5f)
DeltaFile
+0-1sys/sys/vnode.h
+0-11 files

FreeBSD/src c20d129sys/amd64/amd64 genassym.c, sys/i386/i386 genassym.c

x86: remove sys/mount.h from genassym.c

(cherry picked from commit 72ab129799a231e322b119de3f9c1263e76527b8)
DeltaFile
+0-3sys/amd64/amd64/genassym.c
+0-3sys/i386/i386/genassym.c
+0-62 files

FreeBSD/src 18c08fdsys/kern vfs_subr.c

vop_read_pgcache_post(): the vnode is unlocked

(cherry picked from commit 0c85df0065146516d5bacfc80d52d9ee6b33b96d)
DeltaFile
+1-1sys/kern/vfs_subr.c
+1-11 files

FreeBSD/src 5c4e88csys/sys mount.h

vfs: convert VFS_OPs from macros to static inlines

(cherry picked from commit a57420b214b04de3d066236b555925ffbcb93daa)
DeltaFile
+109-97sys/sys/mount.h
+109-971 files