FreeBSD/src 69141e7 — usr.sbin/bhyve ipc.c

bhyve: disable SIGPIPE for IPC connections

Currently, if an IPC client (e.g. bhyvectl --get-vm-pid) exits
before reading the response, the VM crashes with SIGPIPE.
Set SO_NOSIGPIPE on a socket to prevent that.

While here, update other error paths in init_ipc_thread()
to return -1 on error instead of an error number to make error
handling consistent.

Reviewed by:    markj
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D62000
DeltaFile
+12-4usr.sbin/bhyve/ipc.c
+12-41 files

FreeBSD/src 75599b3 — sys/netpfil/pf pf_ioctl.c

pf: fix unlocked anchor access in DIOCGETETHRULESET

We accessed anchor->name and ruleset->anchor->path outside of the rules lock.
Extend the lock coverage.

Reported by:    llm-postcr
Fixes:          e732e742b37f ("pf: Initial Ethernet level filtering code")
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-1sys/netpfil/pf/pf_ioctl.c
+2-11 files

FreeBSD/src c514361 — sys/netpfil/pf pf_ioctl.c

pf: fix memory leak on failure in DIOCADDETHRULE

If we fail pf_nveth_rule_to_keth_rule() we jumped to
DIOCADDETHRULE_error, which doesn't free the rule.
Free the rule directly, because pf_free_eth_rule() expects the rules
lock to be held, and at this point we've only allocated the rule itself,
not any of the child objects.

Reported by:    llm-postcr
Fixes:          e732e742b37f ("pf: Initial Ethernet level filtering code")
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+3-1sys/netpfil/pf/pf_ioctl.c
+3-11 files

FreeBSD/src dde37e7 — sys/netpfil/pf pf_ioctl.c

pf: fix NULL dereference on failure in DIOCADDETHRULE

If the ticket or anchor check in DIOCADDETHRULE fails
we pf_free_eth_rule() on a struct pf_keth_rule with NULL
ipsrc.addr.p.tbl/ipdst.addr.p.tbl. That ends up dereferencing that NULL
pointer.

Teach pf_free_eth_rule() to check for NULL in those fields so it's safe
to free a rule we're in the process of creating.

Reported by:    llm-postcr
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+8-4sys/netpfil/pf/pf_ioctl.c
+8-41 files

FreeBSD/src 653c5d3 — usr.sbin/bhyve pci_emul.c

bhyve: fix bootorder for PCI slots >= 10

Currently, bhyve writes slots as decimals. Firmware such as EDK2
interprets them as hexadecimals, so slot 10 becomes 16, breaking
the configured boot order.

Reviewed by:    markj
Fixes:          6632a0a4e3ab ("bhyve: add helper to create a bootorder")
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61997
DeltaFile
+1-1usr.sbin/bhyve/pci_emul.c
+1-11 files

FreeBSD/src e70868a — sys/dev/mmc mmc.c, sys/dev/sdhci sdhci.c

mmc: Allow HS400ES with HS400 at a single I/O voltage

mmc_host_timing() allows HS400ES only if the host supports HS400 at
both 1.2 V and 1.8 V.  A host with only 1.8 V I/O, such as the Zhihe
A210, gets plain HS400 instead, which needs tuning in HS200 first.

Accept HS400 at either voltage, as the plain HS400 check does, and use
the same rule in the sdhci capability printout.

Signed-off-by:  Han Gao <gaohan at iscas.ac.cn>
Reviewed by:    imp
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2523
DeltaFile
+2-4sys/dev/sdhci/sdhci.c
+3-2sys/dev/mmc/mmc.c
+5-62 files

FreeBSD/src c0ca537 — sys/riscv/include cpu.h, sys/riscv/riscv identcpu.c

riscv: Add the T-Head C908 and C920v2 marchid values

Older T-Head cores report a zero marchid, but the C908 and C920v2 have
their own: 0x8000000009140d00 and 0x80000000090c0d00, as read on the
Zhihe A210, whose firmware also uses them to tell its two clusters
apart.  Add them so that these cores are named instead of "Unknown".

Signed-off-by:  Han Gao <gaohan at iscas.ac.cn>
Reviewed by:    mhorne
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2584
DeltaFile
+7-1sys/riscv/riscv/identcpu.c
+4-0sys/riscv/include/cpu.h
+11-12 files

FreeBSD/src a644aba — sys/riscv/riscv locore.S

riscv: Fence after enabling the MMU in locore

Writing satp doesn't flush cached translations. If the kernel is entered
with translation already on, the hart may keep using the firmware's
mappings after locore switches page tables if they share an ASID.

Add an sfence.vma after each satp write in locore.

Signed-off-by:  Han Gao <gaohan at iscas.ac.cn>
Reviewed by:    mhorne
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2522
DeltaFile
+3-0sys/riscv/riscv/locore.S
+3-01 files

FreeBSD/src 608eb81 — sys/riscv/riscv locore.S identcpu.c

riscv: Apply the T-HEAD errata only to early cores

The XTheadMae page attributes and the vendor cache operations are needed
by the early T-HEAD cores (C906, C910, C920), which report zero marchid
and mimpid. Later cores such as the C908 and C920v2 report non-zero
values and implement the standard Svpbmt and Zicbom extensions instead.
Setting the T-HEAD memory attribute bits there makes the early page
tables use reserved PBMT encodings.

Check marchid and mimpid before applying the quirks, both in
handle_thead_quirks() and in the early PTE setup in locore.

Signed-off-by:  Han Gao <gaohan at iscas.ac.cn>
Reviewed by:    mhorne
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2522
DeltaFile
+7-6sys/riscv/riscv/identcpu.c
+5-0sys/riscv/riscv/locore.S
+12-62 files

FreeBSD/src fbb1b88 — usr.sbin/bhyve bhyve_config.5 bhyve.8

bhyve: Reinitialise swtpm's TPM at startup

bhyve does not currently reinitialise swtpm on startup, which results in
PCRs being carried over across reboots. This means that any guest VM
implementing measured boot controls, such as Windows with BitLocker and
Secure Boot enabled, will consider the system compromised and refuse to
start or ask for a recovery key.

swtpm has a control channel that allows us to send commands for that
purpose: CMD_INIT shuts the TPM down and starts it again clearing the
PCRs in the process, like a cold boot on real hardware.

Connect a second socket when the new ctrl_path option is set and send
CMD_INIT there. Without the option nothing changes.

MFC after:      2 weeks
Sponsored by:   Defenso
Signed-off-by:  Quentin Thébault <quentin.thebault at defenso.fr>
Reviewed by:    kevans, novel
Differential Revision:  https://reviews.freebsd.org/D59322
DeltaFile
+126-7usr.sbin/bhyve/tpm_emul_swtpm.c
+18-0usr.sbin/bhyve/bhyve.8
+7-1usr.sbin/bhyve/bhyve_config.5
+151-83 files

FreeBSD/src 6805375 — sys/netpfil/ipfw ip_dummynet.c, tests/sys/netpfil/common dummynet.sh

dummynet: copy only the user-visible scheduler in copy_obj()

For a DN_SCH object copy_obj() writes the whole struct dn_schk (192
bytes on amd64) into the listing buffer, but checks and advances by
o.len, which is sizeof(struct dn_sch) (92 bytes).  The extra bytes,
kernel pointers included, overrun the buffer when the scheduler is
near its end.  "ipfw pipe show" or "dnctl pipe show" is enough, from
the host or from a VNET jail; KASAN reports a 192-byte write in
copy_obj().

Keep only a struct dn_sch in the local copy, which is what the code
wrote before 0ac43d9728a7, and read siht from the struct dn_schk that
contains it.  Add a test that lists pipes and schedulers from a VNET
jail.

PR:             224485
Reported by:    david at catwhisker.org
Reviewed by:    kp
Fixes:          0ac43d9728a7 ("In dummynet(4), random chunks of memory are casted to struct dn_*,")

    [3 lines not shown]
DeltaFile
+27-0tests/sys/netpfil/common/dummynet.sh
+6-4sys/netpfil/ipfw/ip_dummynet.c
+33-42 files

FreeBSD/src b76b052 — lib/libc/stdlib tsearch.3

tdelete(3): Document return value when deleting root node

tsearch.3 said that tdelete() returns a pointer to the parent of the
deleted node, but the root has no parent.  In that case, tdelete()
returns an unspecified non-NULL pointer (currently (void *)1) which must
not be dereferenced.  Document this.

Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61969
DeltaFile
+7-2lib/libc/stdlib/tsearch.3
+7-21 files

FreeBSD/src c4a9734 — sys/rpc clntrdma.h

clntrdma.h: Add the RPCRDMA_HEADER_LEN macro from clnt_rdma.c

The RPCRDMA_HEADER_LEN() macro is moved from clnt_rdma.c to
clntrdma.h so it can be included in xprt_verbs.c.

MFC after:      1 month
Fixes:  884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
DeltaFile
+12-0sys/rpc/clntrdma.h
+12-01 files

FreeBSD/src da12aa2 — sys/ofed/drivers/infiniband/ulp/nfsclrdma clnt_rdma.c xprt_verbs.c

clnt_rdma: Fixes for three issues listed below

There are three small issues:

1. An unused Reply chunk gets its descriptor freed, but the mbuf
and pages are left allocated, effectively leaking.

2. The reused send/receive buffers would probably need
DMA synchronization.

3. Some receive errors don't notify the RPC layer.  A zero-credit
reply can also leave callers waiting.

This patch fixes these.
This patch also fixes positioning of NET_EPOCH().

Reviewed by:    rmacklem
Sponsored by:   VersatusHPC
MFC after:      1 month
DeltaFile
+26-5sys/ofed/drivers/infiniband/ulp/nfsclrdma/xprt_verbs.c
+6-0sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+32-52 files

FreeBSD/src 1155c9a — sys/ofed/drivers/infiniband/ulp/nfsclrdma clnt_rdma.c

clnt_rdma.c: Fix handling of a client reply retried reply

When the client does a retry (due to an expired RPCSEC_GSS credential),
the handling of the reply chunk was not done correctly.

This patch fixes this.

Reviewed by:    rmacklem
Sponsored by:   VersatusHPC
MFC after:      1 month
DeltaFile
+8-0sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+8-01 files

FreeBSD/src 9462179 — sys/dev/hwpmc hwpmc_amd.c, tests/sys/pmc/amd pmc_rowalloc_test.c

hwpmc_amd: Allow only system counting on L3, DF and UMC counters

These counters are shared by several CPUs, a CCX in the case of L3.  A
process-mode PMC is loaded on every CPU that runs a target thread, so
two CPUs can program the same counter.  Without PerfMonV2, an INVARIANTS
kernel then panics with "Starting active PMC"; otherwise the counts are
wrong.  No privilege is needed: on Zen 1-3, "pmcstat -P LLC_MISSES" is
enough.  System sampling is accepted too, but no interrupt handler
checks these counters.

Refuse every mode but PMC_MODE_SC, as the RAPL, PERF and TSC classes do.
Two system-mode PMCs on CPUs that share a counter can still conflict;
that is left to userland, as before.

PR:             296001
Reported by:    asomers
Reviewed by:    mhorne
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D61949
DeltaFile
+97-0tests/sys/pmc/amd/pmc_rowalloc_test.c
+10-0sys/dev/hwpmc/hwpmc_amd.c
+107-02 files

FreeBSD/src 38acb5b — sys/ofed/drivers/infiniband/ulp/nfsclrdma xprt_verbs.c clnt_rdma.c

clnt_rdma.c: Fix client recovery from connect loss

After a local send or receive error, clnt_rdma_call() marks the
connection disconnected, but other RPCs can remain asleep on it.
The attached patch wakes those callers so they can reconnect.

I tested this by forcing a send failure while other RPCs were pending.

Without this patch the client simple stalls.

Reviewed by:    rmacklem
Sponsored by:   VersatusHPC
MFC after:      1 month
DeltaFile
+21-5sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+1-0sys/ofed/drivers/infiniband/ulp/nfsclrdma/xprt_verbs.c
+22-52 files

FreeBSD/src c2f9ee0 — sys/opencrypto cryptodev.c

cryptodev: zero key material before freeing it

The /dev/crypto cipher and MAC keys are copied from userland and
released with free(), leaving the key bytes in freed kernel memory.
Use zfree() so the key material is cleared on session teardown and on
the setup error path.

Reviewed by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D61324

(cherry picked from commit edaa6ba7be8666d4f543317845899e1a1b684bbf)
DeltaFile
+4-4sys/opencrypto/cryptodev.c
+4-41 files

FreeBSD/src 6bcd61d — stand/i386/gptzfsboot zfsboot.c

gptzfsboot: Use snprintf() to format file names

The stack buffer in fs_list() can be overflowed if a file name is too
long.

Reported by:    Yudi Yang <yudi.yang at rice.edu>
MFC after:      1 week

(cherry picked from commit 956a05c3cbf5f5cb9d1c4d58e3a5fc22db1446b8)
DeltaFile
+1-1stand/i386/gptzfsboot/zfsboot.c
+1-11 files

FreeBSD/src 2e2f6d9 — sys/dev/gve gve_main.c gve_adminq.c

gve: Fix AdminQ buffer DMA sync directions

In gve_verify_driver_compatibility(), the driver populates the
gve_driver_info buffer for the device to read. Sync this buffer with
BUS_DMASYNC_PREWRITE instead of BUS_DMASYNC_PREREAD before issuing
the command.

In gve_adminq_describe_device(), the device populates the
gve_device_descriptor buffer for the driver to read. Sync this buffer
with BUS_DMASYNC_PREREAD instead of BUS_DMASYNC_PREWRITE before
issuing the command.

In gve_adminq_get_ptype_map_dqo(), the device populates the
gve_ptype_map buffer for the driver to read. Add the missing
BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTREAD syncs around the
command.

In normal GCP environments this did not cause a functional failure
because the underlying platforms are DMA cache-coherent and

    [14 lines not shown]
DeltaFile
+5-1sys/dev/gve/gve_adminq.c
+1-1sys/dev/gve/gve_main.c
+6-22 files

FreeBSD/src bc40580 — sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

pmap: Fix some bugs around accounting of wired mappings

The amd64 and arm64 pmaps failed to decrement the count when tearing
down a 1GB largepage mapping.  The riscv pmap failed to decrement the
count when unwiring a superpage mapping.

Reported by:    alc
Reviewed by:    bnovkov, alc, kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D61414

(cherry picked from commit da507ac5503d9af35f5aff4a7a773f6a92746e4a)
DeltaFile
+3-0sys/arm64/arm64/pmap.c
+2-0sys/riscv/riscv/pmap.c
+2-0sys/amd64/amd64/pmap.c
+7-03 files

FreeBSD/src 42e71f0 — sys/compat/freebsd32 freebsd32_misc.c

procctl: Zero the output structure for the compat32 syscall

Otherwise the freebsd32 implementation of PROC_REAP_STATUS leaks
uninitialized kernel stack memory.

Reviewed by:    kib
Reported by:    Dennys Kaluzny Pereira <dennyskaluzny at gmail.com>
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61510

(cherry picked from commit 5a834ad15f1f09d43a6840c74da194db6f890aa2)
DeltaFile
+1-0sys/compat/freebsd32/freebsd32_misc.c
+1-01 files

FreeBSD/src 9f880eb — sys/amd64/vmm vmm_instruction_emul.c

vmm: Emulate the byte forms of OR and AND with an immediate

Opcode 0x80 (group 1: r/m8, imm8) is in the decode table and
emulate_cmp() handles 80 /7, but emulate_or() and emulate_and() only
accept 0x81 and 0x83.  An "or byte ptr [mem], imm8" or "and byte ptr
[mem], imm8" on emulated memory therefore fails with EINVAL and bhyve
stops the guest with "Failed to emulate instruction sequence
[ 80 ... ]".  Seen with macOS: VoodooHDA starts the HDA controller's
CORB with "or byte [rax+0x4c], 2" (CORBCTL |= CORBRUN), and the guest
died at the first sound.

Accept 0x80 in both, with a one byte operand as emulate_cmp() does.
The file is shared with bhyve(8), so the fix covers the in-kernel
devices (HPET, local APIC without APICv, I/O APIC) and the user space
device models alike.

Signed-off-by: Wanpeng Qian <wanpengqian at gmail.com>

Reviewed by:    markj

    [5 lines not shown]
DeltaFile
+12-0sys/amd64/vmm/vmm_instruction_emul.c
+12-01 files

FreeBSD/src 1277605 — sys/arm64/arm64 elf_machdep.c, sys/kern imgact_elf.c

imgact_elf: Pass program headers to the sv_protect hook

We handle program headers beyond the first page of the file, but
arm64_exec_protect() wasn't updated to handle this.  Pass the program
header array directly to the sv_protect hook.

Also fix a pre-existing bug: imgp->et_dyn_addr isn't the right base
address to use for the SV_INTERP case.

Reported by:    alc
Reviewed by:    alc, kib
Fixes:          804daf166406 ("imgact_elf: read program headers if not contained in the first page")
Fixes:          670af174e27b ("arm64: Enable BTI in the kernel ELF loader")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61999

(cherry picked from commit 884e1a00151d181e5dd1ba9d83c1adcffd25e5e8)
DeltaFile
+6-4sys/arm64/arm64/elf_machdep.c
+2-2sys/kern/imgact_elf.c
+2-1sys/sys/sysent.h
+10-73 files

FreeBSD/src 620a123 — sys/dev/gve gve_tx_dqo.c gve_rx_dqo.c

gve: Page-align DQO descriptor and completion rings

Currently, gve_rx_alloc_ring_dqo() and gve_tx_alloc_ring_dqo() request
CACHE_LINE_SIZE alignment when allocating DMA memory for the DQO TX/RX
descriptor and completion rings. The device requires stronger alignment
than cache line alignment, which was incidentally being met due to how
the kernel allocates memory. Explicitly meet this requirement by
requesting page aligned memory.

Signed-off-by: Tim Hostetler <thostet at google.com>

Reviewed by:    markj, Jasper Tran O'Leary <jtranoleary at google.com>
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61211

(cherry picked from commit 9d48e88e023634e12530bf9db4a2e85d022b93db)
DeltaFile
+2-2sys/dev/gve/gve_tx_dqo.c
+2-2sys/dev/gve/gve_rx_dqo.c
+4-42 files

FreeBSD/src 4b1d247 — etc/mtree BSD.tests.dist

BSD.tests.dist: Add the new sys/libkern directory

Without that, 'make distributeworld' fails ('make buildworld' and 'make
installworld' do not need it).

Reported by:    llm-postcr
Fixes:          1a80570a3940 ("tests/sys: Move libkern's tests in a separate directory")
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-0etc/mtree/BSD.tests.dist
+2-01 files

FreeBSD/src b2e0fce — tests/sys/pmc/amd amd_pmc_test_common.h pmc_ibs_test.c

tests/sys/pmc/amd: Call pmc_cpuinfo() in amd_test_find_classinfo()

Every caller of amd_test_find_classinfo() calls pmc_cpuinfo() right
before it.  Do that in the helper and drop the ibs_classinfo() and
rapl_classinfo() wrappers.

rapl_domains_test now fails instead of skipping when pmc_cpuinfo()
fails after pmc_init() succeeded, like the other tests.

Suggested by:   mhorne
Reviewed by:    mhorne
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D62106
DeltaFile
+4-13tests/sys/pmc/amd/pmu_detect_test.c
+2-14tests/sys/pmc/amd/rapl_domains_test.c
+2-12tests/sys/pmc/amd/pmc_ibs_test.c
+5-6tests/sys/pmc/amd/amd_pmc_test_common.h
+13-454 files

FreeBSD/src a87de9c — tests/sys/pmc/amd pmu_mux_test.c pmc_rowalloc_test.c

tests/sys/pmc/amd: Skip in guests without a PMU

In a guest that shows an AMD Zen CPU but has no PMU, hwpmc(4) registers
neither the AMD core class nor IBS.  pmc_rowalloc_test, pmu_mux_test and
pmu_detect_test check only the CPU and pmc_init(), and
pmc_ibs_fetch_op_test checks only CPUID leaf 0x8000001B, which bhyve
passes through.  All four fail there instead of skipping.

Add amd_test_skip_unless_class() and use it in pmc_rowalloc_test,
pmu_mux_test and pmc_ibs_fetch_op_test.  hwpmc_amd registers a class
only after amd_hwcheck() passes, so a missing class means there are no
usable counters; rapl_domains_test already skips that way.
pmu_detect_test asserts that the class is registered, so gate it on
PerfCtrExtCore instead, which bhyve clears and KVM sets only with a
vPMU.

PR:             300856
Reviewed by:    mhorne
Fixes:          546a76463123 ("tests/sys/pmc: add pidtrack, callchain, pmc(8), RAPL and AMD tests")

    [4 lines not shown]
DeltaFile
+17-0tests/sys/pmc/amd/amd_pmc_test_common.h
+5-1tests/sys/pmc/amd/pmu_detect_test.c
+1-0tests/sys/pmc/amd/pmu_mux_test.c
+1-0tests/sys/pmc/amd/pmc_rowalloc_test.c
+1-0tests/sys/pmc/amd/pmc_ibs_fetch_op_test.c
+25-15 files

FreeBSD/src 80bee4d — sys/ofed/drivers/infiniband/ulp/nfsclrdma xprt_rdma.h xprt_verbs.c

nfsclrdma: Add code to support client side NFS over RDMA

These functions started life as sys/rpc/clnt_vc.c and
a couple of files in the Linux kernel that are dual
licensed (the same as the OFED stack).  They have now
been heavily modified to work with the FreeBSD NFS client
and krpc.  NFS over RDMA is based on RFC-8166 and RFC-8267.
I have not added my name to the copyrights.  Should I do so?

One outstanding issue is that I see "mlx5_1: WARN: dump_cge.."
failures for the ConnectX4 NICs I have available for testing,
if I allow more than 8 concurrent RPCs or an I/O size greater
than 64Kbytes.  Testing by others have not seen this issue
with newer Mellanox NICs, so the current code sets a limit of
8 concurrent RPCs and a 64Kbyte I/O size for ConnectX4 to
avoid the failures.

The build glue and man page updates will be done as
separate commits, once reviewed.  There are also three

    [21 lines not shown]
DeltaFile
+1,887-0sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+1,498-0sys/ofed/drivers/infiniband/ulp/nfsclrdma/xprt_verbs.c
+86-0sys/ofed/drivers/infiniband/ulp/nfsclrdma/xprt_rdma.h
+3,471-03 files

FreeBSD/src 7aa01f3 — sys/sys libkern.h, tests/sys/libkern Makefile sign_extend_bitfields.c

tests/sys/libkern: Add tests for sign extension and bitfield extraction

In order to avoid name collisions with standard library functions, wrap
everything but the functions to test in a !LIBKERN_TESTING section, so
that when LIBKERN_TESTING is defined, all untested parts are not
defined.  Leave a comment there suggesting selective namespacing when
adding tests to string functions having same name in the standard
library.

Reviewed by:    fuz
MFC with:       a6e81841486a ("libkern: Bitfield extraction: Stick to standard, separate sign extension")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61963
DeltaFile
+202-0tests/sys/libkern/sign_extend_bitfields.c
+22-0sys/sys/libkern.h
+2-0tests/sys/libkern/Makefile
+226-03 files