HardenedBSD/src 2e5472cinclude/rpc xdr.h, lib/libc/xdr xdr.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+5-7sys/sys/buf_ring.h
+8-2sys/dev/dpaa2/dpaa2_ni.c
+1-8sys/rpc/xdr.h
+1-8include/rpc/xdr.h
+7-0lib/libc/xdr/xdr.c
+7-0sys/xdr/xdr.c
+29-253 files not shown
+34-299 files

HardenedBSD/src 5c80af6include/rpc xdr.h, lib/libc/xdr xdr.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+5-7sys/sys/buf_ring.h
+8-2sys/dev/dpaa2/dpaa2_ni.c
+1-8include/rpc/xdr.h
+1-8sys/rpc/xdr.h
+7-0lib/libc/xdr/xdr.c
+7-0sys/xdr/xdr.c
+29-253 files not shown
+34-299 files

HardenedBSD/src 498fe07sys/sys buf_ring.h

buf_ring: Rename some variables

The elements we store in buffer rings are buffers, so refer to them as
`buf` throughout instead of a mixture of `buf`, `ret`, and `new`,
especially since the latter breaks C++ code that directly or indirectly
includes this header.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    siderop1_netapp.com, markj
Differential Revision:  https://reviews.freebsd.org/D54827
DeltaFile
+5-7sys/sys/buf_ring.h
+5-71 files

HardenedBSD/src e17d7ablib/libc/xdr xdr.c, sys/xdr xdr.c

xdr_string: don't leak strings with xdr_free

Historically (and in a small amount of older software such as OpenAFS),
developers would attempt to free XDR strings with

        xdr_free((xdrproc_t)xdr_string, &string)

This resulted in xdr_free calling xdr_string with only two intentional
arguments and whatever was left in the third argument register.  If the
register held a sufficently small number, xdr_string would return FALSE
and not free the string (no one checks the return values).

Software should instead free strings with:

        xdr_free((xdrproc_t)xdr_wrapstring, &string)

Because buggy software exists in the wild, act as though xdr_wrapstring
was used in the XDR_FREE case and plug these leaks.


    [5 lines not shown]
DeltaFile
+7-0sys/xdr/xdr.c
+7-0lib/libc/xdr/xdr.c
+14-02 files

HardenedBSD/src ac5a19einclude/rpc xdr.h, lib/libc/rpc rpc.3

rpc/xdr.h: make xdrproc_t always take two arguments

The type of xdrproc_t is clearly defined in the comments as a function
with two arguments, an XDR * and a void * (sometimes spelled caddr_t).
It was initialy defined as:

        typedef bool_t (*xdrproc_t)();

At some point people started giving it a non-empty argument list.
Unfortunatly, there has been widespread disagreement about how arguments
are passed.  There seems to have been a widespread view that it should
be allowed to pass three argument function pointer to xdrproc_t.  Most
notable is xdr_string which takes a maximum length parameter. This lead
to all sorts of prototypes (all of which have been present in the
FreeBSD source tree):

FreeBSD userspace (nominally from tirpc, but seemingly local):
        typedef bool_t (*xdrproc_t)(XDR *, ...);
FreeBSD kernel, glibc:

    [36 lines not shown]
DeltaFile
+1-8sys/rpc/xdr.h
+1-8include/rpc/xdr.h
+2-2lib/libc/rpc/rpc.3
+2-1sys/contrib/openzfs/module/nvpair/nvpair.c
+1-1sys/sys/param.h
+7-205 files

HardenedBSD/src f31336bsys/dev/dpaa2 dpaa2_ni.c

dpnaa2: announce transmit checksum support

Let the network stack know that the NIC supports checksum offloading
for the IPv4 header checksum and the TCP and UDP transport checksum.
This avoids the computation in software and therefore provides the
expected performance gain.

PR:                     292006
Reviewed by:            dsl, Timo Völker
MFC after:              3 days
Differential Revision:  https://reviews.freebsd.org/D54809
DeltaFile
+8-2sys/dev/dpaa2/dpaa2_ni.c
+8-21 files

HardenedBSD/src 03a7a1asys/amd64/include ifunc.h, sys/i386/include ifunc.h

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+34-6sys/x86/x86/local_apic.c
+5-0sys/i386/include/ifunc.h
+0-5sys/netlink/ktest_netlink_message_writer.c
+5-0sys/amd64/include/ifunc.h
+1-1sys/netlink/ktest_netlink_message_writer.h
+45-125 files

HardenedBSD/src c80c367sys/amd64/include ifunc.h, sys/i386/include ifunc.h

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+34-6sys/x86/x86/local_apic.c
+5-0sys/i386/include/ifunc.h
+0-5sys/netlink/ktest_netlink_message_writer.c
+5-0sys/amd64/include/ifunc.h
+1-1sys/netlink/ktest_netlink_message_writer.h
+45-125 files

HardenedBSD/src 8352e24sys/netlink ktest_netlink_message_writer.c ktest_netlink_message_writer.h

tests/ktest_netlink_message_writer: remove INVARIANTS requirement

INVARIANTS is meant to be used to enable extra sanity checking for
internal structures, not enable/disable tests in the freebsd kyua
test suite.

STABLE branches include a GENERIC kernconf without INVARIANTS, so
ktest_netlink_message_writer is broken on such branches:

https://ci.freebsd.org/job/FreeBSD-stable-15-amd64-test/253/testReport/sys.netlink.test_netlink_message_writer/py/__test_cases_list__/

Reviewed by:    lwhsu, imp
Approved by:    lwhsu (mentor)
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1889
MFC after:      3 days
Signed-off-by:  Siva Mahadevan <siva at FreeBSD.org>
Sponsored by:   The FreeBSD Foundation
DeltaFile
+0-5sys/netlink/ktest_netlink_message_writer.c
+1-1sys/netlink/ktest_netlink_message_writer.h
+1-62 files

HardenedBSD/src 2b1db07sys/amd64/include ifunc.h, sys/i386/include ifunc.h

x86: add machine/ifunc.h

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+5-0sys/amd64/include/ifunc.h
+5-0sys/i386/include/ifunc.h
+10-02 files

HardenedBSD/src dfc4186sys/x86/x86 local_apic.c

x86 lapic: Dump LVTs from the ddb show lapic command

Add description for each LVT element, use it in show lapic dump.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+34-6sys/x86/x86/local_apic.c
+34-61 files

HardenedBSD/src 1578f8esbin/mdmfs mdmfs.c, usr.sbin/syslogd/tests syslogd_test.sh syslogd_test_common.sh

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+144-161usr.sbin/syslogd/tests/syslogd_test.sh
+52-5usr.sbin/syslogd/tests/syslogd_test_common.sh
+16-26usr.sbin/syslogd/tests/syslogd_forwarded_format_test.sh
+12-18usr.sbin/syslogd/tests/syslogd_relayed_format_test.sh
+11-17usr.sbin/syslogd/tests/syslogd_basic_format_test.sh
+2-10sbin/mdmfs/mdmfs.c
+237-2374 files not shown
+248-24310 files

HardenedBSD/src c8fff18lib/libfetch fetch.3, usr.sbin/syslogd/tests syslogd_test.sh syslogd_test_common.sh

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+144-161usr.sbin/syslogd/tests/syslogd_test.sh
+52-5usr.sbin/syslogd/tests/syslogd_test_common.sh
+16-26usr.sbin/syslogd/tests/syslogd_forwarded_format_test.sh
+12-18usr.sbin/syslogd/tests/syslogd_relayed_format_test.sh
+11-17usr.sbin/syslogd/tests/syslogd_basic_format_test.sh
+8-4lib/libfetch/fetch.3
+243-2314 files not shown
+248-24310 files

HardenedBSD/src 4b96204sbin/mdmfs mdmfs.c

mdmfs: Fix soft updates logic

Now that newfs(8) has a command-line argument to disable soft updates,
use that instead of running tunefs(8) after the fact to turn them off.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    mckusick, imp
Differential Revision:  https://reviews.freebsd.org/D54783
DeltaFile
+2-10sbin/mdmfs/mdmfs.c
+2-101 files

HardenedBSD/src 0dcccd1share/man/man5 src.conf.5, share/mk src.opts.mk

HBSD: Resolve merge conflicts

Regen src.conf.5.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+10-8share/man/man5/src.conf.5
+0-3share/mk/src.opts.mk
+10-112 files

HardenedBSD/src 14dce73usr.sbin/syslogd/tests syslogd_test_common.sh syslogd_test.sh

syslogd/tests: Fix flakiness in forwarding tests

syslogd_start() waits for the local log socket to appear before
returning, to ensure that the daemon is ready to handle log messages.
Some tests start two daemons, so by default the socket already exists
when the second daemon is started, so syslogd_start() returns early.
The test subsequently sends a message to this second daemon, which
sometimes isn't ready.

Define a separate log socket for the second daemon.  Add a check to
syslogd_start() to help catch this type of bug.

Reviewed by:    jlduran
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D54800
DeltaFile
+7-2usr.sbin/syslogd/tests/syslogd_test_common.sh
+5-3usr.sbin/syslogd/tests/syslogd_test.sh
+12-52 files

HardenedBSD/src 92d2514usr.sbin/syslogd/tests syslogd_test_common.sh syslogd_test.sh

syslogd/tests: Improve loopback interface initialization

- In syslogd_start(), assign the lo0 address in the specified jail.
- Use the correct netmask.

Reviewed by:    jlduran
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D54799
DeltaFile
+5-3usr.sbin/syslogd/tests/syslogd_test_common.sh
+0-4usr.sbin/syslogd/tests/syslogd_test.sh
+5-72 files

HardenedBSD/src 560c229usr.sbin/syslogd/tests syslogd_test.sh syslogd_forwarded_format_test.sh

syslogd/tests: Address races

I occasionally see failures in the syslogd test suite.  The problem is
that the tests are racy: they send a message using logger(1), then
immediately check whether the message was logged to a log file.  If the
syslogd instance under test doesn't get a chance to run before the
second step, the test fails.

This change reworks things to avoid the race while minimizing the amount
of time sleeping.
1) Each test uses a single logfile, so have them use a new common
   variable, SYSLOGD_LOGFILE, instead of something test-specific.
2) In syslogd_start(), if the configuration references SYSLOGD_LOGFILE,
   wait for it to be created by syslogd before returning.
3) Add a helper syslogd_check_log(), to check for a given log entry in
   the last line of SYSLOGD_LOGFILE, instead of using atf_check
   directly.
4) In syslogd_check_log(), poll the logfile until the desired log entry
   appears, or the test times out.

    [8 lines not shown]
DeltaFile
+112-129usr.sbin/syslogd/tests/syslogd_test.sh
+16-26usr.sbin/syslogd/tests/syslogd_forwarded_format_test.sh
+33-0usr.sbin/syslogd/tests/syslogd_test_common.sh
+12-18usr.sbin/syslogd/tests/syslogd_relayed_format_test.sh
+11-17usr.sbin/syslogd/tests/syslogd_basic_format_test.sh
+0-1usr.sbin/syslogd/tests/syslogd_format_test_common.sh
+184-1916 files

HardenedBSD/src ffdbc1busr.sbin/syslogd/tests syslogd_test.sh syslogd_test_common.sh

syslogd/tests: Use a helper function to log from within a jail

This is just for consistency with all other logger(1) invocations, which
happen from the syslogd_log() function.

No functional change intended.

Reviewed by:    jlduran
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D54778
DeltaFile
+31-29usr.sbin/syslogd/tests/syslogd_test.sh
+7-0usr.sbin/syslogd/tests/syslogd_test_common.sh
+38-292 files

HardenedBSD/src dec3ea4lib/libiconv_modules/mapper_std citrus_mapper_std.c

libiconv: Fix typo in comment
DeltaFile
+1-1lib/libiconv_modules/mapper_std/citrus_mapper_std.c
+1-11 files

HardenedBSD/src 129aec7lib/libfetch fetch.3 common.c

libfetch: allow disabling TLS v1.3 when the connection

MFC after:      3 days
DeltaFile
+8-4lib/libfetch/fetch.3
+2-0lib/libfetch/common.c
+10-42 files

HardenedBSD/src f786ac5lib/libfetch common.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+8-0lib/libfetch/common.c
+8-01 files

HardenedBSD/src 4da9e4flib/libfetch common.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+8-0lib/libfetch/common.c
+8-01 files

HardenedBSD/src 8f8a7f6lib/libfetch common.c

libfetch: apply timeout to SSL_read()

Currently, fetchTimeout works for non-SSL connections only, so does fetch -T.
Fix it applying specified timeout to SSL_read().

MFC after:      3 days
DeltaFile
+8-0lib/libfetch/common.c
+8-01 files

HardenedBSD/src 3a5f9b9sys/x86/cpufreq hwpstate_amd.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+7-1sys/x86/cpufreq/hwpstate_amd.c
+7-11 files

HardenedBSD/src 17d9ae7sys/x86/cpufreq hwpstate_amd.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+7-1sys/x86/cpufreq/hwpstate_amd.c
+7-11 files

HardenedBSD/src ad99329sys/x86/cpufreq hwpstate_amd.c

hwpstate: Add CPPC enable tunable

The Framework 13 runs very hot the maximum frequency is possible. By
disabling CPPC (reverting to Cool`n'Quiet 2.0) we can use powerd to
limit the CPU frequency to 2200, thereby reducing the CPU temperature.

Some systems may run slower with CPPC enabled. See PR/292615 for that
bug.

Those experiencing either of these issues may add the following to
their loader.conf or device.hints to disable CPPC:

machdep.hwpstate_amd_cppc_enable="0"

PR:                     292615
Reviewed by:            lwhsu, olce
Differential revision:  https://reviews.freebsd.org/D54803
DeltaFile
+7-1sys/x86/cpufreq/hwpstate_amd.c
+7-11 files

HardenedBSD/src fafed4asys/contrib/dev/athk/ath10k testmode.c core.c, sys/contrib/dev/rtw88 bf.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+234-41sys/contrib/dev/athk/ath10k/testmode.c
+48-0usr.bin/truncate/tests/truncate_test.sh
+11-17sys/contrib/dev/athk/ath10k/core.c
+18-1sys/contrib/dev/athk/ath10k/wmi.h
+15-0sys/contrib/dev/athk/ath10k/testmode_i.h
+7-1sys/contrib/dev/rtw88/bf.c
+333-6010 files not shown
+358-6616 files

HardenedBSD/src dfa4e28sys/contrib/dev/athk/ath10k testmode.c core.c, sys/contrib/dev/rtw88 bf.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+234-41sys/contrib/dev/athk/ath10k/testmode.c
+48-0usr.bin/truncate/tests/truncate_test.sh
+11-17sys/contrib/dev/athk/ath10k/core.c
+18-1sys/contrib/dev/athk/ath10k/wmi.h
+15-0sys/contrib/dev/athk/ath10k/testmode_i.h
+7-1sys/contrib/dev/rtw88/bf.c
+333-6010 files not shown
+358-6616 files

HardenedBSD/src bb9542dshare/man/man9 printf.9, sys/dev/dwc dwc1000_dma.c

Merge remote-tracking branch 'origin/freebsd/15-stable/main' into hardened/15-stable/main

Conflicts:
        share/man/man5/src.conf.5 (unresolved)
        share/mk/src.opts.mk (unresolved)
DeltaFile
+100-51usr.sbin/sndctl/sndctl.c
+31-23sys/dev/virtio/network/virtio_net.h
+31-9sys/kern/subr_prf.c
+36-0sys/dev/virtio/network/if_vtnet.c
+18-8share/man/man9/printf.9
+9-16sys/dev/dwc/dwc1000_dma.c
+225-10728 files not shown
+358-15634 files