opnsense-src/tests/sys
Mark Johnston 8635c1ad51 shm: Respect PROT_MAX when creating private mappings
We were previously unconditionally adding PROT_WRITE to the maxprot of
private mapping (because a private mapping can be written even if the
fd is read-only), but this might violate the user's PROT_MAX request.

While here, rename cap_maxprot to max_maxprot.  This is the intersection
of the maximum protections imposed by capsicum rights on the fd (not
really relevant for private mappings) and the user-required maximum
protections (which were not being obeyed).  In particular, cap_maxprot
is a misnomer after the introduction of PROT_MAX.

Add some regression test cases.  mmap__maxprot_shm fails without this
patch.

Note: Capsicum's CAP_MMAP_W is a bit ambiguous.  Should it be required
in order to create writeable private mappings?  Currently it is, even
though such mappings don't permit writes to the object referenced by the
fd.

Reported by:	brooks
Reviewed by:	brooks
MFC after:	1 month
Fixes:		c7841c6b8e ("Relax restrictions on private mappings of POSIX shm objects.")
Differential Revision:	https://reviews.freebsd.org/D46741

(cherry picked from commit 33c2c58f0a3db0a6d3996fa14ac7967274678771)
2024-11-04 15:38:35 +00:00
..
acl Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
aio Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
audit Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
auditpipe Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
cam ctl: add tests for PREVENT ALLOW MEDIUM REMOVAL 2024-09-19 14:24:02 -06:00
capsicum capsicum tests: Serialize functional tests 2024-09-20 11:39:16 +00:00
cddl zfsd: replace vdevs with the AUX faulted state 2024-10-31 08:00:32 -06:00
common vnet tests: verify that we can load if_epair and if_bridge 2024-08-22 21:01:33 +02:00
compat32 tests: Don't recurse into sys/compat32 2023-05-16 02:06:34 +01:00
devrandom Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
fifo Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
file path_test: fix cap_rights_init usage 2024-03-22 09:30:32 -04:00
fs fusefs: fix an uninitialized memory access in fuse_vnop_deallocate 2024-10-10 12:48:39 -06:00
geom geli tests: Work around a missing MFC 2024-10-15 13:35:59 +00:00
kern tests: Add some test cases for SO_SPLICE 2024-10-17 15:48:37 +00:00
kqueue kqueue tests: Add a regression test 2024-02-11 10:14:44 -05:00
mac Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00
mqueue Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
net if_ovpn tests: allow these tests to run in parallel 2024-10-17 13:45:35 +00:00
netgraph Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
netinet netinet tests: Make some tests more reliable when run in parallel 2024-10-17 13:45:45 +00:00
netinet6 netinet tests: Make some tests more reliable when run in parallel 2024-10-17 13:45:45 +00:00
netipsec Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
netlink netlink: Add tests when adding an interface route 2024-03-14 16:27:54 +08:00
netmap Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
netpfil pf tests: disable epsv for the ftp proxy test 2024-10-21 14:51:36 +02:00
opencrypto Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00
pjdfstest Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
posixshm shm: Respect PROT_MAX when creating private mappings 2024-11-04 15:38:35 +00:00
ses Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
sound sound tests: Add SNDSTIOC_ADD_USER_DEVS test 2024-08-26 16:52:02 +03:00
sys bitstring: Support large bit strings. 2023-12-13 17:41:48 +01:00
vfs Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
vm shm: Respect PROT_MAX when creating private mappings 2024-11-04 15:38:35 +00:00
vmm spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
Makefile ctl: add some ATF tests for READ BUFFER 2024-09-04 15:00:20 +00:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.inc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00