HardenedBSD/src 5dd6a72 — sys/amd64/conf HARDENEDBSD-KASAN

HBSD: Add HARDENEDBSD-KASAN amd64 kernel config

Pretty self-explanitory: make it easier to work with KASAN.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+9-0sys/amd64/conf/HARDENEDBSD-KASAN
+9-01 files

HardenedBSD/src 0f8e0f5 — sys/amd64/conf HARDENEDBSD-KMSAN

HBSD: Add HARDENEDBSD-KMSAN amd64 kernel config

Pretty self-explanitory: make it easier to work with KMSAN.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+9-0sys/amd64/conf/HARDENEDBSD-KMSAN
+9-01 files

HardenedBSD/src f3fb698 — lib/libsys/tests Makefile

HBSD: libsys tests: Disable SafeStack

SafeStack isn't applicable to unit test code.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+2-0lib/libsys/tests/Makefile
+2-01 files

HardenedBSD/src a3d5180 — contrib/llvm-project/clang/lib/Sema SemaDeclAttr.cpp, sys/dev/usb/controller/dwc3 dwc3.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+293-15tests/sys/netipsec/tunnel/bundle.sh
+117-106sys/powerpc/linux/linux_sysvec.c
+74-31sys/netipsec/ipsec_output.c
+43-0tests/sys/netipsec/tunnel/pmtu.sh
+29-6contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
+21-7sys/dev/usb/controller/dwc3/dwc3.c
+577-16516 files not shown
+628-19122 files

HardenedBSD/src 68819f3 — contrib/llvm-project/clang/lib/Sema SemaDeclAttr.cpp, sys/dev/usb/controller/dwc3 dwc3.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+293-15tests/sys/netipsec/tunnel/bundle.sh
+117-106sys/powerpc/linux/linux_sysvec.c
+74-31sys/netipsec/ipsec_output.c
+43-0tests/sys/netipsec/tunnel/pmtu.sh
+29-6contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
+21-7sys/dev/usb/controller/dwc3/dwc3.c
+577-16516 files not shown
+628-19122 files

HardenedBSD/src 1f581d4 — sys/netinet ip_carp.c

carp: Leave the multicast groups without the softc lock

carp_detach() calls carp_multicast_cleanup() with the softc mutex held.
in_leavegroup() and in6_leavegroup() take in_multi_sx and in6_multi_sx,
so removing the last CARP address of a family from an interface gives:

lock order reversal: (sleepable after non-sleepable)
 1st carp_softc (carp_softc, sleep mutex) @ sys/netinet/ip_carp.c:2329
 2nd in_multi_sx (in_multi_sx, sx) @ sys/netinet/in_mcast.c:1280

and the same with in6_multi_sx for IPv6.

The memberships belong to the carp_if and are protected by carp_sx,
which carp_detach() holds throughout; carp_attach() already joins the
groups without the softc lock.  Leave them once the softc is unlocked
or destroyed, before the carp_if may be freed.  The groups of a family
are left only when no CARP address of that family remains on the
interface, and only softcs with an address of a family send
advertisements through its multicast options, so no sender uses them

    [7 lines not shown]
DeltaFile
+3-1sys/netinet/ip_carp.c
+3-11 files

HardenedBSD/src 4dcabb0 — sys/netipsec ipsec_output.c, tests/sys/netipsec/tunnel Makefile pmtu.sh

netipsec: Do not send a Packet Too Big below the IPv6 minimum MTU

ipsec6_check_pmtu() answers a forwarded packet that does not fit once
encapsulated with an ICMPv6 Packet Too Big for the path MTU less the
estimated IPsec overhead.  When the path MTU to the tunnel endpoint is
below IPV6_MMTU plus that overhead, 1417 bytes for an ESP tunnel over
IPv6, the message asks for less than IPV6_MMTU.  Senders ignore it
(RFC 8201; icmp6_mtudisc_update() here does too), keep sending packets
of up to 1280 bytes, and the check drops every one of them.

Do what RFC 2473 section 7.1 asks of a tunnel entry point instead: pass
a packet of up to IPV6_MMTU bytes on, so that the outer packet is
fragmented, and report IPV6_MMTU for larger ones.  This also replaces
the silent drop of every packet when the path MTU does not even cover
the overhead.  With an IPv4 outer header and net.inet.ipsec.dfbit set
to 1, ip_output() still drops such a packet, as the outer header has DF
set.

Add a test with a path MTU of 1300 between the gateways.

    [6 lines not shown]
DeltaFile
+43-0tests/sys/netipsec/tunnel/pmtu.sh
+12-5sys/netipsec/ipsec_output.c
+1-0tests/sys/netipsec/tunnel/Makefile
+56-53 files

HardenedBSD/src 6a839b4 — sys/netipsec ipsec_output.c, tests/sys/netipsec/tunnel bundle.sh

netipsec: Find the outer destination of a bundle for the PMTU check

ipsec{4,6}_check_pmtu() look up the SA of the last request of a policy
to learn the outer destination, and from it the path MTU.  The lookup
fills in the empty addresses of a transport request from the packet as
it is before any transform.  When the transport request follows a
tunnel request, as in "esp/tunnel/A-B/require ah/transport//require",
the transform applies it after the tunnel request, to the outer header,
and its SA is installed for A and B.  The check then finds no SA with
every SA in place.  At level require it sends an SADB_ACQUIRE for the
inner addresses and drops the packet.  strongSwan installs this shape
for IPComp in tunnel mode,
"ipcomp/tunnel/A-B/unique esp/transport//unique", so with such a policy
no forwarded IPv6 packet got through, and no IPv4 packet that the check
covers (net.inet.ipsec.dfbit 1, or above 1 for a packet with DF set).
At level use the check sends the same SADB_ACQUIRE and, since
655407eeea5b, skips the comparison with the path MTU.  A packet that is
too big once encapsulated is then dropped by ip_output() if the outer
IPv4 header has DF set, or else fragmented, and its sender never learns

    [28 lines not shown]
DeltaFile
+293-15tests/sys/netipsec/tunnel/bundle.sh
+62-26sys/netipsec/ipsec_output.c
+355-412 files

HardenedBSD/src 4f76f14 — contrib/llvm-project/clang/include/clang/Sema Sema.h, contrib/llvm-project/clang/lib/Sema SemaDecl.cpp SemaDeclAttr.cpp

Merge commit 6573dd3f1ae9 from llvm-project (by ShengYi Hung):

  [Clang][Sema] Accept weak reference after declaration (#228809)

  GCC accepts a weak reference even after there is a declaration. In here,
  we use Check*Decl to do the required check and merge the NewDecl to
  declaration chain.

  Assisted-by: Claude # Tests ReleaseNote
  Fixes: #56760

PR:             205934
MFC after:      1 week
DeltaFile
+29-6contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
+13-0contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp
+3-0contrib/llvm-project/clang/include/clang/Sema/Sema.h
+45-63 files

HardenedBSD/src c473e1c — sys/powerpc/powerpc trap.c

powerpc64: do not call pmap_nofault() for kernel addresses

trap_pfault() calls pmap_nofault() with the current process's pmap for
every radix page fault, before it has worked out which map the address
belongs to. For a fault on a kernel address that walks the user page
table: pmap_pml1e_index() masks off the quadrant bits, so 0xc008... is
looked up as the user address 0x0008....

Usually nothing is mapped there and vm_fault() handles the fault as
before. But if the process happens to have a mapping at that address,
its PTE gets the reference or change bit and its page is dirtied for an
access it never made. These faults are common: the first write to a
pipe buffer after the read that faulted it in is one.

Skip the call for kernel addresses. vm_fault() handles them the same
way it does now.

Reviewed by:    jhibbits
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D62038
DeltaFile
+2-1sys/powerpc/powerpc/trap.c
+2-11 files

HardenedBSD/src 3e7ecbf — sys/powerpc/linux linux_sigframe.h linux_sysvec.c

linuxulator/powerpc: fix signal delivery

Handlers were always treated as ELFv1 function descriptors and read
directly from userland. ELFv2 handlers are plain addresses and want their
own address in r12.

Also don't overwrite the red zone, honour sigaltstack(), write the back
chain and stop copying a FreeBSD ucontext that nobody reads.

Reviewed by:    jhibbits
Differential Revision:  https://reviews.freebsd.org/D62271
DeltaFile
+111-105sys/powerpc/linux/linux_sysvec.c
+0-8sys/powerpc/linux/linux_sigframe.h
+111-1132 files

HardenedBSD/src 812dcfa — sys/powerpc/linux linux_proto.h syscalls.master

linuxulator/powerpc: fix the argument order of clone()

PowerPC passes tls before child_tidptr. New threads got a pointer to their
TID as thread pointer.

While here make linux_set_upcall() return 0 to the child instead of
copying r1 to r0.

Reviewed by:    jhibbits
Differential Revision:  https://reviews.freebsd.org/D62272
DeltaFile
+3-3sys/powerpc/linux/linux_systrace_args.c
+2-2sys/powerpc/linux/syscalls.master
+3-1sys/powerpc/linux/linux_machdep.c
+1-1sys/powerpc/linux/linux_proto.h
+9-74 files

HardenedBSD/src e23a5c1 — sys/powerpc/linux linux.h

linuxulator/powerpc: fix the layout of struct stat and statfs64

st_dev and st_rdev are longs on powerpc64, but l_dev_t is 32-bit.
Everything after st_gid was off by 4 bytes and glibc read st_blksize as
the file size. statfs64 has the same problem with its word-sized fields.

Reviewed by:    jhibbits
Differential Revision:  https://reviews.freebsd.org/D62270
DeltaFile
+8-8sys/powerpc/linux/linux.h
+8-81 files

HardenedBSD/src ebb8c70 — sys/powerpc/linux linux_sysvec.c

linuxulator/powerpc: return positive errno values

sc reports an error with CR0[SO] set and a positive errno in r3. We passed
the negative one like the other architectures do, so libc took every
error for a success. A failed open() became file descriptor 2.

Reviewed by:    jhibbits
Differential Revision:  https://reviews.freebsd.org/D62269
DeltaFile
+6-1sys/powerpc/linux/linux_sysvec.c
+6-11 files

HardenedBSD/src 01326b1 — sys/dev/usb/controller/dwc3 dwc3.c

usb: dwc3: treat a dual-role port whose default role is host as a host port

Some device trees (such as Apple Silicon Macs) describe USB-C DWC3
controllers with dr_mode = "otg" and role-switch-default-mode = "host".
Accept that combination during probe so host mode works with unmodified
device trees instead of refusing to attach.

Differential Revision:  https://reviews.freebsd.org/D62185
DeltaFile
+14-4sys/dev/usb/controller/dwc3/dwc3.c
+14-41 files

HardenedBSD/src 69511e1 — sys/dev/usb/controller/dwc3 dwc3.h dwc3.c

usb: dwc3: derive 32-bit vs 64-bit DMA from DWC3_GHWPARAMS0 AWIDTH

dwc3.c previously passed a hardcoded IS_DMA_32B (1) to xhci_init(),
which pins sc_dma_bits to 32 (and hw.usb.xhci.dma32 can only force
32-bit DMA on, never off).

On platforms with no physical memory below 4GB (such as Apple Silicon,
where DRAM starts at 0x800000000 on t8103), a 32-bit busdma tag cannot
allocate coherent memory or bounce pages and xhci_init() fails.

Read the synthesized address bus width (AWIDTH, bits [31:24]) from
DWC3_GHWPARAMS0 and enable 64-bit DMA only when AWIDTH == 64 on a
64-bit host, leaving 32-bit synthesized DWC3 cores on 32-bit DMA.
xhci_init() still checks XHCI_HCS0_AC64 and hw.usb.xhci.dma32.

Differetial Revision:   https://reviews.freebsd.org/D62184
DeltaFile
+7-3sys/dev/usb/controller/dwc3/dwc3.c
+1-0sys/dev/usb/controller/dwc3/dwc3.h
+8-32 files

HardenedBSD/src c858f92 — sys/powerpc/powerpc exec_machdep.c

powerpc: zero the FPU save area in set_fpregs() when it was not valid

set_fpregs() marks the saved FPU registers valid and fills in the FP
registers and the FPSCR, which are only half of each of VSR0-31. The
other halves are left alone, and on a thread that hasn't used the FPU
since exec they still hold whatever the previous program left there:
exec only resets pcb_flags, and enable_fpu() zeroes the save area only
when PCB_FPREGS is clear.

So a PT_SETFPREGS on such a thread, even one that just writes back what
PT_GETFPREGS returned, hands the new program VSX register contents of
the program that ran before the exec.

Zero the save area first when it wasn't valid, like enable_fpu() does.

Reviewed by:    jhibbits
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D62037
DeltaFile
+4-1sys/powerpc/powerpc/exec_machdep.c
+4-11 files

HardenedBSD/src 1695b29 — share/misc committers-ports.dot, usr.bin/calendar/calendars calendar.freebsd

committers-ports: Add mzar and update committer information

Add mzar@ to the ports committers list with philip@,
farrokhi@, and olivier@ as mentors.

Update the Mentor and Mentee Information according
to step 5 of the Committer's Guide.

Update the calendar according to step 10 of the
Committer's Guide.

Approved by: philip, farrokhi, olivier (mentors)

Differential Revision:  https://reviews.freebsd.org/D62146
DeltaFile
+5-0share/misc/committers-ports.dot
+1-0usr.bin/calendar/calendars/calendar.freebsd
+6-02 files

HardenedBSD/src bbafd1a — sys/netpfil/ipfilter/netinet ip_fil_freebsd.c

ipfilter: Clear the IP header pointer if m_pullup() fails

Otherwise fin->fin_ip is left pointing into freed memory, and
ipf_pr_ipv4hdr() may end up accessing it.  In particular,
ipf_pr_ipv4hdr() checks fin->fin_ip == NULL to decide whether to
short-circuit, in contrast with ipf_pr_ipv6hdr(), which bails if
fin->fin_m == NULL.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D62172
DeltaFile
+1-0sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c
+1-01 files

HardenedBSD/src 2392e87 — contrib/atf NEWS COPYING, contrib/atf/atf-c macros.h macros_test.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+816-0contrib/atf/atf-sh/libatf-sh/common.subr
+189-8contrib/atf/atf-c/macros_test.c
+6-58contrib/llvm-project/libunwind/src/UnwindRegistersRestore.S
+28-22contrib/atf/COPYING
+36-0contrib/atf/atf-c/macros.h
+33-0contrib/atf/NEWS
+1,108-8813 files not shown
+1,206-17519 files

HardenedBSD/src 88a99ef — contrib/atf NEWS COPYING, contrib/atf/atf-c macros.h macros_test.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+816-0contrib/atf/atf-sh/libatf-sh/common.subr
+189-8contrib/atf/atf-c/macros_test.c
+6-58contrib/llvm-project/libunwind/src/UnwindRegistersRestore.S
+28-22contrib/atf/COPYING
+36-0contrib/atf/atf-c/macros.h
+33-0contrib/atf/NEWS
+1,108-8813 files not shown
+1,206-17519 files

HardenedBSD/src ff3877b — contrib/llvm-project/libunwind/include libunwind.h, contrib/llvm-project/libunwind/src UnwindRegistersRestore.S assembly.h

Merge commit 29474e1a3a72 from llvm-project (by Minsoo Choo):

  [libunwind] Support extended amd64 segment registers on FreeBSD (#237265)

  Raise the amd64 DWARF register limit to 59 and add RFLAGS, all six
  segment selectors, FS.base, and GS.base to the register model. Capture
  the extended state and restore it when resuming, using setcontext on
  FreeBSD to restore selectors and bases together. Pack the state into the
  existing context buffers without changing their public sizes or the
  Windows XMM offsets.

  Add tests for register access, signal-frame CFI recovery, register
  bounds, and resume behavior.

  Assisted-by: GPT

MFC after:      1 week
DeltaFile
+87-7contrib/llvm-project/libunwind/src/Registers.hpp
+52-0contrib/llvm-project/libunwind/src/libunwind.cpp
+45-0contrib/llvm-project/libunwind/src/UnwindRegistersSave.S
+9-0contrib/llvm-project/libunwind/src/assembly.h
+9-0contrib/llvm-project/libunwind/include/libunwind.h
+4-1contrib/llvm-project/libunwind/src/UnwindRegistersRestore.S
+206-82 files not shown
+209-118 files

HardenedBSD/src 2c0d153 — contrib/llvm-project/libunwind/src assembly.h UnwindCursor.hpp

Revert "Merge commit fd4113508a64 from llvm-project (by Minsoo Choo):"

This reverts commit 28ec7cb8712fde61107126c8ff174578d0ccdf79:

  [libunwind] Support extended amd64 segment registers (#229176)

  Raise the amd64 DWARF register limit to 59 and add RFLAGS, all six
  segment selectors, FS.base, and GS.base to the register model. Capture
  the extended state and restore it when resuming, using sigreturn() on
  FreeBSD to restore selectors and bases together. Pack the state into the
  existing context buffers without changing their public sizes or the
  Windows XMM offsets.

  Add tests for register access, signal-frame CFI recovery, register
  bounds, and resume behavior.

  Assisted-by: GPT

It was reverted upstream, after noting that it should apply specifically

    [3 lines not shown]
DeltaFile
+7-92contrib/llvm-project/libunwind/src/Registers.hpp
+7-62contrib/llvm-project/libunwind/src/UnwindRegistersRestore.S
+5-57contrib/llvm-project/libunwind/src/UnwindRegistersSave.S
+0-52contrib/llvm-project/libunwind/src/libunwind.cpp
+0-27contrib/llvm-project/libunwind/src/UnwindCursor.hpp
+0-18contrib/llvm-project/libunwind/src/assembly.h
+19-3083 files not shown
+22-3209 files

HardenedBSD/src 704c302 — contrib/atf NEWS COPYING, contrib/atf/atf-c macros.h macros_test.c

contrib/atf: update to 0.27.0

This release contains the upstreamed version of the wchar_t macros,
provided by des@ in https://reviews.freebsd.org/D61616.

MFC after:      1 week
Merge commit '9e2097a19a9dad81dcd8e7074283b8126464f310'
DeltaFile
+816-0contrib/atf/atf-sh/libatf-sh/common.subr
+189-8contrib/atf/atf-c/macros_test.c
+28-22contrib/atf/COPYING
+36-0contrib/atf/atf-c/macros.h
+33-0contrib/atf/NEWS
+24-0contrib/atf/atf-sh/libatf-sh/FreeBSD.subr
+1,126-308 files not shown
+1,185-5414 files

HardenedBSD/src a0a8c3b — contrib/lutok/api-docs/html a00044.html a00065.html

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+0-1,693contrib/lutok/api-docs/html/a00923.html
+1,163-0contrib/lutok/api-docs/html/navtree.js
+0-532contrib/lutok/api-docs/html/a00895.html
+403-0contrib/lutok/api-docs/html/a00043.html
+0-395contrib/lutok/api-docs/html/a00065.html
+388-0contrib/lutok/api-docs/html/a00044.html
+1,954-2,620230 files not shown
+6,580-9,822236 files

HardenedBSD/src f96adba — contrib/lutok/api-docs/html a00044.html a00065.html

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+0-1,693contrib/lutok/api-docs/html/a00923.html
+1,163-0contrib/lutok/api-docs/html/navtree.js
+0-532contrib/lutok/api-docs/html/a00895.html
+403-0contrib/lutok/api-docs/html/a00043.html
+0-395contrib/lutok/api-docs/html/a00065.html
+388-0contrib/lutok/api-docs/html/a00044.html
+1,954-2,620230 files not shown
+6,580-9,822236 files

HardenedBSD/src 529519b — contrib/expat/gennmtab Makefile.in, contrib/expat/lib xmlparse.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+1,081-0contrib/expat/tests/fifth_edition_tests.c
+661-224contrib/expat/tests/basic_tests.c
+442-301contrib/expat/lib/xmlparse.c
+740-0contrib/expat/gennmtab/Makefile.in
+300-38contrib/expat/tests/misc_tests.c
+322-1contrib/expat/tests/xmltest.sh
+3,546-56453 files not shown
+5,594-1,17359 files

HardenedBSD/src 6b2f09d — contrib/lutok FREEBSD-Xlist FREEBSD-upgrade.md

contrib/lutok: document suggested component upgrade process

This is similar to documentation added for contrib/atf in 91fcc2d8b18c.

MFC after:      1 week
DeltaFile
+93-0contrib/lutok/FREEBSD-upgrade.md
+12-0contrib/lutok/FREEBSD-Xlist
+105-02 files

HardenedBSD/src f3d3ae5 — sys/kern kern_exit.c

kern/kern_exit.c: fix decision to give back to real parent in proc_reap()

p_oppid records the reaper by pid only, and nothing updates p_oppid when
the reaper changes. When p_oppid no longer matches, proc_realparent()
falls back to p_reaper. In proc_reap(), the test p_oppid !=
p_pptr->p_pid is then still true, so proc_reap() "gives back" the child
to proc_realparent(). That resolves to the new reaper, which is already
p_pptr. proc_reparent() returns early, the reaper gets a spurious
SIGCHLD, and proc_reap() returns without reaping.

Another problem with p_oppid check is that a parked zombie is leaked
permanently under the new reaper if the reaper changes before the
debugger waits, because p_oppid keeps the old reaper's pid.

In proc_reap(), base the give-back decision on the resolved parent
instead of the pid comparison.

Reported by:    llm-postcr
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+3-3sys/kern/kern_exit.c
+3-31 files

HardenedBSD/src 4b7dbdb — contrib/lutok config.h, lib/liblutok Makefile

contrib/lutok: update generated headers/build glue

lutok and kyua have both been updated for the new tests and the adjusted
header layout.

MFC after:      1 week
MFC with:       5e4c3200cdc7 ("contrib/lutok: update to 0.7.1")
DeltaFile
+3-3contrib/lutok/config.h
+3-2lib/liblutok/tests/Makefile
+1-1usr.bin/kyua/Makefile
+1-1lib/liblutok/Makefile
+8-74 files