]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

2 months agopkgbase: separate /etc/mail/aliases from the sendmail package
Baptiste Daroussin [Wed, 20 Mar 2024 15:39:39 +0000 (16:39 +0100)]
pkgbase: separate /etc/mail/aliases from the sendmail package

move /etc/aliases and /etc/mail/aliases into the runtime package
this file is used by both sendmail and dma.

While here mark this file as a config file so 3way merge is performed

2 months agopkgbase: add a mechanism to be able to force a give ucl include
Baptiste Daroussin [Wed, 20 Mar 2024 08:35:47 +0000 (09:35 +0100)]
pkgbase: add a mechanism to be able to force a give ucl include

This is made in order to be able to find add the post-install scripts
for the kernel, where PKGNAME varies for each KERNCONF but we don't want
to dynamically duplicated the kernel.ucl file.

At the same time we don't want the *-dbg* packages to actually include
those post-install scripts

2 months agobuild: Order kernel-toolchain and buildkernel targets
Mark Johnston [Thu, 25 Jan 2024 17:46:58 +0000 (12:46 -0500)]
build: Order kernel-toolchain and buildkernel targets

MFC after: 1 week

2 months agorc.initdiskless: Disable soft-updates in mdmfs (again)
Jose Luis Duran [Wed, 20 Mar 2024 04:54:18 +0000 (00:54 -0400)]
rc.initdiskless: Disable soft-updates in mdmfs (again)

Re-apply the -S switch to disable soft-updates in memory disks (commit
8b1292ac5219). This might be beneficial when tmpfs(5) is not present in
the kernel, as this can cause mdmfs(8)'s auto keyword to fallback to
using md(4).

PR: 85558
MFC after: 1 week
Reviewed by: imp, emaste, brooks
Differential Revision: https://reviews.freebsd.org/D43242

2 months agosys/syscallsubr.h: align definition of kern_fcntl_freebsd() on 32bit
Konstantin Belousov [Wed, 20 Mar 2024 03:49:01 +0000 (05:49 +0200)]
sys/syscallsubr.h: align definition of kern_fcntl_freebsd() on 32bit

Fixes: d0efabdf15d956e9bc0414356ed798ca3c846e08

2 months agodaemon(8): handle case of waitpid() returning without exited child
Konstantin Belousov [Mon, 18 Mar 2024 08:44:39 +0000 (10:44 +0200)]
daemon(8): handle case of waitpid() returning without exited child

Not checking for either WIFEXITED(status) or zero result results in
never finishing the loop.

PR: 277764
Reviewed by: kevans (previous version)
Discussed with: Daniel Tameling
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44401

2 months agosysent: regen
Brooks Davis [Tue, 19 Mar 2024 22:04:37 +0000 (22:04 +0000)]
sysent: regen

2 months agosyscalls.master: use __acl_type_t
Brooks Davis [Tue, 19 Mar 2024 21:53:50 +0000 (21:53 +0000)]
syscalls.master: use __acl_type_t

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44418

2 months agosys/acl.h: move main typedefs to sys/_types.h
Brooks Davis [Mon, 18 Mar 2024 21:45:42 +0000 (21:45 +0000)]
sys/acl.h: move main typedefs to sys/_types.h

Make __ prefixed versions available without the pollution of sys/acl.h
(and by extension sys/param.h).

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44382

2 months agosyscalls.master: make __sys_fcntl take an intptr_t
Brooks Davis [Tue, 19 Mar 2024 21:52:39 +0000 (21:52 +0000)]
syscalls.master: make __sys_fcntl take an intptr_t

The (optional) third argument of fcntl is sometimes a pointer so change
the type to intptr_t.  Update the libc-internal defintion (actually used
by libthr) to take a fixed intptr_t argument rather than pretending it's
a variadic function.  (That worked because all supported architectures
pass variadic arguments as though the function was declared with those
types.  In CheriBSD that changes because variadic arguments are passed
via a bounded array.)

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44381

2 months agosyscalls.master: struct siginfo -> struct __siginfo
Brooks Davis [Mon, 18 Mar 2024 21:40:07 +0000 (21:40 +0000)]
syscalls.master: struct siginfo -> struct __siginfo

struct siginfo doesn't exist, it's struct __siginfo (and siginfo_t).

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44380

2 months agofreebsd32: struct siginfo32 -> struct __siginfo32
Brooks Davis [Mon, 18 Mar 2024 21:37:39 +0000 (21:37 +0000)]
freebsd32: struct siginfo32 -> struct __siginfo32

In the next commit I will update syscalls.master to use struct __siginfo
(which actually exists) so this update will be needed to make
generated files (from make sysent) align.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44380

2 months agosyscalls.master: align with sigfastblock declaration
Brooks Davis [Tue, 19 Mar 2024 21:51:40 +0000 (21:51 +0000)]
syscalls.master: align with sigfastblock declaration

sigfastblock is declared to take a void * argument in the manpage in
headers so declare it that way and use SAL annotations to say it
interacts with a 32-bit word.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44379

2 months agosyscall.master: fix aio_suspend signature
Brooks Davis [Tue, 19 Mar 2024 21:50:18 +0000 (21:50 +0000)]
syscall.master: fix aio_suspend signature

It takes a `const struct iovec *iovp`.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44378

2 months agosyscalls.master: fix readv and writev iovp decl
Brooks Davis [Tue, 19 Mar 2024 21:50:09 +0000 (21:50 +0000)]
syscalls.master: fix readv and writev iovp decl

Both take const struct iovec * and only read the values.

Reviewed by: olce, kib
Differential Revision: https://reviews.freebsd.org/D44377

2 months agofreebsd32: freebsd32_copyinuio takes const iovp
Brooks Davis [Tue, 19 Mar 2024 21:47:55 +0000 (21:47 +0000)]
freebsd32: freebsd32_copyinuio takes const iovp

We only read the iovp so make it const like in copyinuio.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44376

2 months agoDefine stack_t in sys/_sigaltstack.h
Brooks Davis [Tue, 19 Mar 2024 00:24:37 +0000 (00:24 +0000)]
Define stack_t in sys/_sigaltstack.h

The sigaltstack(2) definition needs this type so make it available
without all of sys/signal.h.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44383

2 months agoarm64: Move curthread setup earlier
Isaac Cilia Attard [Wed, 13 Mar 2024 18:06:19 +0000 (19:06 +0100)]
arm64: Move curthread setup earlier

In 469cfa3c30ee cperciva added TSLOG profiling to link_elf_ireloc.  This
requires curthread to be read when the kernel linker is invoked, but it
hadn't yet been initialized.  On amd64 this was harmless since [gs:0] was
readable; but on arm64 this broke since [x18] was not readable.

Move the curthread (and associated PCPU) setup earlier on arm64 in order
to allow TSLOG to work there.

Fixes: 469cfa3c30ee ("tslog: Annotate some early boot functions")
Differential Revision: https://reviews.freebsd.org/D44317

2 months agoAdd myself (eduardo) to the calendar.
Nuno Teixeira [Tue, 19 Mar 2024 21:21:04 +0000 (21:21 +0000)]
Add myself (eduardo) to the calendar.

Reminded by: mckusick

2 months agocarp: check CARP status in in_localip_fib(), in6_localip_fib()
Gleb Smirnoff [Tue, 19 Mar 2024 18:48:59 +0000 (11:48 -0700)]
carp: check CARP status in in_localip_fib(), in6_localip_fib()

Don't report a BACKUP CARP address as local.  These two functions are used
only by source address validation for input packets, controlled by sysctls
net.inet.ip.source_address_validation and
net.inet6.ip6.source_address_validation.  For this purpose we definitely
want to treat BACKUP addresses as non local.

This change is conservative and doesn't modify compat in_localip() and
in6_localip().  They are used more widely than the FIB-aware versions.
The change would modify the notion of ipfw(4) 'me' keyword.  There might
be other consequences as in_localip() is used by various tunneling
protocols.

PR: 277349

2 months agopf: convert DIOCSETSTATUSIF to netlink
Kristof Provost [Mon, 18 Mar 2024 09:56:25 +0000 (10:56 +0100)]
pf: convert DIOCSETSTATUSIF to netlink

While here also add a basic test case for it.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D44368

2 months agopf: fix dummynet + route-to
Kristof Provost [Tue, 12 Mar 2024 12:29:08 +0000 (13:29 +0100)]
pf: fix dummynet + route-to

Ensure that we pick the correct dummynet pipe (i.e. forward vs. reverse
direction) when applying route-to.

We mark the processing as outbound so that dummynet will re-inject in
the correct phase of processing after it's done with the packet, but
that will cause us to pick the wrong pipe number. Reverse them so that
the incorrect decision ends up picking the correct pipe.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D44366

2 months agopf: avoid passing through dummynet multiple times
Kristof Provost [Mon, 11 Mar 2024 13:44:17 +0000 (14:44 +0100)]
pf: avoid passing through dummynet multiple times

In some setups we end up with multiple states created for a single
packet, which in turn can mean we run the packet through dummynet
multiple times. That's not expected or intended. Mark each packet when
it goes through dummynet, and do not pass packet through dummynet if
they're marked as having already passed through.

See also: https://redmine.pfsense.org/issues/14854
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D44365

2 months agopkgbase: fix packaging of dtb
Baptiste Daroussin [Tue, 19 Mar 2024 14:06:02 +0000 (15:06 +0100)]
pkgbase: fix packaging of dtb

2 months agopkgbase: fix typo preventing packaging kernels
Baptiste Daroussin [Tue, 19 Mar 2024 13:05:12 +0000 (14:05 +0100)]
pkgbase: fix typo preventing packaging kernels

2 months agopkgbase: fix kernel packing after switch ucl rework
Baptiste Daroussin [Tue, 19 Mar 2024 09:00:15 +0000 (10:00 +0100)]
pkgbase: fix kernel packing after switch ucl rework

2 months agopkgbase: rework certctl package to only run rehash on the main package
Baptiste Daroussin [Wed, 31 Jan 2024 12:42:16 +0000 (13:42 +0100)]
pkgbase: rework certctl package to only run rehash on the main package

Rework how ucl manifest are generated leveraging ucl features and flua

now the ucl generation is done via a lua script which uses libucl to
ingest the template and use variables as defined in its command line.

the template will include only if it exist a ucl file named after the
package name which will complement the template or overwrite what was
defined in the template if defined in this specific ucl file

this allows to overwrite license, but add script only to the packages
who actually needs them.

As a results the post install scripts are now only added to the right
package and not also added to the subpackages like -man or -dev

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44374

2 months agodiff: Improve history section.
Dag-Erling Smørgrav [Tue, 19 Mar 2024 02:59:00 +0000 (03:59 +0100)]
diff: Improve history section.

Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D44409

2 months agokldxref: Properly handle reading strings near the end of an ELF file
John Baldwin [Tue, 19 Mar 2024 00:01:23 +0000 (17:01 -0700)]
kldxref: Properly handle reading strings near the end of an ELF file

If a string is at or near the end of an input file and the amount of
remaining data in the file is smaller than the maximum string size,
the pread(2) system call would return a short read which is treated as
an error.  Instead, add a new helper function for reading a string
which permits short reads so long as the data read from the file
contains a terminated string.

Reported by: jrtc27
Reviewed by: jrtc27
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D44419

2 months agoloader.4th dictthreshold too small
Simon J. Gerraty [Mon, 18 Mar 2024 23:16:29 +0000 (16:16 -0700)]
loader.4th dictthreshold too small

The dictthreshold in stand/forth/loader.4th is too small
resulting in full dictionary.

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

2 months agouboot/Makefile move BINDIR
Simon J. Gerraty [Mon, 18 Mar 2024 23:14:15 +0000 (16:14 -0700)]
uboot/Makefile move BINDIR

Set BINDIR before we include bsd.init.mk
so we can override it via local.init.mk

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

2 months agonfsd.8: Document ways to minimize Copy operation times
Rick Macklem [Mon, 18 Mar 2024 22:40:41 +0000 (15:40 -0700)]
nfsd.8: Document ways to minimize Copy operation times

For NFSv4.2, a Copy operation can take a long time to complete.
If there is a concurrent ExchangeID or DelegReturn operation
which requires the exclusive lock on all NFSv4 state, this can
result in a stall of the nfsd server.

This patch documents ways to avoid this problem.

This is a content change.

Reviewed by: karels, wollman, pauamma_gundo.com (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44395

2 months agoadd myself(oh) to the calendar
Oskar Holmlund [Mon, 18 Mar 2024 21:33:03 +0000 (22:33 +0100)]
add myself(oh) to the calendar

Reported by: McKusick
Approved by: Manu (mentor)
Differential Revision: https://reviews.freebsd.org/D44408

2 months agokerneldump: add livedump_start_vnode(9)
Vijeyalakshumi Koteeswaran [Mon, 18 Mar 2024 19:26:29 +0000 (15:26 -0400)]
kerneldump: add livedump_start_vnode(9)

livedump_start_vnode(9) is introduced such that the live minidump on the
system could take a vnode. This interface could be used to extend support
for the existing framework in downstream.

Bump __FreeBSD_version for introducing livedump_start_vnode(9).

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

2 months agotcp: clear all TCP timers in tcp_timer_stop() when in callout
Gleb Smirnoff [Mon, 18 Mar 2024 20:57:00 +0000 (13:57 -0700)]
tcp: clear all TCP timers in tcp_timer_stop() when in callout

When a TCP callout decides to disable self, e.g. tcp_timer_2msl() calling
tcp_close(), we must also clear all other possible timers.  Otherwise,
upon return, the callout would be scheduled again in tcp_timer_enter().

Revert 57e27ff07aff, which was a temporary partial revert of otherwise
correct 62d47d73b7eb, that exposed the problem being fixed now.  Add an
extra assertion in tcp_timer_enter() to check we aren't arming callout for
a closed connection.

Reviewed by: rscheff