FreeBSD/src 3ba68f5 — sys/arm64/arm64 pmap.c

arm64 pmap: combine L3C accessed bits in pmap_mincore()

The accessed bit may be set in only some of an L3C superpage's L3
PTEs.  However, when pmap_mincore() found an L3C mapping, it reported
the accessed state of the specified L3 PTE only, so mincore(2) could
fail to report MINCORE_REFERENCED for an L3C superpage that had been
accessed.  When the accessed bit is not set in the specified entry, use
pmap_load_l3c() to combine the accessed bits from all of the L3C
superpage's L3 PTEs.

Found by:       Claude Code (Opus 5.5)
MFC after:      1 week
DeltaFile
+10-1sys/arm64/arm64/pmap.c
+10-11 files

FreeBSD/src e67b4c8 — sys/dev/hwpmc hwpmc_mod.c

hwpmc: release a PMC whose ID could not be copied out

If copyout of the newly allocated PMC ID fails, the caller cannot use or
release the PMC. Release it in the kernel.

Reviewed by:    mhorne
MFC after:      3 days
Sponsored by:   Advanced Micro Devices, Inc.
Differential Revision:  https://reviews.freebsd.org/D60562

(cherry picked from commit e5a48c8e0dd026ba953cf401c4dec02f76078aa2)
DeltaFile
+6-0sys/dev/hwpmc/hwpmc_mod.c
+6-01 files

FreeBSD/src 0ab6ce9 — usr.sbin/pmc cmd_pmc_stat.c

pmc(8): zero-initialize the event descriptor in stat mode

cmd_pmc_stat allocated the event descriptor with malloc and then set
only some of its fields, so the rest held whatever was on the heap.
Use calloc() instead.

Reviewed by:    mhorne
MFC after:      3 days
Sponsored by:   AMD
Signed-off-by: Andre Silva <andasilv at amd.com>
Differential Revision:  https://reviews.freebsd.org/D59364

(cherry picked from commit a97914284c2e7a7dc330f4d93218e8d7f1e758b2)
DeltaFile
+1-1usr.sbin/pmc/cmd_pmc_stat.c
+1-11 files

FreeBSD/src 494bc04 — usr.sbin/pmc cmd_pmc_stat.c

pmc(8): zero-initialize the event descriptor in stat mode

cmd_pmc_stat allocated the event descriptor with malloc and then set
only some of its fields, so the rest held whatever was on the heap.
Use calloc() instead.

Reviewed by:    mhorne
MFC after:      3 days
Sponsored by:   AMD
Signed-off-by: Andre Silva <andasilv at amd.com>
Differential Revision:  https://reviews.freebsd.org/D59364

(cherry picked from commit a97914284c2e7a7dc330f4d93218e8d7f1e758b2)
DeltaFile
+1-1usr.sbin/pmc/cmd_pmc_stat.c
+1-11 files

FreeBSD/src ebecf68 — sys/dev/hwpmc hwpmc_mod.c

hwpmc: release a PMC whose ID could not be copied out

If copyout of the newly allocated PMC ID fails, the caller cannot use or
release the PMC. Release it in the kernel.

Reviewed by:    mhorne
MFC after:      3 days
Sponsored by:   Advanced Micro Devices, Inc.
Differential Revision:  https://reviews.freebsd.org/D60562

(cherry picked from commit e5a48c8e0dd026ba953cf401c4dec02f76078aa2)
DeltaFile
+6-0sys/dev/hwpmc/hwpmc_mod.c
+6-01 files

FreeBSD/src 74ec4ca — contrib/netbsd-tests/lib/libc/sys t_mlock.c

mlock_test: use mmap/munmap for unmapped pointer

Instead of hoping that the page after sbrk(0) is unmapped, map a page
with mmap and then munmap it.  This won't work with CheriABI and heap
temporal safety, but it's an easy fix for now and works on all
architectures.

Reviewed by:    ngie
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D46954
DeltaFile
+6-16contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+6-161 files

FreeBSD/src 4a6091a — contrib/netbsd-tests/lib/libc/gen t_dir.c

libc: skip telldir_leak test

It uses sbrk to attempt to detect memory leaks in telldir, but we're not
going to export sbrk in the future and this is unreliable for mmap-based
mallocs.  It's also a regression test for a specific NetBSD bug.

Reviewed by:    ngie
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D46955
DeltaFile
+3-4contrib/netbsd-tests/lib/libc/gen/t_dir.c
+3-41 files

FreeBSD/src 488bf44 — sys/netipsec key.c

netipsec: Do not leak the SAH when an SA is cloned

key_updateaddresses() gives the clone of an SA a new SAH reference when
the SA index comes from key_newsah() or key_getsah(), but nothing
releases the reference of the old SA: key_delsav() leaves the SAH alone,
because key_unlinksav() normally releases it, and an SA that is replaced
never goes through that.  The SAH then stays allocated for good, after
its SAs are flushed and after the vnet is destroyed, as an SADB_UPDATE
with a new address does each time an IKE daemon moves an SA.

The old SA cannot release the reference when it is replaced, since a
sender that still holds it reads its SAH.  Release it in key_delsav()
instead.  When only the NAT-T config changes, the clone used to take over
the reference of the old SA; take a new one in that case as well, so that
every SA holds its own.

Reviewed by:            kib, markj
MFC after:              1 week
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D61101
DeltaFile
+7-3sys/netipsec/key.c
+7-31 files

FreeBSD/src bd9d7cd — crypto/openssh README.tun configure.ac, crypto/openssh/regress sshfp-connect.sh

OpenSSH: Update to 10.5p1

This release contains security fixes and small bugfixes.

Full release notes are available at
https://www.openssh.com/txt/release-10.5.

Selected items from the release notes:

Security
========

 * ssh-agent(1): fix an interaction between agent locking and the
   session-bind at openssh.com extension that is used to identify
   forwarded agents. These binding requests were refused when the
   agent was locked, with the result that operations that were
   intended to be limited to local use only could be performed
   remotely, including the ability to add PKCS#11 tokens and make
   use of keys that had destination restrictions applied.

    [33 lines not shown]
DeltaFile
+696-111crypto/openssh/ChangeLog
+308-0crypto/openssh/kexmlkem768ecdh.c
+144-41crypto/openssh/regress/sshfp-connect.sh
+140-19crypto/openssh/sshconnect2.c
+41-102crypto/openssh/configure.ac
+0-132crypto/openssh/README.tun
+1,329-40591 files not shown
+2,174-1,18197 files

FreeBSD/src dbeadd4 — sys/i386/linux linux_sysvec.c, sys/netinet in_pcb.c

linux: Allow connect() with destination port 0

Linux allows connect() with destination port 0, but FreeBSD returns
EADDRNOTAVAIL in in_pcbconnect() and in6_pcbladdr(). Some Linux programs
(e.g. the new Android CLI tool) rely on this for routability checks,
however.

Add an SV_CONN_PORT0 flag to sv_flags which is set in the Linux sysvecs,
allowing the port 0 guard in the connect paths to be bypassed.

Reviewed by:    glebius, kib
Differential Revision:  https://reviews.freebsd.org/D60659
DeltaFile
+3-2sys/sys/sysent.h
+2-2sys/i386/linux/linux_sysvec.c
+3-1sys/netinet6/in6_pcb.c
+2-1sys/netinet/in_pcb.c
+10-64 files

FreeBSD/src 1333444 — sys/kern kern_loginclass.c, sys/sys syscallsubr.h

kern_loginclass.c: add kern_ implementations

Effort:         CHERI upstreaming
Sponsored by:   DARPA, AFRL, Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+16-3sys/kern/kern_loginclass.c
+2-0sys/sys/syscallsubr.h
+18-32 files

FreeBSD/src 58a758c — sys/kern kern_linker.c, sys/sys syscallsubr.h

kern_linker.c: add kern_ implementations

kldsym(2) is more complex than typical because it requires translation
of struct kld_sym_lookup which is a weird in/out structure.  Out of
paranoia we avoid copying out the symname pointer in the capability
version to eliminate the possiblity of leaking a capability (but not
invalidating a pointer userspace might be using via copyout()).

Effort:         CHERI upstreaming
Sponsored by:   DARPA, AFRL, Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+50-23sys/kern/kern_linker.c
+4-0sys/sys/syscallsubr.h
+54-232 files

FreeBSD/src 6189085 — sys/kern kern_ktrace.c, sys/sys syscallsubr.h

[ku]trace(2): add kern_[ku]trace

Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+23-11sys/kern/kern_ktrace.c
+3-0sys/sys/syscallsubr.h
+26-112 files

FreeBSD/src 7c9060c — sys/kern kern_fork.c, sys/sys syscallsubr.h

pdfork(2): add kern_pdfork

Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+11-5sys/kern/kern_fork.c
+1-0sys/sys/syscallsubr.h
+12-52 files

FreeBSD/src d477542 — sys/kern kern_ffclock.c, sys/sys syscallsubr.h

ffclock: add kern_ interfaces

Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+24-4sys/kern/kern_ffclock.c
+7-0sys/sys/syscallsubr.h
+31-42 files

FreeBSD/src 52bd0d1 — sys/kern kern_exit.c, sys/sys syscallsubr.h

wait6(2): add user_wait6

sys_wait6 is a little more complicated than typical as compat layers
need to translate siginfo_t.

Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+24-19sys/kern/kern_exit.c
+3-0sys/sys/syscallsubr.h
+27-192 files

FreeBSD/src 2e3ba76 — sys/kern kern_exit.c, sys/sys syscallsubr.h

wait4(2): add kern_wait4

Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+14-6sys/kern/kern_exit.c
+2-0sys/sys/syscallsubr.h
+16-62 files

FreeBSD/src 0a42a5c — sys/kern kern_event.c, sys/sys syscallsubr.h

kevent(2): add kern_kevent_generic

Effort:         CHERI upstreaming
Sponsored by:   Innovate UK
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
DeltaFile
+1-14sys/kern/kern_event.c
+11-0sys/sys/syscallsubr.h
+12-142 files

FreeBSD/src 4cb5268 — usr.sbin/flowctl flowctl.8

flowctl.8: Describe better

Align description with EuroBSD netgraph document descriptions rewrite.

MFC after:      3 days
DeltaFile
+2-4usr.sbin/flowctl/flowctl.8
+2-41 files

FreeBSD/src 4cbfaea — usr.sbin/adduser adduser.conf.5

adduser.conf.5: No crossreferences in titles

Crossreferences in titles are strongly discouraged and incompatible
with our own tooling. This is a wontfix by most of manpages ecosystem
because it is bad editorial style in the first place.

MFC after:      3 days
DeltaFile
+1-3usr.sbin/adduser/adduser.conf.5
+1-31 files

FreeBSD/src 1794dd6 — lib/libc/locale freelocale.3

freelocale.3: No crossreferences in titles

Crossreferences in titles are strongly discouraged and incompatible
with our own tooling. This is a wontfix by most of manpages ecosystem
because it is bad editorial style in the first place.

MFC after:      3 days
DeltaFile
+1-4lib/libc/locale/freelocale.3
+1-41 files

FreeBSD/src 115f0a2 — lib/libc/gen fmtcheck.3

fmtcheck.3: No crossreferences in titles

Crossreferences in titles are strongly discouraged and incompatible
with our own tooling. This is a wontfix by most of manpages ecosystem
because it is bad editorial style in the first place.

MFC after:      3 days
DeltaFile
+1-3lib/libc/gen/fmtcheck.3
+1-31 files

FreeBSD/src 5e91181 — share/man/man7 arch.7

arch.7: Mechanical fixes

+ Increase portability by never starting content lines with symbols
+ Improve search results by adding tunables to the variable database
+ Improve search result consistency by correcting description style

MFC after:      3 days
DeltaFile
+9-7share/man/man7/arch.7
+9-71 files

FreeBSD/src 769c49d — secure/lib/libcrypto/engines Makefile.inc Version.map

openssl: export only the engine entry points

Upstream links every dynamic engine with a version script,
engines/<name>.ld, that exports bind_engine and v_check and makes
everything else local.  FreeBSD's engines had no version script, so
they exported every global symbol, including _init and _fini.
loader_attic.so compiles its own copy of crypto/pem/pvkfmt.c and so
also exported 21 of its functions; 14 of them (b2i_*, i2b_*) have the
same names as public libcrypto functions.

Add one Version.map for all engines, the same as upstream's, and use it
from engines/Makefile.inc.

The engines are loaded only with dlopen(), and libcrypto looks up only
bind_engine and v_check, so hiding the other symbols does not affect
any consumer.

Tested via tinderbox: capi.so, devcrypto.so and loader_attic.so link
with --no-undefined-version and export only bind_engine and v_check.

    [8 lines not shown]
DeltaFile
+6-0secure/lib/libcrypto/engines/Version.map
+3-0secure/lib/libcrypto/engines/Makefile.inc
+9-02 files

FreeBSD/src 56741ec — secure/lib/libcrypto/engines/loader_attic Makefile, secure/lib/libcrypto/engines/padlock Makefile

openssl: fix engine defines to match upstream

Two engine Makefiles define different macros from upstream's
engines/build.info:

- padlock: engines/e_padlock.c builds the engine only when PADLOCK_ASM
  is defined.  Upstream defines it on x86 and x86_64, but our Makefile
  never did, so padlock.so has been a stub whose bind_engine() returns
  0 and the e_padlock-x86*.S code it links was never called.  Define
  PADLOCK_ASM on amd64 and i386, where that asm is built.

- loader_attic: upstream defines OPENSSL_NO_PROVIDER_CODE; the Makefile
  had OPENSSL_NO_PROVIDER_CORE.  No source tests either name, so the
  build does not change; this only follows upstream.

Found by comparing per-file compile flags against an upstream 3.5.9
build.  Checked by preprocessing e_padlock.c for amd64 and i386:
COMPILE_PADLOCKENG is now defined.


    [5 lines not shown]
DeltaFile
+1-1secure/lib/libcrypto/engines/loader_attic/Makefile
+2-0secure/lib/libcrypto/engines/padlock/Makefile
+3-12 files

FreeBSD/src 89d6dde — lib/libsys poll.2

libsys/poll.2: bump .Dd for the prior change

MFC after:      1 week
MFC with:       72a80a4733b2
DeltaFile
+1-1lib/libsys/poll.2
+1-11 files

FreeBSD/src 72a80a4 — lib/libsys poll.2

poll.2: document that poll is not restarted after signals

Signed-off-by: _ov4 <ov4 at ov4.org>
Reviewed-by: ngie
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2526
DeltaFile
+12-0lib/libsys/poll.2
+12-01 files

FreeBSD/src 3c6c65b — tests/sys/file Makefile fork_lowfd_test.c

tests/sys/file: add tests for the lowest fd after fork

fdcopy() skips plain kqueues and close-on-fork descriptors when it
copies the table into the child.  Check that dup(2) in the child still
returns the lowest unused descriptor, both when the skipped descriptor
is the lowest free slot and when it sits above an existing hole.

Test cases:

  kqueue_no_hole      a plain kqueue is the lowest descriptor; the
                      child's dup() reuses its slot
  kqueue_two          two adjacent plain kqueues; the child's dup()
                      returns the lower one
  kqueue_above_hole   a plain kqueue sits above a closed descriptor;
                      the child's dup() returns the hole
  kqueue_cponfork     a KQUEUE_CPONFORK kqueue is copied; the child's
                      dup() returns the next slot
  clofork_no_hole     an O_CLOFORK descriptor is the lowest one; the
                      child's dup() reuses its slot

    [14 lines not shown]
DeltaFile
+141-0tests/sys/file/fork_lowfd_test.c
+1-0tests/sys/file/Makefile
+142-02 files

FreeBSD/src b3563d1 — sys/dev/virtio/random virtio_random.c

virtio_random: defer first enqueue until after DRIVER_OK

According to the virtio spec:

> The driver MUST NOT send any buffer available notifications to the
> device before setting DRIVER_OK.

DRIVER_OK isn't set until after attach completes, so defer the first
enqueue.  We haven't found any problems as a result of this to the best
of my knowledge: q35 and other devices that we *have* been used with
will apparently check when we go DRIVER_OK.

Tested with q35 virtio-random, which still works.

Reported by:    llm-postcr
Reviewed by:    kfv, markj
Fixes:  f1c5a2e3a62505 ("virtio_random: Pipeline fetching the data")
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.

    [2 lines not shown]
DeltaFile
+16-2sys/dev/virtio/random/virtio_random.c
+16-21 files

FreeBSD/src 601d2a9 — sys/dev/virtio/random virtio_random.c

virtio_random: stop on detach, don't poll

If the device is hung, then polling will block the detach and hang us.
Stop it and drain the queue instead.  This fixes a hang on detach in
some circumstances without the upcoming virtio_pci_modern fix.

Reviewed by:    bnovkov, kfv
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.

(cherry picked from commit cce522853aae3da45b131c2522dd2510edf083e7)
DeltaFile
+9-3sys/dev/virtio/random/virtio_random.c
+9-31 files