]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 months agobsdlabel: emit deprecation notice when run
Ed Maste [Wed, 24 Jan 2024 19:33:35 +0000 (14:33 -0500)]
bsdlabel: emit deprecation notice when run

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Reision: https://reviews.freebsd.org/D43586

2 months agobsdlabel: add deprecation notice
Ed Maste [Tue, 23 Jan 2024 18:04:43 +0000 (13:04 -0500)]
bsdlabel: add deprecation notice

gpart is the preferred tool for managing partitions of all types,
including BSD disklabels.

Note that this is only about bsdlabel/disklabel, the tool -- there is no
current plan to remove support for MBR or BSD disk labels from the
kernel or from gpart.

Reviewed by: imp, olce
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43563

2 months agoRemove a reference to xrpu from timetc.h
Josef 'Jeff' Sipek [Mon, 25 Mar 2024 17:50:50 +0000 (11:50 -0600)]
Remove a reference to xrpu from timetc.h

It was removed in 2007, so doesn't make a good example.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44462

2 months agocertctl: Revert to symlinks.
Mark Peek [Mon, 25 Mar 2024 15:58:46 +0000 (16:58 +0100)]
certctl: Revert to symlinks.

Unfortunately tar will not be able to extract base.txz to a system where
/etc and /usr are not on the same filesystem if the certificates are
hard links.

PR: 277828
Reviewed by: mp
Differential Revision: https://reviews.freebsd.org/D44496

2 months agosleep: Overhaul.
Dag-Erling Smørgrav [Mon, 25 Mar 2024 15:58:31 +0000 (16:58 +0100)]
sleep: Overhaul.

Program:

* Add a dummy getopt(3) loop to handle `--`.
* Move interval parsing out into a separate function.
* Print a diagnostic for every invalid interval.
* Check for NaN and infinity.
* Improve bounds checks.

Manual page:

* Miscellaneous markup fixes.
* Reword DESCRIPTION section.
* Move text about GNU compatibility to STANDARDS section.
* Convert examples from csh to sh.

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44471

2 months agopfsync: cope with multiple pending plus messages
Kristof Provost [Sun, 24 Mar 2024 15:08:52 +0000 (16:08 +0100)]
pfsync: cope with multiple pending plus messages

It's possible for pfsync to add a plus message when one is already queued.
Append both, rather than overwriting the already pending one.

MFC after: 1 week

2 months agopfsync: fix use of invalidated stack variable
Kristof Provost [Sun, 24 Mar 2024 08:46:31 +0000 (09:46 +0100)]
pfsync: fix use of invalidated stack variable

Calls to pfsync_send_plus() pass pointers to stack variables.
If pfsync_sendout() then fails it retains the pointer to these stack
variables, accesing them later.

Allocate a buffer and copy the data instead, so that we can retain the
pointer safely.

Reported by: CI KASAN, markj
MFC after: 1 week

2 months agopf: fix use-after-free
Kristof Provost [Sat, 23 Mar 2024 16:02:50 +0000 (17:02 +0100)]
pf: fix use-after-free

If we fragment the packet in pf_route() the first transmitted packet
will free the pf_mtag we have stored in pf_pdesc (pd). Ensure we
update that pointer for every packet to avoid using a freed pointer in
pf_dummynet_route().

Reported by: CI KASAN, markj
MFC after: 1 week

2 months agonetpfil tests: disable ICMPv6 rate limiting in the test jail
Gleb Smirnoff [Mon, 25 Mar 2024 02:54:34 +0000 (19:54 -0700)]
netpfil tests: disable ICMPv6 rate limiting in the test jail

The dummynet test uses flood ping as source of traffic, so the rate
limiting of ICMP replies broke the test.

Fixes: 32aeee8ce7e72738fff236ccd5629d55035458f8

2 months agoicmp: allow zero value for ICMP limits
Gleb Smirnoff [Mon, 25 Mar 2024 02:52:03 +0000 (19:52 -0700)]
icmp: allow zero value for ICMP limits

Zero means limit is disabled, so the value doesn't need to be checked
against jitter value.

Fixes: ac44739fd834f51cacb26485a4140fd482e20150
Fixes: a03aff88a14448c3084a0384082ec996d7213897

2 months agoefibootmgr: allow -u as a valid option
Mark Peek [Sun, 24 Mar 2024 19:37:12 +0000 (12:37 -0700)]
efibootmgr: allow -u as a valid option

PR: 277907
Reported by: vsasjason@gmail.com
MFC after: 1 week

2 months agousr.bin/calendar/calendars: Add myself as a committer
Rainer Hurling [Sun, 24 Mar 2024 18:57:27 +0000 (19:57 +0100)]
usr.bin/calendar/calendars: Add myself as a committer

2 months agoarm64: fix free queue and reservation configuration for 16KB pages
Eliot Solomon [Sat, 18 Nov 2023 21:13:21 +0000 (15:13 -0600)]
arm64: fix free queue and reservation configuration for 16KB pages

Correctly configure the free page queues and the reservation size when
the base page size is 16KB.  In particular, the reservation size was
less than the L2 Block size, making L2 promotions and mappings all but
impossible.

Reviewed by: markj
Tested by: gallatin
Differential Revision: https://reviews.freebsd.org/D42737

2 months agoicmp6: bring rate limiting on a par with IPv4
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp6: bring rate limiting on a par with IPv4

Use counter_ratecheck() instead of racy and slow ppsratecheck. Use a
separate counter for every currently known type of ICMPv6. Provide logging
of ratelimit events. Provide jitter to counter open UDP port detection.

Reviewed by: tuexen, zlei
Differential Revision: https://reviews.freebsd.org/D44482

2 months agoicmp6: move ICMPv6 related tunables to the files where they are used
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp6: move ICMPv6 related tunables to the files where they are used

Most of them can be declared as static after the move out of in6_proto.c.
Keeping sysctl(9) declarations with their text descriptions next to the
variable declaration create self-documenting code.  There should be no
functional changes.

Differential Revision: https://reviews.freebsd.org/D44481

2 months agoicmp6: rate limit our echo replies
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp6: rate limit our echo replies

The generation of ICMP6_ECHO_REPLY bypasses icmp6_error(), thus rate
limit was not applied.

Reviewed by: tuexen, zlei
Differential Revision: https://reviews.freebsd.org/D44480

2 months agoicmp6: make icmp6_ratelimit() responsible to update the stats counter
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp6: make icmp6_ratelimit() responsible to update the stats counter

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D44479

2 months agoicmp: improve ICMP limit jitter
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp: improve ICMP limit jitter

Instead of fixing up invalid values set by a user in badport_bandlim()
which is a fast path function, provide a sysctl handler
sysctl_icmplim_and_jitter(), that will check that jitter is less than the
limit.

Provide jitter initilization function icmplim_new_jitter() used at boot,
in the sysctl handler and when we actually hit the limit.  This also fixes
no jitter on a fresh booted system until first limit hit.

Instead of CVE number provide link the the actual paper that explains what
and why we are doing here.  The CVE number isn't very informative, it will
just tell you what RedHat version you need to upgrade to.

Reviewed by: kp, tuexen, zlei
Differential Revision: https://reviews.freebsd.org/D44478

2 months agoicmp: when logging ICMP ratelimiting message use correct jitter value
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp: when logging ICMP ratelimiting message use correct jitter value

The limiting of the very last second has been done using certain jitter
value.  We update the jitter for the next second.  But the logging should
report the jitter before the change.

Reviewed by: kp, tuexen, zlei
Differential Revision: https://reviews.freebsd.org/D44477

2 months agoicmp: hide icmp_bandlimit_uninit() under VIMAGE
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp: hide icmp_bandlimit_uninit() under VIMAGE

The uninitialization may be executed only on a kernel with VIMAGE.

Reviewed by: kp, tuexen, zlei
Differential Revision: https://reviews.freebsd.org/D44476

2 months agoicmp: do not store per-VNET identical array of strings
Gleb Smirnoff [Sun, 24 Mar 2024 16:13:23 +0000 (09:13 -0700)]
icmp: do not store per-VNET identical array of strings

We need per-VNET struct counter_rate, but we don't need per-VNET set of
const char *.  Also, identical word "response" can go into the format
string instead of being stored 7 times.

Reviewed by: kp, zlei, tuexen
Differential Revision: https://reviews.freebsd.org/D44475

2 months agoacpi_hpet: Make use of enum for vm_guest to improve readability
Zhenlei Huang [Sun, 24 Mar 2024 15:31:22 +0000 (23:31 +0800)]
acpi_hpet: Make use of enum for vm_guest to improve readability

No functional change intended.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44402

2 months agomem.4: Correct the HISTORY section
Gordon Bergling [Sun, 24 Mar 2024 05:10:39 +0000 (06:10 +0100)]
mem.4: Correct the HISTORY section

The history section (added in CSRG) claimed both first appeared in v6.
Looking at the manuals in the TUHS archive, /dev/mem was in v1
and /dev/kmem was introduced in v5.

Reviewed by: imp
Obtained from: OpenBSD
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D44486

2 months agounionfs: implement VOP_UNP_* and remove special VSOCK vnode handling
Jason A. Harmening [Sat, 3 Feb 2024 17:17:58 +0000 (11:17 -0600)]
unionfs: implement VOP_UNP_* and remove special VSOCK vnode handling

unionfs has a bunch of clunky special-case code to avoid creating
unionfs wrapper vnodes for AF_UNIX sockets.  This was added in 2008
to address PR 118346, but in the intervening years the VOP_UNP_*
operations have been added to provide a clean interface to allow
sockets to work in the presence of stacked filesystems.

PR: 275871
Reviewed by: kib (prior version), olce
Tested by: Karlo Miličević <karlo98.m@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44288

2 months agocxgbe.4: Remove double word
Gordon Bergling [Sat, 23 Mar 2024 17:00:57 +0000 (18:00 +0100)]
cxgbe.4: Remove double word

- s/of of/of/

MFC after: 3 days

2 months agointr_event.9: Remove double word
Gordon Bergling [Sat, 23 Mar 2024 16:57:37 +0000 (17:57 +0100)]
intr_event.9: Remove double word

- s/of of/of/

MFC after: 3 days

2 months agotests/netinet: fix UDP I/O test build
Gleb Smirnoff [Sat, 23 Mar 2024 16:21:13 +0000 (09:21 -0700)]
tests/netinet: fix UDP I/O test build

Fixes: 8d3d9ca8bd3db284f6ae671f1e816ba2822f0988

2 months agoxdr(3): Fix a few typos in source code comments
Gordon Bergling [Sat, 23 Mar 2024 07:43:41 +0000 (08:43 +0100)]
xdr(3): Fix a few typos in source code comments

- s/reoutines/routines/
- s/paraemters/parameters/

Obtained from: NetBSD
MFC after: 3 days

2 months agoshare/man/man9/Makefile: fix buildworld
Antoine Brodin [Sat, 23 Mar 2024 07:17:59 +0000 (07:17 +0000)]
share/man/man9/Makefile: fix buildworld

2 months agocdevpriv(9): document devfs_foreach_cdevpriv()
Konstantin Belousov [Sat, 23 Mar 2024 06:48:57 +0000 (08:48 +0200)]
cdevpriv(9): document devfs_foreach_cdevpriv()

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 months agocdevpriv(9): add iterator
Konstantin Belousov [Fri, 22 Mar 2024 02:58:00 +0000 (04:58 +0200)]
cdevpriv(9): add iterator

Reviewed by: christos
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44469

2 months agosoreceive_dgram: use M_WAITOK when we don't hold any locks
Gleb Smirnoff [Sat, 23 Mar 2024 05:44:16 +0000 (22:44 -0700)]
soreceive_dgram: use M_WAITOK when we don't hold any locks

2 months agosoreceive_dgram: assert that a datagram has control or data
Gleb Smirnoff [Sat, 23 Mar 2024 05:44:16 +0000 (22:44 -0700)]
soreceive_dgram: assert that a datagram has control or data

2 months agong_ksocket: use new macros to lock socket buffers
Gleb Smirnoff [Sat, 23 Mar 2024 05:44:16 +0000 (22:44 -0700)]
ng_ksocket: use new macros to lock socket buffers

2 months agotests/netgraph: start ng_ksocket(4) tests
Gleb Smirnoff [Sat, 23 Mar 2024 05:44:16 +0000 (22:44 -0700)]
tests/netgraph: start ng_ksocket(4) tests

The ng_ksocket(4) functionality is very fragile as it interfaces with
kernel socket code in unusual way.  It definitely needs a test suite.
Start one with a test that tests UDP over IPv4.

2 months agotests/netinet: add UDP socket I/O tests
Gleb Smirnoff [Sat, 23 Mar 2024 05:44:16 +0000 (22:44 -0700)]
tests/netinet: add UDP socket I/O tests

Start a file that would collect tests for I/O functionality of a UDP
socket, targeted on how a socket interacts with userland rather than with
wire side of the protocol.

First version tests that MSG_TRUNC and MSG_PEEK are working correctly.

2 months agotests/netgraph: mark all tests as required_user="root"
Gleb Smirnoff [Sat, 23 Mar 2024 02:50:33 +0000 (19:50 -0700)]
tests/netgraph: mark all tests as required_user="root"

Any netgraph operation requires root priveleges.  Some tests in the
directory already mark themselves with 'atf_tc_set_md_var(conf,
"require.user", "root");' which creates a lot of pasted code.  Some tests
don't mark self.  For this particular directory a blanket metadata setting
in the Makefile is acceptable, imho.

2 months agonvmecontrol: Display additional Fabrics-related fields for cdata
John Baldwin [Sat, 23 Mar 2024 00:25:07 +0000 (17:25 -0700)]
nvmecontrol: Display additional Fabrics-related fields for cdata

Some of these fields are specific to Fabrics controllers (such as the
size of capsules) while other fields are shared with PCI-e
controllers, but are more relevant for Fabrics controllers (such as
KeepAlive timer properties).

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44449

2 months agonvme: Add NVMe over Fabrics fields to nvme_controller_data
John Baldwin [Sat, 23 Mar 2024 00:24:52 +0000 (17:24 -0700)]
nvme: Add NVMe over Fabrics fields to nvme_controller_data

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44448

2 months agonvme: Add constants for the Controller Attributes field in cdata
John Baldwin [Sat, 23 Mar 2024 00:24:31 +0000 (17:24 -0700)]
nvme: Add constants for the Controller Attributes field in cdata

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44447

2 months agonvme: Add constants and types for the discovery log page
John Baldwin [Sat, 23 Mar 2024 00:24:18 +0000 (17:24 -0700)]
nvme: Add constants and types for the discovery log page

This is used in NVMe over Fabrics to enumerate a list of available
controllers.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44446

2 months agonvme: Add constants for fields in AER completion dword 0
John Baldwin [Sat, 23 Mar 2024 00:24:06 +0000 (17:24 -0700)]
nvme: Add constants for fields in AER completion dword 0

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44445

2 months agonvme: Add constants for the extended data for Get Log Page command flag
John Baldwin [Sat, 23 Mar 2024 00:23:46 +0000 (17:23 -0700)]
nvme: Add constants for the extended data for Get Log Page command flag

nvme(4) doesn't check this flag, but Fabrics implementations may need
to set this flag in the log page attributes cdata field.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44444

2 months agonvme: Add constants for the PSDT field in cdw0
John Baldwin [Sat, 23 Mar 2024 00:23:24 +0000 (17:23 -0700)]
nvme: Add constants for the PSDT field in cdw0

This is not used in nvme(4) but is used in NVMe over Fabrics
transports which use SGLs to describe buffers instead of PRPs.

While here, adjust the shift value for the FUSE field to be relative
to the 'fuse' member of 'struct nvme_command'.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44443

2 months agonvme: Add SGL structure and constants for use in NVMe commands
John Baldwin [Sat, 23 Mar 2024 00:23:09 +0000 (17:23 -0700)]
nvme: Add SGL structure and constants for use in NVMe commands

Fabrics capsules use an SGL structure instead of prp1/2 addresses to
describe the data buffer used for a command.  The SGL structure is
added to a union with the existing prp1/2 fields.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44442

2 months agonvme: Export constants for min and max queue sizes
John Baldwin [Sat, 23 Mar 2024 00:21:20 +0000 (17:21 -0700)]
nvme: Export constants for min and max queue sizes

These are useful for NVMe over Fabrics.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44441

2 months agoman9: mlink for counter_ratecheck(9)
Gleb Smirnoff [Fri, 22 Mar 2024 21:36:54 +0000 (14:36 -0700)]
man9: mlink for counter_ratecheck(9)

2 months agortld: reduce debug messages after fix on big-endian hosts
Stefan Eßer [Fri, 22 Mar 2024 20:54:11 +0000 (21:54 +0100)]
rtld: reduce debug messages after fix on big-endian hosts

Remove a debug message that had been added to support the debugging
of a mis-detection of the hint files endianness on powerpc64.

MFC after: 3 days

2 months agoccdconfig: reference gpart rather than fdisk and disklabel
Ed Maste [Tue, 23 Jan 2024 18:23:44 +0000 (13:23 -0500)]
ccdconfig: reference gpart rather than fdisk and disklabel

fdisk and disklabel are legacy tools for legacy disk partitioning
schemes.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43564

2 months agocloudinit: fix creation of cloudinit ready VMs
Baptiste Daroussin [Fri, 22 Mar 2024 16:58:48 +0000 (17:58 +0100)]
cloudinit: fix creation of cloudinit ready VMs

The framework do not support multiple format images, so this last minute
addition of qcow2 format was clearly not a good idea.

while here fix a typo

Reported by: cperciva

2 months agokern_ctf.c: fix linking with nooptions DDB
Mitchell Horne [Fri, 22 Mar 2024 16:26:00 +0000 (13:26 -0300)]
kern_ctf.c: fix linking with nooptions DDB

!DDB builds don't include the db_ctf_lookup_typename() symbol, so this
is a stop-gap to fix linking of the MINIMAL kernel config.

Reported by: bapt
Fixes: c21bc6f3c242 ("ddb: Add CTF-based pretty printing")

2 months agorights.4: add note about rights not being simple bitmasks
Ed Maste [Fri, 22 Mar 2024 13:47:57 +0000 (09:47 -0400)]
rights.4: add note about rights not being simple bitmasks

PR: 277057
Reviewed by: oshogbo, asomers
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44473

2 months agortld: fix check for endianess of elf hints file
Michael Tuexen [Fri, 22 Mar 2024 13:50:25 +0000 (14:50 +0100)]
rtld: fix check for endianess of elf hints file

Don't check if the elf hints file is in host byte order, but check
if it is in little endian by looking at the magic number.
This fixes rtld on big endian platforms.
Reviewed by: se, kib (prior version of the patch)
Fixes: 7b77d37a561b ("rtld-elf: support either byte-order of hints")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D44472

2 months agobuild: add -Wswitch to clang for more consistency with gcc
Richard Scheffenegger [Thu, 21 Mar 2024 21:47:39 +0000 (22:47 +0100)]
build: add -Wswitch to clang for more consistency with gcc

gcc12 and gcc13 appear to include Wswitch with Wall, while
clang doesn't. For switch() statements on enum, this forces
the use of at least a default: clause, in adherance with style(9).

Reviewed By: emaste
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D44092

2 months agotcp: no data on SYN segments unless doing TFO
Michael Tuexen [Fri, 22 Mar 2024 10:12:56 +0000 (11:12 +0100)]
tcp: no data on SYN segments unless doing TFO

Ensure that there is no data on SYN segments unless doing TFO.
This check is already in RACK and BBR.

Reported by: glebius
Reviewed by: rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D44384

2 months agolibpfctl: fix incorrect labels copy
Kristof Provost [Fri, 22 Mar 2024 03:21:50 +0000 (04:21 +0100)]
libpfctl: fix incorrect labels copy

We copied the entire parsed_labels struct, including the counter to a
field that was only big enough for the labels (so not the counter).

PR: 277875
MFC after: 1 week

2 months agoif_ovpn tests: test large packets in IPv6 tunnel
Kristof Provost [Thu, 21 Mar 2024 07:38:45 +0000 (08:38 +0100)]
if_ovpn tests: test large packets in IPv6 tunnel

There's a report of MTU issues over IPv6 DCO tunnels.
Extend the 4in6 test to send a series of pings with different sizes, as
well as transfer a large file.

No issues were found, but we may as well extend the test case.

PR: 276838

2 months agoarm/nvidia: Fix DTS build
Emmanuel Vadot [Fri, 22 Mar 2024 06:49:54 +0000 (07:49 +0100)]
arm/nvidia: Fix DTS build

We need to include the DTS with the full path now that it changed.

Fixes: f126890ac538 ("Import device-tree files from Linux 6.5")
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 months agoddb: Fix format string errors in db_pprint.c
Mark Johnston [Fri, 22 Mar 2024 06:11:03 +0000 (02:11 -0400)]
ddb: Fix format string errors in db_pprint.c

For some reason, db_expr_t is defined as "long" on 64-bit platforms and
"int" on others.  When printing values of this type, simply cast them to
long to suppress compilation errors on 32-bit systems.

Reviewed by: bnovkov
Fixes: c21bc6f3c242 ("ddb: Add CTF-based pretty printing")

2 months agoarm64/vmm: Exclude more sanitizer compiler flags from certain files
Mark Johnston [Fri, 22 Mar 2024 04:19:11 +0000 (00:19 -0400)]
arm64/vmm: Exclude more sanitizer compiler flags from certain files

Reported by: rscheff
Fixes: 47e073941f4e ("Import the kernel parts of bhyve/arm64")

2 months agoddb: Add CTF-based pretty printing
Bojan Novković [Fri, 22 Mar 2024 03:01:34 +0000 (04:01 +0100)]
ddb: Add CTF-based pretty printing

Add basic CTF support and a CTF-powered pretty-printer to ddb.

The db_ctf.* files expose a basic interface for fetching type
data for ELF symbols, interacting with the CTF string table,
and translating type identifiers to type data.

The db_pprint.c file uses those interfaces to implement
a pretty-printer for all kernel ELF symbols.
The pretty-printer works with symbol names and arbitrary addresses:
pprint struct thread 0xffffffff8194ad90

Pretty-printing currently only works after the root filesystem
gets mounted because the CTF info is not available during
early boot.

Differential Revision: https://reviews.freebsd.org/D37899
Approved by: markj (mentor)

2 months agoriscv: remove more riscv64sf support
Brooks Davis [Thu, 21 Mar 2024 23:46:28 +0000 (23:46 +0000)]
riscv: remove more riscv64sf support

Remove a few more bits of riscv64sf support in libc and libm.

Reduce floating point ABI checks to requiring double hard float.

Reviewed by: imp, jhb
Fixes: 1ca12bd927d7 Remove the riscv64sf architecture.
Differential Revision: https://reviews.freebsd.org/D44334

2 months agomsun/riscv: expose fe{disable,enable}except
Brooks Davis [Thu, 21 Mar 2024 23:45:53 +0000 (23:45 +0000)]
msun/riscv: expose fe{disable,enable}except

This is required for GCC to build.

PR: 272759
Reported by: dgilbert@eicat.ca
Submitted by: jrtc27
Differential Revision: https://reviews.freebsd.org/D44333

2 months agoSlightly reorganize libclang_rt Makefile again
Dimitry Andric [Thu, 21 Mar 2024 20:44:46 +0000 (21:44 +0100)]
Slightly reorganize libclang_rt Makefile again

Make a separate .elif section for MACHINE_ARCH==powerpc, and subdivide
the MACHINE_CPUARCH values under it. If at some point more sanitizer
libraries become available for powerpc CPU architectures, they can be
added before the "nothing for other powerpc yet" case. Similar for the
MACHINE_ARCH==arm case.

PR: 262706
Fixes: e77a1bb27574
MFC after: 3 days

2 months agodts: Fix arm dts path
Emmanuel Vadot [Thu, 21 Mar 2024 20:06:12 +0000 (21:06 +0100)]
dts: Fix arm dts path

Linux 6.5 moved to a vendor-based subdirectory for arm DTS, change
our Makefiles accordingly.

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 months agoImport device-tree files from Linux 6.5
Emmanuel Vadot [Thu, 21 Mar 2024 20:10:18 +0000 (21:10 +0100)]
Import device-tree files from Linux 6.5

Sponsored by:   Beckhoff Automation GmbH & Co. KG

2 months agolibsysdecode use MKTABLES_INCLUDEDIR
Simon J. Gerraty [Thu, 21 Mar 2024 18:55:56 +0000 (11:55 -0700)]
libsysdecode use MKTABLES_INCLUDEDIR

We do not conflate SYSROOT with STAGE_ROOT/DESTDIR during
DIRDEPS_BUILD

Make sure mktables looks in the right place.

Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44415

2 months agoassert.3: Update manual page based on mandoc -Tlint
Christopher Davidson [Tue, 5 Mar 2024 03:39:52 +0000 (22:39 -0500)]
assert.3: Update manual page based on mandoc -Tlint

Execute the mandoc -Tlint option on assert(3). This results in two areas
of updates:

Remove invalid Rs block
Remove invalid Re block

Reviewed by: mhorne
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/1132

2 months agoFix building of several libclang_rt libraries for powerpc64 and powerp64le
Dimitry Andric [Thu, 21 Mar 2024 13:53:36 +0000 (14:53 +0100)]
Fix building of several libclang_rt libraries for powerpc64 and powerp64le

I reorganized the libclang_rt Makefile in e77a1bb27574 to make it more
readable and maintainable, but the check for 32-bit powerpc was wrong.
This caused almost no libclang_rt libraries to be built for powerpc64
and powerpc64le.

PR: 262706
Reported by: tuexen
Fixes: e77a1bb27574
MFC after: 3 days

2 months agortld-elf: add some debug print statements
Stefan Eßer [Thu, 21 Mar 2024 15:31:49 +0000 (16:31 +0100)]
rtld-elf: add some debug print statements

The byte-order independent code has been reported to fail on powerpc64.
Add some more debug statements to help identify the parametrs used and
to verify the correct operation of the byte-swap macros used..

2 months agokassert.h: update MPASS definition commentary
Mitchell Horne [Thu, 21 Mar 2024 15:21:41 +0000 (12:21 -0300)]
kassert.h: update MPASS definition commentary

We now have a detailed man page describing both MPASS and KASSERT. Give
a warning that careless use of MPASS can result in inadequate assertion
messages, and point to the MPASS(9) page which describes this.

While here add a comment above the KASSERT definitions pointing to the
man page.

Suggested by: bz
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44438

2 months agoKASSERT(9): describe history of MPASS
Mitchell Horne [Thu, 21 Mar 2024 15:21:04 +0000 (12:21 -0300)]
KASSERT(9): describe history of MPASS

The macro originates from BSD/OS, with a different etymology than what
is presented. Add a brief HISTORY section to capture this.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44439

2 months agoKASSERT(9): add assertion message guidelines
Mitchell Horne [Thu, 21 Mar 2024 14:54:49 +0000 (11:54 -0300)]
KASSERT(9): add assertion message guidelines

Add some text describing how to create useful assertion messages.
Improve and add to the EXAMPLES.

See the discussion prompting this on -hackers:
https://mail-archive.freebsd.org/cgi/mid.cgi?57o4rnnq-013s-3nsn-59n5-4ssn1pq81s94

Reviewed by: emaste
Discussed with: imp, bz
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44434

2 months agoBSD.usr.dist: remove empty /usr/libdata/gcc directory
Mitchell Horne [Thu, 21 Mar 2024 14:53:55 +0000 (11:53 -0300)]
BSD.usr.dist: remove empty /usr/libdata/gcc directory

I am unsure of its exact historical usage, but, we no longer ship GCC
with FreeBSD, and it should have been removed.

Reviewed by: imp, emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44440

2 months agocp: Remove useless ssize_t cast
Collin Funk [Tue, 13 Feb 2024 02:52:58 +0000 (18:52 -0800)]
cp: Remove useless ssize_t cast

Both wcount and wresid are ssize_t so this cast is not needed. Just
remove it so the code is easier to read.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed by: emaste, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/1116

2 months agoem.4: add interfaces to name section
Alexander Ziaee [Wed, 20 Mar 2024 17:15:51 +0000 (13:15 -0400)]
em.4: add interfaces to name section

Improving first-glance comprehension that this manual page applies to
igb/lem interfaces provided by the em(4) driver.

While here, tag SPDX, link the framework, and shuffle a sentence to fix
linter warning.

Co-authored-by: mhorne
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1134

2 months agoarm64: Add EL1 hardware breakpoint exceptions
Andrew Turner [Tue, 12 Mar 2024 16:50:04 +0000 (16:50 +0000)]
arm64: Add EL1 hardware breakpoint exceptions

Reviewed by: jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44353

2 months agoarm64: Use a switch to decide when to enable debug
Andrew Turner [Tue, 12 Mar 2024 16:47:38 +0000 (16:47 +0000)]
arm64: Use a switch to decide when to enable debug

Use a switch statement to decide which exceptions we need to call
dbg_enable for. This simplifies adding more esceptions to the list in
the future.

Reviewed by: jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44352

2 months agoarm64: Always set the debug control and value regs
Andrew Turner [Tue, 12 Mar 2024 16:34:41 +0000 (16:34 +0000)]
arm64: Always set the debug control and value regs

When listing watchpoints we read the raw registers. To ensure we print
an accurate list always set the watchpoint and breakpoint registers.

Sponsored by: Arm Ltd

Reviewed by: jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44351

2 months agoarm64: Mask non-debug exceptions when single stepping
Andrew Turner [Thu, 14 Mar 2024 14:02:56 +0000 (14:02 +0000)]
arm64: Mask non-debug exceptions when single stepping

When an exception is pending when single stepping we may execute the
handler for that exception rather than the single step handler. This
could cause the scheduler to fire to run a new thread. This will mean
we single step to a new thread causing unexpected results.

Handle this by masking non-debug exceptions. This will cause issues
when stepping over instructions that access the DAIF values so future
work is needed to handle these cases, but for most code this now works
as expected.

Reviewed by: jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44350

2 months agoarm64: Split out a savectx version of vfp_save_state
Andrew Turner [Wed, 3 Jan 2024 17:41:42 +0000 (17:41 +0000)]
arm64: Split out a savectx version of vfp_save_state

Rather than try to detect when vfp_save_state is called by savectx use
a separate function that sets up the pcb as needed.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D43304

2 months agolibc/aarch64: Add a non-trivial getcontextx
Andrew Turner [Wed, 6 Mar 2024 12:51:18 +0000 (12:51 +0000)]
libc/aarch64: Add a non-trivial getcontextx

Add support for extra registers to the arm64 getcontextx. As no
registers are defined this just adds the extra register list and an end
context.

Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44255

2 months agolibc/aarch64: Copy the trivial getcontextx
Andrew Turner [Wed, 28 Feb 2024 16:09:17 +0000 (16:09 +0000)]
libc/aarch64: Copy the trivial getcontextx

This will be used as the base of a non-trivial implementation.

Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44254

2 months agoarm64: Support passing more registers to signals
Andrew Turner [Thu, 21 Mar 2024 10:13:16 +0000 (10:13 +0000)]
arm64: Support passing more registers to signals

To support recent extensions to the Arm architecture we may need to
store more or larger registers when sending a signal.

To support this create a list of these extra registers. Userspace that
needs to access a register in the signal handler can then walk the list
to find the correct register struct and read/write its contents.

Reviewed by: kib, markj (earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D43302

2 months agowmemchr(3): fix prototypes for wcpcpy() and wcpncpy()
Konstantin Belousov [Thu, 21 Mar 2024 08:38:05 +0000 (10:38 +0200)]
wmemchr(3): fix prototypes for wcpcpy() and wcpncpy()

PR: 277855
Reported by: Paul Floyd <pjfloyd@wanadoo.fr>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 months agolibfdt: Make an internal FDT library available
Mark Johnston [Thu, 21 Mar 2024 04:21:16 +0000 (00:21 -0400)]
libfdt: Make an internal FDT library available

This will be used by bhyve to build a device tree when booting arm64
guests.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40994

2 months agobhyve: Move device model-independent UART code into a separate file
Mark Johnston [Thu, 21 Mar 2024 04:20:37 +0000 (00:20 -0400)]
bhyve: Move device model-independent UART code into a separate file

Currently bhyve implements a ns16550-compatible UART in uart_emul.c.
This file also contains generic code to manage RX FIFOs and to handle
reading from and writing to a TTY.  bhyve instantiates UARTs to
implement COM devices (via pci_lpc.c) and PCI UART devices.

The arm64 port will bring with it a PL011 device model which is used as
the default console (i.e., no COM ports).  To simplify its integration,
add a UART "backend" layer which lets UART device models allocate an RX
FIFO and interact with TTYs without duplicating code.  In particular,
code in uart_backend.* is to be shared among device models, and the
namespace for uart_emul.* is changed to uart_ns16550_*.

This is based on andrew@'s work in
https://github.com/zxombie/freebsd/tree/bhyvearm64 but I've made a
number of changes, particularly with respect to naming and source code
organization.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40993

2 months agolibsysdecode: fix build after 3d0a736796a9
Kyle Evans [Thu, 21 Mar 2024 03:14:49 +0000 (22:14 -0500)]
libsysdecode: fix build after 3d0a736796a9

TCP_USE_DDP is a kernel-only macro, so we must exclude it in
libsysdecode to avoid breaking the build.

Fixes: 3d0a736796a9 ("tcp: Add a new kernel-only TCP_USE_DDP [...]")

2 months agoTranslate linux_newlstat name argument
John F. Carr [Wed, 20 Mar 2024 22:44:23 +0000 (00:44 +0200)]
Translate linux_newlstat name argument

PR: 277847
MFC after: 1 week

2 months agoMerge commit bbb8a0df7367 from llvm-project (by Shafik Yaghmour):
Dimitry Andric [Wed, 20 Mar 2024 22:39:06 +0000 (23:39 +0100)]
Merge commit bbb8a0df7367 from llvm-project (by Shafik Yaghmour):

  [Clang] Fix ResolveConstructorOverload to not select a conversion function if we are going use copy elision

  ResolveConstructorOverload needs to check properly if we are going to use copy
  elision we can't use a conversion function.

  This fixes:

  https://github.com/llvm/llvm-project/issues/39319
  https://github.com/llvm/llvm-project/issues/60182
  https://github.com/llvm/llvm-project/issues/62157
  https://github.com/llvm/llvm-project/issues/64885
  https://github.com/llvm/llvm-project/issues/65568

  Differential Revision: https://reviews.llvm.org/D148474

This should fix 'Assertion failed: (isa<To>(Val) && "cast<Ty>() argument
of incompatible type!")' errors when building devel/boost-libs,
specifically libs/url/src/segments_view.cpp.

Bump __FreeBSD_version so this fix can easily be detected from
devel/boost-all/compiled.mk.

PR: 273335

2 months agocxgbe tom: Handle a race condition when enabling TLS offload
John Baldwin [Wed, 20 Mar 2024 22:30:09 +0000 (15:30 -0700)]
cxgbe tom: Handle a race condition when enabling TLS offload

Use a separate state for when a request to set RX_QUIESCE has been
sent but the resulting TCB reply has not been received.  In
particular, this correctly handles the case where data has been
received and queued in the receive queue before the quiesce request
takes effect.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44435

2 months agoNFS: Request use of TCP_USE_DDP for in-kernel TCP sockets
John Baldwin [Wed, 20 Mar 2024 22:29:51 +0000 (15:29 -0700)]
NFS: Request use of TCP_USE_DDP for in-kernel TCP sockets

Since this is an optimization, ignore failures to enable the option.

For the server side, defer enabling DDP until the first non-NULLPROC
RPC is received.  This allows TLS handling (which uses NULLPROC RPCs)
to enable TLS offload first.

Reviewed by: rmacklem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44002

2 months agocxgbe: Support TCP_USE_DDP on offloaded TOE connections
John Baldwin [Wed, 20 Mar 2024 22:29:28 +0000 (15:29 -0700)]
cxgbe: Support TCP_USE_DDP on offloaded TOE connections

When this socket option is enabled, relatively large contiguous
buffers are allocated and used to receive data from the remote
connection.  When data is received a wrapper M_EXT mbuf is queued to
the socket's receive buffer.  This reduces the length of the linked
list of received mbufs and allows consumers to consume receive data in
larger chunks.

To minimize reprogramming the page pods in the adapter, receive
buffers for a given connection are recycled.  When a buffer has been
fully consumed by the receiver and freed, the buffer is placed on a
per-connection free buffers list.

The size of the receive buffers defaults to 256k and can be set via
the hw.cxgbe.toe.ddp_rcvbuf_len sysctl.  The
hw.cxgbe.toe.ddp_rcvbuf_cache sysctl (defaults to 4) determines the
maximum number of free buffers cached per connection.  Note that this
limit does not apply to "in-flight" receive buffers that are
associated with mbufs in the socket's receive buffer.

Co-authored-by: Navdeep Parhar <np@FreeBSD.org>
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44001

2 months agotcp: Add a new kernel-only TCP_USE_DDP socket option
John Baldwin [Wed, 20 Mar 2024 22:29:02 +0000 (15:29 -0700)]
tcp: Add a new kernel-only TCP_USE_DDP socket option

This socket option can be used by in-kernel consumers (like NFS) to
request a NIC to use optimized receive of large buffers for a
connection.  The current use case is to support DDP by the TOE on
Chelsio NICs.

Reviewed by: rscheff, tuexen, glebius
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44000

2 months agoddp: Clear active DDP buffer members to NULL to pacify an assertion
John Baldwin [Wed, 20 Mar 2024 22:28:43 +0000 (15:28 -0700)]
ddp: Clear active DDP buffer members to NULL to pacify an assertion

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D43999

2 months agoarm/GENERIC: Remove TI DTBs
Emmanuel Vadot [Wed, 20 Mar 2024 20:03:01 +0000 (21:03 +0100)]
arm/GENERIC: Remove TI DTBs

We've removed TI support in 3416e102c4e9 ("arm: Remove TI code from GENERIC")
so no need to build the DTBs now.

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 months agoip6_output: Reduce cache misses on pktopts
Andrew Gallatin [Wed, 20 Mar 2024 19:46:01 +0000 (15:46 -0400)]
ip6_output: Reduce cache misses on pktopts

When profiling an IP6 heavy workload, I noticed that we were
getting a lot of cache misses in ip6_output() around
ip6_pktopts. This was happening because the TCP stack passes
inp->in6p_outputopts even if all options are unused. So in the
common case of no options present, pkt_opts is not null, and is
checked repeatedly for different options. Since ip6_pktopts is
large (4 cachelines), and every field is checked, we take 4
cache misses (2 of which tend to be hidden by the adjacent line
prefetcher).

To fix this common case, I introduced a new flag in ip6_pktopts
(ip6po_valid) which tracks which options have been set. In the
common case where nothing is set, this causes just a single
cache miss to load. It also eliminates a test for some options
(if (opt != NULL && opt->val >= const) vs if ((optvalid & flag) !=0 )

To keep the struct the same size in 64-bit kernels, and to keep
the integer values (like ip6po_hlim, ip6po_tclass, etc) on the
same cacheline, I moved them to the top.

As suggested by zlei, the null check in MAKE_EXTHDR() becomes
redundant, and can be removed.

For our web server workload (with the ip6po_tclass option set),
this drops the CPI from 2.9 to 2.4 for ip6_output

Differential Revision: https://reviews.freebsd.org/D44204
Reviewed by: bz, glebius, zlei
No Objection from: melifaro
Sponsored by: Netflix Inc.

2 months agoImport device-tree files from Linux 6.5
Emmanuel Vadot [Wed, 20 Mar 2024 19:38:54 +0000 (20:38 +0100)]
Import device-tree files from Linux 6.5

2 months agopkgbase: install all libc test files into the tests package
Baptiste Daroussin [Wed, 20 Mar 2024 16:13:56 +0000 (17:13 +0100)]
pkgbase: install all libc test files into the tests package

2 months agopkgbase: make sendmail config files as config
Baptiste Daroussin [Wed, 20 Mar 2024 15:44:35 +0000 (16:44 +0100)]
pkgbase: make sendmail config files as config