FreeBSD/src a751490share/examples/sound mmap.c

sound: Adjust mmap example to use kqueue

Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D57410

(cherry picked from commit a48bbef5eb32508a8d7b3b986c9b1d28176d1694)
DeltaFile
+50-128share/examples/sound/mmap.c
+50-1281 files

FreeBSD/src 5347284share/man/man4 pcm.4, sys/dev/sound/pcm dsp.c

sound: Include more information in kevent returned from the kernel

Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D57362

(cherry picked from commit fe13f70b95a762e19c38d1152eac6312d8578f84)
DeltaFile
+76-0share/man/man4/pcm.4
+12-2sys/dev/sound/pcm/dsp.c
+88-22 files

FreeBSD/src 0665d5bsys/dev/sound/pcm dsp.c

sound: Start each channel individually

Unlock all members before starting any of them. Holding multiple channel
locks while calling chn_start() on a virtual channel can trigger the
parent, which acquires PCM_LOCK() while other virtual channels are still
locked -- a lock order reversal.

Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D57399

(cherry picked from commit 47ae0a869c7db693ffb1ac058d63dcb79c4e68a8)
DeltaFile
+19-6sys/dev/sound/pcm/dsp.c
+19-61 files

FreeBSD/src a2e72a2sbin/ipf/ippool ippool.5 ippool.8

ipfilter(4): Fix a couple of typos in the manual pages

- s/heirarchical/hierarchical/
- s/itnerface/interface/
- s/conjuction/conjunction/

(cherry picked from commit 0223ae33ad6dd29215bbb6efd041aa5b6c67dc1f)
DeltaFile
+2-2sbin/ipf/ippool/ippool.5
+1-1sbin/ipf/ippool/ippool.8
+3-32 files

FreeBSD/src 4a70a74bin/ps ps.1

ps(1): Fix a few typos in the manual page

- s/occurence/occurrence/
- s/occurences/occurrences/
- s/ouput/output/

(cherry picked from commit dd2127b54f97fd7445bb4f4187a148e979c9c944)
DeltaFile
+4-4bin/ps/ps.1
+4-41 files

FreeBSD/src f24211esbin/bectl bectl.8

bectl(8): Fix a typo in the manual page

- s/envionments/environments/

(cherry picked from commit c94302609a5999786f0be77d1bd0b016153b6b11)
DeltaFile
+1-1sbin/bectl/bectl.8
+1-11 files

FreeBSD/src de70e79sbin/ipf/ippool ippool.5 ippool.8

ipfilter(4): Fix a couple of typos in the manual pages

- s/heirarchical/hierarchical/
- s/itnerface/interface/
- s/conjuction/conjunction/

(cherry picked from commit 0223ae33ad6dd29215bbb6efd041aa5b6c67dc1f)
DeltaFile
+2-2sbin/ipf/ippool/ippool.5
+1-1sbin/ipf/ippool/ippool.8
+3-32 files

FreeBSD/src 3a27e58sbin/ggate/ggated ggated.8

ggated(8): Fix two typos in the manual page

- s/colunm/column/
- s/operaions/operations/

(cherry picked from commit e2339370737bdbebc8bd34a84f5b869da3a9ed43)
DeltaFile
+2-2sbin/ggate/ggated/ggated.8
+2-21 files

FreeBSD/src f51949dsbin/natd natd.8

natd(8): Fix a typo in the manual page

- s/appplications/applications/

(cherry picked from commit be8c82bc8e83570474afa78c07f7583bb6813046)
DeltaFile
+1-1sbin/natd/natd.8
+1-11 files

FreeBSD/src 54ab35abin/ps ps.1

ps(1): Fix a few typos in the manual page

- s/occurence/occurrence/
- s/occurences/occurrences/
- s/ouput/output/

(cherry picked from commit dd2127b54f97fd7445bb4f4187a148e979c9c944)
DeltaFile
+4-4bin/ps/ps.1
+4-41 files

FreeBSD/src 716ba5fsbin/bectl bectl.8

bectl(8): Fix a typo in the manual page

- s/envionments/environments/

(cherry picked from commit c94302609a5999786f0be77d1bd0b016153b6b11)
DeltaFile
+1-1sbin/bectl/bectl.8
+1-11 files

FreeBSD/src a8bbce0sbin/ipfw ipfw.8

ipfw(8): Fix a typo in the manual page

- s/exept/except/

(cherry picked from commit 1e36ffffe21042983304290a5742ad7e0e0ffe05)
DeltaFile
+3-3sbin/ipfw/ipfw.8
+3-31 files

FreeBSD/src 270bfa3sbin/devd devd.conf.5

devd.conf(5): Fix a typo in the manual page

- s/betwen/between/

(cherry picked from commit 050962ab04a68756b45ff967af42eb2541b0ff5f)
DeltaFile
+1-1sbin/devd/devd.conf.5
+1-11 files

FreeBSD/src 2767a1flib/libc/gen posix_spawn.c

posix_spawn(3): create a guard page below the stack for rfork_thread on x86

Reviewed by:    kevans
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57955
DeltaFile
+18-29lib/libc/gen/posix_spawn.c
+18-291 files

FreeBSD/src b516c23lib/libc/gen posix_spawn.c

do_posix_spawn(): use bool

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+3-3lib/libc/gen/posix_spawn.c
+3-31 files

FreeBSD/src 70fb92clibexec/rtld-elf map_object.c

rtld: unify the return path for map_object()

Reviewed by:    kevans
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57908
DeltaFile
+4-6libexec/rtld-elf/map_object.c
+4-61 files

FreeBSD/src 559f456libexec/rtld-elf xmalloc.c rtld.c

rtld: add spinlock around the crt malloc calls

Right now, the rtld malloc is called under the write-locked rtld bind
lock. A future change adds places where only read-locked rtld bind lock
is held, and then the spinlock protects the malloc structures from the
parallel updates.

Reviewed by:    kevans
Tested by:      Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57908
DeltaFile
+71-1libexec/rtld-elf/xmalloc.c
+0-25libexec/rtld-elf/rtld.c
+71-262 files

FreeBSD/src 1e370f0libexec/rtld-elf rtld.c map_object.c

rtld: stop using unbound alloca()

For DoneList allocations, its size depends on the number of loaded DSOs.
Small images could be served by alloca(), but large donelists need to
go into heap.

For map_object(), alloca size is the number of segments in the object.

In both cases, over-grown situations would cause a stack overflow.

PR:     295991
Noted and reviewed by:  kevans
Tested by:      Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57908
DeltaFile
+58-24libexec/rtld-elf/rtld.c
+3-1libexec/rtld-elf/map_object.c
+2-0libexec/rtld-elf/rtld.h
+63-253 files

FreeBSD/src f9a0147lib/libc/net protocols, sys/netinet in.h

protocols: remove IPPROTO_DIVERT
DeltaFile
+0-3sys/netinet/in.h
+0-1lib/libc/net/protocols
+0-42 files

FreeBSD/src bdd0c4dsys/net bpf_ifnet.c, sys/netinet6 in6_ifattach.c nd6.c

netinet6: cleanse safeguards against IFT_PFLOG

This "interface" type is no more.  Leave the constant in if_types.h, we
probably need an exp-run before removing it.
DeltaFile
+3-3sys/netinet6/in6_ifattach.c
+0-5sys/net/bpf_ifnet.c
+2-2sys/netinet6/nd6.c
+0-1sys/netinet6/in6.c
+5-114 files

FreeBSD/src bcf4e3csys/net if_loop.c

loopback: use new names for checksum offloading flags

No functional change intended.

Reviewed by:            tuexen
MFC after:              1 week
Differential Revision:  https://reviews.freebsd.org/D57945
DeltaFile
+5-6sys/net/if_loop.c
+5-61 files

FreeBSD/src 309e4f0tests/sys/mac/do consistency.sh Makefile

MAC/do: Add consistency tests

Test that:
1. Concurrent changes to different parameters on the same jail are
   independent/atomic.
2. Inheritance works.
3. Relaxing only parent jail rules does not leak to a subjail thanks to
   sequential consistency.
4. Sysctl knobs and jail parameters stay consistent.

Some of these tests may be extended in the future with several layers of
jails (there is only a single subjail currently).

Reviewed by:    bapt
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/38

(cherry picked from commit 851499046d25fbe5841a55fb7bfcc879522f59a8)
DeltaFile
+211-0tests/sys/mac/do/consistency.sh
+1-1tests/sys/mac/do/Makefile
+212-12 files

FreeBSD/src 0ab20f7tests/sys/mac/do common.sh

MAC/do: Tests: Add support for exec paths, jail parameters, subjails

And also allow configuration of the mdo(1) executable path.

This commit only contains new or modified infrastructure.  No functional
change intended at this point.

Reviewed by:    bapt
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/38

(cherry picked from commit a95ff5ef7d1ffcb701913028253a4700cd9a1459)
DeltaFile
+110-9tests/sys/mac/do/common.sh
+110-91 files

FreeBSD/src 406c84ashare/man/man4 mac_do.4

mac_do.4: Document executable paths, default jail values and consistency

While here, fix the bug of mentioning 'enable' as a possible value for
the 'mac.do' jail parameter whereas it is 'new' instead.

Reviewed by:    bapt
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/38

(cherry picked from commit 39818654ae879788807d3a87c2d75cc700cc7113)
DeltaFile
+143-46share/man/man4/mac_do.4
+143-461 files

FreeBSD/src 9dea58fsys/security/mac_do mac_do.c, tests/sys/mac/do invalid_configs.sh

MAC/do: Fix double-free on parse error after "executable paths" feature

parse_rules() has been calling toast_rules() in case of a parse error in
order to deallocate the 'struct rule' objects it has constructed up to
that point.

toast_rules() would take a pointer to a full 'struct rules' object, and
besides freeing all 'struct rule' referenced by it, would also free the
holding 'struct rules' itself.

With the introduction of the "executable paths" feature, and the
embedding of 'struct rules' into 'struct conf', meaning that the
lifecycle for 'struct rules' was no longer independent, toast_rules()
was changed not to free the passed 'struct rules' (as it was a field of
a 'struct conf' object).  Unfortunately, this change was not completed
with a reinitialization of the rules list head, so the 'struct conf'
object would continue to reference just-freed rules, which then would be
freed a second time on destruction of that container.


    [18 lines not shown]
DeltaFile
+8-8sys/security/mac_do/mac_do.c
+14-0tests/sys/mac/do/invalid_configs.sh
+22-82 files

FreeBSD/src 531c3easys/security/mac_do mac_do.c

MAC/do: Update copyright

Update years for the Foundation.

While here, remove the initial '/*-' which has been useless for a long
time.

While here, add a missing space on bapt@'s copyright line (approved by
him).

Reviewed by:    bapt
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/38

(cherry picked from commit fcb0018634c77fe32ed99bca00f856af18ed240b)
DeltaFile
+3-3sys/security/mac_do/mac_do.c
+3-31 files

FreeBSD/src 29c5581sys/security/mac_do mac_do.c

MAC/do: Do not skip blanks when parsing executable paths

The kind of tolerance we apply to parsing rules, whose format we have
defined, cannot be applied to paths since blank characters are allowed
there.

There is still the limitation that no escape character is currently
supported, and so it is not possible to configure a path having a ':'
character.

Reviewed by:    bapt
Fixes:          9818224174c4 ("MAC/do: Executable paths feature (GSoC 2025's final state)")
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/38

(cherry picked from commit 1fa1e3f3950fc0593ab73ea075c24c9bfbe8afd6)
DeltaFile
+1-1sys/security/mac_do/mac_do.c
+1-11 files

FreeBSD/src ac9d12fsys/security/mac_do mac_do.c

MAC/do: Serialize installing/modifying some jail's configuration

See the immediately preceding commit for explanations on what this is
fixing.

When setting 'mac.do' to 'inherit' on a jail with 'mac.do.rules' and
'mac.do.exec_paths' also specified in the same call, ensure that the
check that these passed parameters are the same as those to be inherited
is atomic with respect to enabling the inheritance (i.e., removing the
jail's 'struct conf' object).  (See previous commit "MAC/do: Fix the
recent logic to set jail parameters, make it more tolerant" as for why
this check exists.)

Because we currently only modify a single configuration object per
transaction, we introduce the parse_and_commit_conf() wrapper around
parse_and_set_conf() to remove duplicated code that would ensue from
calling the latter directly, namely, releasing the 'mac_do_rwl' lock and
freeing the old configuration object (if any).


    [11 lines not shown]
DeltaFile
+76-23sys/security/mac_do/mac_do.c
+76-231 files

FreeBSD/src d344d17sys/security/mac_do mac_do.c

MAC/do: Support for atomically modifying configurations

As mentioned in previous commits "MAC/do: parse_and_set_conf(): Require
the model configuration" and "MAC/do: Sequential consistency for
configuration retrieval", the introduction of the "executable path"
feature, more fundamentally, the fact that there is now more than one
per-jail parameter and that parameters can be independently modified or
copied, causes an atomicity problem in case of concurrent accesses to of
a jail's applicable configuration.

Partially modifying a configuration is indeed akin to
a read-modify-write operation, where the read is either to the current
or an inherited configuration.  More precisely, once pointed to by
a jail, a configuration object is immutable, and changing the jail's
configuration means making the jail point to another configuration
object.  To change a jail's configuration, a new configuration object is
thus built, and if only some parameters have been explicitly specified,
those that have not been are set by copying the corresponding values
from an existing configuration object (in case of partial modification

    [36 lines not shown]
DeltaFile
+49-15sys/security/mac_do/mac_do.c
+49-151 files

FreeBSD/src 84af2a5sys/security/mac_do mac_do.c

MAC/do: Sequential consistency for configuration retrieval

Since the inception of mac_do(4), find_conf(), used to retrieve the
applicable configuration, has been weakly consistent with respect to
concurrent modifications to configuration inheritance that influence its
result (and it has been sequentially consistent with respect to other
configuration modifications, which the initial executable paths feature
and introduction of implicit parameters broke and which will be fixed in
a subsequent commit).

Indeed, find_conf() climbs the jail tree to find an applicable
configuration, which is not an atomic operation.  It examines the
current jail's configuration pointer for each browsed jail, which does
not prevent concurrent modifications of the configuration pointer for
jails below or above it.  Modifications above the current jail are not
a problem, since if climbing needs to continue (i.e., the current jail
inherits), these modifications will be seen if performed before that
check (and may or may not be seen if performed after that check).
However, modifications below the current jail impair sequential

    [50 lines not shown]
DeltaFile
+69-53sys/security/mac_do/mac_do.c
+69-531 files