HardenedBSD/src 39b1f80 — lib/libpmc pmc.perf.3, sys/dev/hwpmc hwpmc_perf.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+93-39sys/dev/mgb/if_mgb.c
+66-58sys/dev/hwpmc/hwpmc_perf.c
+87-0sys/dev/rge/if_rge.c
+69-10lib/libpmc/pmc.perf.3
+73-0tests/sys/netpfil/pf/icmp6.sh
+46-0tests/sys/netpfil/pf/nat.sh
+434-10737 files not shown
+677-18943 files

HardenedBSD/src 7ddd757 — lib/libpmc pmc.perf.3, sys/dev/hwpmc hwpmc_perf.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+93-39sys/dev/mgb/if_mgb.c
+66-58sys/dev/hwpmc/hwpmc_perf.c
+87-0sys/dev/rge/if_rge.c
+69-10lib/libpmc/pmc.perf.3
+73-0tests/sys/netpfil/pf/icmp6.sh
+46-0tests/sys/netpfil/pf/nat.sh
+434-10737 files not shown
+677-18943 files

HardenedBSD/src da8a529 — sys/dev/mgb if_mgb.h if_mgb.c

mgb: support for PCI11414.

Add support for Microchip PCI11414 Gigabit Ethernet Controller.

The PCI11414 is used on the CHERI VITA 57.1 PCIe Extension Board.

- Add PCI11414 device ID
- Add support for SGMII mode. Read the programmed strap configuration
  and enable SGMII operation when configured. Bypass the MII interface
  in SGMII mode.
- Increase the DMA descriptor ring size.

Reviewed by:    emaste
Sponsored by:   EPSRC ("UKRI3001: CHERI Research Centre")
Differential Revision:  https://reviews.freebsd.org/D60539
DeltaFile
+83-27sys/dev/mgb/if_mgb.c
+32-1sys/dev/mgb/if_mgb.h
+115-282 files

HardenedBSD/src b80af97 — share/man/man4 mgb.4 Makefile, sys/modules Makefile

mgb: Build module for all archs

It is not x86-specific.

This reverts commit e0a5aa37c1ef3a22e2dc8c311e0e32ea363f7ccf.
This reverts commit 2d935a1e93af4d552db1f7218ef97e01f058c084.

Reviewed by:    kbowling
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60615
DeltaFile
+1-2sys/modules/Makefile
+1-2share/man/man4/Makefile
+1-1share/man/man4/mgb.4
+3-53 files

HardenedBSD/src 33d9fbf — sys/compat/linux linux_signal.c

linuxulator: Accept 0 as signal in rt_sigqueueinfo

Linux allows 0 as a signal for rt_sigqueueinfo(2) the same as it does
for kill(2).  This is used to check for process existence and
permissions.

Allow this value through as a special case in linux_rt_siqgueueinfo the
same way as was done for linux_kill.

Before this change, lio_listio(3) would fail with EINVAL under
Linuxulator.  Now it is functional.

MFC after:      1 week
Reviewed by:    kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D60574
DeltaFile
+9-2sys/compat/linux/linux_signal.c
+9-21 files

HardenedBSD/src a3c5773 — lib/libifconfig libifconfig_sfp.c

lib/libifconfig: Fix pointer-sign warnings

Fix all pointer-sign warnings generated when compiling libifconfig.

A couple more snuck in while the previous batch of fixes was landing.

Fixes:          963f1a5455c9 ("ifconfig: add CMIS support for 400GbE optics")
Reviewed by:    kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D60573
DeltaFile
+2-2lib/libifconfig/libifconfig_sfp.c
+2-21 files

HardenedBSD/src e3d7a9b — . .mailmap

mailmap: Add mappings for rmoeller

Approved by:    kevans (mentor)
DeltaFile
+4-0.mailmap
+4-01 files

HardenedBSD/src 8fdf03c — share/misc committers-src.dot

committers-src: Add rmoeller mentored by kevans@

And note the commit bit return date of my previous account, freqlabs@.

Approved by:    kevans (mentor)
DeltaFile
+3-1share/misc/committers-src.dot
+3-11 files

HardenedBSD/src 686323c — sys/dev/rge if_rge.c

if_rge: add debugnet/netdump support

Implement the debugnet KPI in rge(4) by mirroring the re(4) pattern.
Tested with a RTL8125 2.5GbE NIC.

Approved by:    adrian
Differential Revision:  https://reviews.freebsd.org/D60135
DeltaFile
+87-0sys/dev/rge/if_rge.c
+87-01 files

HardenedBSD/src ec68ff1 — sys/dev/mgb if_mgb.h if_mgb.c

mgb: support multi-segment packets in the DMA descriptor rings.

Reviewed by:    emaste
Sponsored by:   EPSRC ("UKRI3001: CHERI Research Centre")
Differential Revision:  https://reviews.freebsd.org/D60705
DeltaFile
+10-12sys/dev/mgb/if_mgb.c
+1-0sys/dev/mgb/if_mgb.h
+11-122 files

HardenedBSD/src a6e1dde — sys/netpfil/pf pf.c, tests/sys/netpfil/pf icmp6.sh

pf: Do not corrupt neighbour advertisements when translating

When an ICMPv6 query or reply matches a translated state,
pf_test_state_icmp() copies the state's virtual id into icmp6_id.  Only
echo messages have an identifier there.  For all other types the
virtual id is 0 and those two bytes hold something else; in a neighbour
advertisement they hold the R, S and O flags.  The checksum was not
updated either, so icmp6_input() dropped the advertisement as a bad
checksum.

Unicast NUD probes to a link-local neighbour, such as the default
router, are sent from the link-local address.  With a nat rule that
matches it (e.g. "from any"), every advertisement answering a probe was
dropped: NUD failed, the neighbour cache entry was deleted, and traffic
to the neighbour stalled until it was resolved again.

Only rewrite the id of echo messages, as the ICMPv6 error path already
does, and update the checksum, as the IPv4 path does.


    [8 lines not shown]
DeltaFile
+73-0tests/sys/netpfil/pf/icmp6.sh
+13-1sys/netpfil/pf/pf.c
+86-12 files

HardenedBSD/src 3ca4b8d — contrib/openbsm/bin/auditdistd proto_tls.c proto_socketpair.c

auditdistd: Use fixed-length protocol names

All communication between auditdistd senders and receivers and
internally between auditdistd and its worker children passes through the
same pair of send / receive functions.  The receive function uses
recv(2) with the MSG_WAITALL flag, which in theory means we should never
get a short read.  However, when handing off a socket to a worker child,
we also pass a variable-length string identifying the type of socket
we're passing, and reading this string relies on a short read.  This
used to work because the arrival of the descriptor would interrupt the
recv(2) call, but this bug was fixed when the AF_UNIX code was rewritten
a while ago and auditdistd has been broken ever since.

Fixing the length of the protocol name to four characters including the
terminating null solves the short-read bug by never requiring a short
read (nothing else in auditdistd requires one).

PR:             296107
MFC after:      1 week

    [2 lines not shown]
DeltaFile
+4-9contrib/openbsm/bin/auditdistd/proto.c
+1-1contrib/openbsm/bin/auditdistd/proto_tls.c
+1-1contrib/openbsm/bin/auditdistd/proto_socketpair.c
+1-1contrib/openbsm/bin/auditdistd/proto_impl.h
+7-124 files

HardenedBSD/src 989d72f — sys/netpfil/pf pf_table.c

pf: Free a table entry that cannot be routed

pfr_insert_kentry() returned the error of pfr_route_kentry() and
leaked the entry it had created; pfr_insert_kentries() stopped at the
first entry it could not route and leaked it and the rest of the work
queue, which no caller frees.  Destroy an entry that cannot be routed
and go on with the next.

Reviewed by:            kp
MFC after:              2 weeks
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D60532
DeltaFile
+7-4sys/netpfil/pf/pf_table.c
+7-41 files

HardenedBSD/src ac64294 — sys/arm64/arm64 busdma_bounce.c

arm64: Relax memory barriers around DMA operations

Before and after DMA operations we need memory barriers to ensure
stores on the CPU are observed by the device, and stores by the device
are observed by the CPU.

Previously we used a "dsb sy" instruction, however this is too strong
and can lead to slower performance.

Drew Gallatin found and tested the issue with cache-coherent devices,
reducing the barriers to dmb instructions in the outer-shareable
domain. After discussing the issue with the Arm Linux DMA maintainer I
concluded it was safe for non-coherent devices as the only dsb
instructions we need are after cache operations and these already exist.

Replace the dsb before DMA with a "dmb oshst" when cache-coherent, or
the existing dsb after invalidating the cache when not coherent. This
ensures earlier stores have completed before we signal the device.


    [7 lines not shown]
DeltaFile
+9-3sys/arm64/arm64/busdma_bounce.c
+9-31 files

HardenedBSD/src 167d356 — sys/arm64/vmm vmm_instruction_emul.c

arm64/vmm: Treat Rt=31 as xzr in reg & instr emul

For certain instructions like msr, mrs, ldr & str, Rt=31 means the
operand is the Zero register (XZR) as opposed to the SP, even though the
two share the encoding of 31 on AArch64.

This is currently ignored in register and instruction emulation, so
emulated guest operations like "msr <reg>, xzr" will set the value of
<reg> to the current value of the SP instead of to 0.

Skip set and get operations when Rt=31 to correct the behaviour.

Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
Reviewed by:    andrew
Sponsored by:   Arm Ltd
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2454
DeltaFile
+25-8sys/arm64/vmm/vmm_instruction_emul.c
+25-81 files

HardenedBSD/src 83f5b5c — sys/sys param.h

__FreeBSD_version: Bump for changing pkthdr layout

Changing the layout of the pkthdr requires external drivers
to be rebuilt, lest they access the wrong fields.

Sponored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60691
DeltaFile
+1-1sys/sys/param.h
+1-11 files

HardenedBSD/src 9890a0d — sys/sys mbuf.h

mbuf: move leaf_rcv union farther back in the pkthdr

When the leaf_rcv union was introduced to support ktls RX offload in
4d88d81c3166 it was put at the front of the pkthhdr, and pushed the
more commonly accessed csum_flags and rsstype into the next cacheline.

Given that csum_flags is accessed on every pkt sent and every pkt freed,
but the leaf_rcv fields are only used for ktls rx offload, it makes more
sense to have csum_flags in a cacheline that is already likely to be hot.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D60691
Sponsored by: Netflix
DeltaFile
+7-7sys/sys/mbuf.h
+7-71 files

HardenedBSD/src 74d2a0b — sys/netpfil/pf pf_nl.h pf_nl.c

pf: Parse the GETSTATES state id as 64 bits

The GETSTATES dump sends PF_ST_ID as a u64, but the request parser
reads it as a u32 and rejects an id taken from the dump with EINVAL.
Nothing in base sends PF_ST_ID.  Parse and document it as a u64.

Reviewed by:            kp
Fixes:                  2cef62886dc7 ("pf: convert state retrieval to netlink")
MFC after:              1 week
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D60543
DeltaFile
+2-2sys/netpfil/pf/pf_nl.c
+1-1sys/netpfil/pf/pf_nl.h
+3-32 files

HardenedBSD/src 9664345 — lib/libpfctl libpfctl.h libpfctl.c

libpfctl: Return max_win and mss of state peers

The kernel sends PF_STP_MAX_WIN and PF_STP_MSS for both peers of a
state, but struct pfctl_state_peer has no fields for them and libpfctl
dropped them.  Add the fields and parse the attributes.

Reviewed by:            kp
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D60544
DeltaFile
+2-0lib/libpfctl/libpfctl.h
+2-0lib/libpfctl/libpfctl.c
+4-02 files

HardenedBSD/src b43c4d8 — sys/dev/bnxt/bnxt_en bnxt.h bnxt_mpc.c

if_bnxt: fix powerpc build of the MPC ring code

powerpc has no 16-bit acquire/release atomics, so the
atomic_load_acq_16() and atomic_store_rel_16() calls on the MPC TX
ring indices fail to build there. Make the producer and consumer
indices 32 bits wide and use the 32-bit primitives.

Reviewed by:    gallatin, chandrakanth.patil_broadcom.com
Sponsored by:   Broadcom Inc
MFC after:      1 week
Fixes: 088a42c0ff76 ("if_bnxt: add MPC (Mid-Path Channel) ring infrastructure")
Differential Revision: https://reviews.freebsd.org/D60698
DeltaFile
+7-8sys/dev/bnxt/bnxt_en/bnxt_mpc.c
+2-2sys/dev/bnxt/bnxt_en/bnxt.h
+9-102 files

HardenedBSD/src deadb35 — sys/sys syscallsubr.h

updateuio_t: improve comment and style

Reported by:    netchild
Effort:         CHERI upstreaming
Fixes:          afe41f1ab9f6 ("sys/uio: add updateiov()")
Sponsored by:   Innovate UK
Differential Revision:  https://reviews.freebsd.org/D60169
DeltaFile
+5-3sys/sys/syscallsubr.h
+5-31 files

HardenedBSD/src 228d2ac — sys/kern vfs_subr.c

Reformat the shutdown messages when debug.bootverbose is set

Reported by:    bz
Fixes:          b551cb063c5 ("During shutdown, announce each file system")
MFC after:      1 week
Sponsored by:   ConnectWise
Differential Revision: https://reviews.freebsd.org/D59744
DeltaFile
+2-2sys/kern/vfs_subr.c
+2-21 files

HardenedBSD/src af08f29 — tests/sys/fs/ufs sync_test.c

tests/sys/fs/ufs/sync_test.c: hide the alignment warning

Reported and tested by: dhw
Fixes:  afe1dec7425c ("tests: add UFS synchronous write durability tests")
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-2tests/sys/fs/ufs/sync_test.c
+2-21 files

HardenedBSD/src b951994 — sys/netpfil/pf pf_ioctl.c

pf: Set the reassembly flags under the rules lock

DIOCSETREASS stored V_pf_status.reass twice with no lock, first the
flags it was given and then, if reassembly was not among them, zero.
pf_normalize_ip() and pf_normalize_ip6() read the flags with the rules
lock held for reading, so a packet could see the intermediate value.
Compute the flags first and store them once, with the rules lock held
for writing, as DIOCSETDEBUG and DIOCSETHOSTID do.

Reviewed by:            kp
Fixes:                  39282ef356db ("pf: backport OpenBSD syntax of "scrub" option for "match" and "pass" rules")
MFC after:              2 weeks
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D60531
DeltaFile
+7-3sys/netpfil/pf/pf_ioctl.c
+7-31 files

HardenedBSD/src b5219c0 — sys/netpfil/pf pf_lb.c, tests/sys/netpfil/pf nat.sh

pf: first-match-wins for nat rules, even in anchors

Ensure we stop evaluating nat rules if we find a match in a nat-anchor.

PR:             299320
MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+46-0tests/sys/netpfil/pf/nat.sh
+4-0sys/netpfil/pf/pf_lb.c
+50-02 files

HardenedBSD/src ee8cb6a — tests/sys/netinet6 ndp.sh

tests/netinet6: Turn off stable addresses in ndp_prefix_len_mismatch

ndp_prefix_len_mismatch exercises the fallback in in6_ifadd() for an
interface whose link-local address does not have the advertised prefix
length (9e792f7ef729).  Since a2eb0894b79b made stable addresses
(RFC 7217) the default, in6_ifadd() takes the interface identifier from
in6_get_stableifid() and never looks at the link-local address, so the
case passes without reaching the fallback.  Turn stable addresses off
on the interface.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-0tests/sys/netinet6/ndp.sh
+2-01 files

HardenedBSD/src 2272fac — lib/libpmc pmc.perf.3, sys/amd64/amd64 initcpu.c

hwpmc: Add support for AMD-only IRPERF in hwpmc PERF class

The IRPERF MSR counter (0xc00000e9) exposes an instructions-retired count
when read. Its support is advertised through CPUID leaf 0x80000008 EBX bit 1.
If this bit is set, the CPU supports the IRPERF MSR. For it to be used
by the system, bit 30 of the HWCR MSR (0xC0010015) needs to be enabled.

This patch checks for availability of the feature and enables the bit. If
the feature is available, the hwpmc PERF class detects its presence and
registers a third PERF MSR counter that allows hwpmc users to measure
instructions retired using IRPERF. This is AMD-only, as Intel does not
support IRPERF.

Due to erratum #1054 affecting AMD Zen 1 before model 30h, IRPERF is only
enabled for AMD Zen 1 model 30h onwards and later microarchitectures. This
commit also implements a validation step to make sure the IRPERF counter
is actually incrementing; otherwise, the feature is not enabled. This
guarantees it is working as expected before being made available to the
system and users.

    [20 lines not shown]
DeltaFile
+66-58sys/dev/hwpmc/hwpmc_perf.c
+69-10lib/libpmc/pmc.perf.3
+31-0sys/amd64/amd64/initcpu.c
+23-0sys/x86/include/specialreg.h
+14-1sys/dev/hwpmc/hwpmc_amd.c
+7-7sys/dev/hwpmc/hwpmc_perf.h
+210-762 files not shown
+215-808 files

HardenedBSD/src f4ff995 — sys/net pfil.c

pfil: Avoid potential mbuf tag leak

In '398254f9999e mbuf: simplify m_free' we removed tag processing
on m_free() of M_NOFREE mbufs. It is possible that a packet filter
could attach a tag to this stack mbuf and call m_free()
on it, meaning that 398254f9999e may have introduced a tag leak.

However,if a tag is attached without anyone calling m_free(), then
this leak was pre-existing.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D60686
Fixes: 398254f9999e
Sponsored by: Netflix
DeltaFile
+2-0sys/net/pfil.c
+2-01 files

HardenedBSD/src 9777ce4 — tools/test/stress2/misc rename15.sh

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+26-12tools/test/stress2/misc/rename15.sh
+26-121 files

HardenedBSD/src 41c9734 — tools/test/stress2/misc rename15.sh

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+26-12tools/test/stress2/misc/rename15.sh
+26-121 files