Commit graph

290243 commits

Author SHA1 Message Date
Dimitry Andric 897a485c34 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:		e77a1bb275
MFC after:	3 days
2024-03-21 21:44:46 +01:00
Emmanuel Vadot 4ea295aba2 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
2024-03-21 21:11:02 +01:00
Emmanuel Vadot f126890ac5 Import device-tree files from Linux 6.5
Sponsored by:   Beckhoff Automation GmbH & Co. KG
2024-03-21 21:10:18 +01:00
Simon J. Gerraty 139d114acc 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
2024-03-21 11:55:56 -07:00
Christopher Davidson 3f72f36cf2 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
2024-03-21 15:24:02 -03:00
Dimitry Andric f0620ceecc Fix building of several libclang_rt libraries for powerpc64 and powerp64le
I reorganized the libclang_rt Makefile in e77a1bb275 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:		e77a1bb275
MFC after:	3 days
2024-03-21 18:05:25 +01:00
Stefan Eßer 173953182a 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..
2024-03-21 16:31:49 +01:00
Mitchell Horne 36de8bb226 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
2024-03-21 12:24:47 -03:00
Mitchell Horne 5d956e11ed 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
2024-03-21 12:24:35 -03:00
Mitchell Horne 83a426d13a 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
2024-03-21 12:24:16 -03:00
Mitchell Horne cc1268a926 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
2024-03-21 12:22:57 -03:00
Collin Funk 8b86415185 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
2024-03-21 11:43:04 -03:00
Alexander Ziaee 501f7e7bf8 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
2024-03-21 11:16:24 -03:00
Andrew Turner c802b486dd arm64: Add EL1 hardware breakpoint exceptions
Reviewed by:	jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44353
2024-03-21 10:13:24 +00:00
Andrew Turner d93b3a65f7 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
2024-03-21 10:13:24 +00:00
Andrew Turner 2e2c983d52 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
2024-03-21 10:13:24 +00:00
Andrew Turner ed3c6cd76d 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
2024-03-21 10:13:24 +00:00
Andrew Turner 12257233e8 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
2024-03-21 10:13:24 +00:00
Andrew Turner 5202ca77aa 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
2024-03-21 10:13:24 +00:00
Andrew Turner fd6b1cc34e 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
2024-03-21 10:13:24 +00:00
Andrew Turner 7e6437c084 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
2024-03-21 10:13:16 +00:00
Konstantin Belousov 69d5783ae8 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
2024-03-21 10:40:08 +02:00
Mark Johnston f29af8618b 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
2024-03-21 01:05:05 -04:00
Mark Johnston d1c5d0cfcc 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
2024-03-21 01:04:48 -04:00
Kyle Evans 6b3db5d779 libsysdecode: fix build after 3d0a736796
TCP_USE_DDP is a kernel-only macro, so we must exclude it in
libsysdecode to avoid breaking the build.

Fixes:	3d0a736796 ("tcp: Add a new kernel-only TCP_USE_DDP [...]")
2024-03-20 22:14:49 -05:00
John F. Carr 55e2187a09 Translate linux_newlstat name argument
PR:	277847
MFC after:	1 week
2024-03-21 00:45:55 +02:00
Dimitry Andric bcd401b5a3 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
2024-03-20 23:39:11 +01:00
John Baldwin 9978c6289d 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
2024-03-20 15:30:09 -07:00
John Baldwin a16ff32f04 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
2024-03-20 15:29:51 -07:00
John Baldwin eba13bbc37 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
2024-03-20 15:29:28 -07:00
John Baldwin 3d0a736796 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
2024-03-20 15:29:02 -07:00
John Baldwin 25429e2743 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
2024-03-20 15:28:43 -07:00
Emmanuel Vadot 7ad2e83d5e arm/GENERIC: Remove TI DTBs
We've removed TI support in 3416e102c4 ("arm: Remove TI code from GENERIC")
so no need to build the DTBs now.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-03-20 21:04:12 +01:00
Andrew Gallatin 530c2c30b0 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.
2024-03-20 15:50:57 -04:00
Emmanuel Vadot 309417d444 Import device-tree files from Linux 6.5 2024-03-20 20:38:54 +01:00
Baptiste Daroussin 3a9ddfa1ab pkgbase: install all libc test files into the tests package 2024-03-20 17:13:56 +01:00
Baptiste Daroussin 8c3a85eaeb pkgbase: make sendmail config files as config 2024-03-20 16:44:35 +01:00
Baptiste Daroussin 8cd7841d84 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
2024-03-20 16:39:39 +01:00
Baptiste Daroussin 45d83c3926 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
2024-03-20 09:39:18 +01:00
Mark Johnston 49a3780aea build: Order kernel-toolchain and buildkernel targets
MFC after:	1 week
2024-03-20 01:32:24 -04:00
Jose Luis Duran bb4116576f rc.initdiskless: Disable soft-updates in mdmfs (again)
Re-apply the -S switch to disable soft-updates in memory disks (commit
8b1292ac52). 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
2024-03-20 00:54:18 -04:00
Konstantin Belousov f54495100f sys/syscallsubr.h: align definition of kern_fcntl_freebsd() on 32bit
Fixes:	d0efabdf15
2024-03-20 05:49:01 +02:00
Konstantin Belousov 8eaa6be80d 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
2024-03-20 03:07:00 +02:00
Brooks Davis e07d37c705 sysent: regen 2024-03-19 23:13:27 +00:00
Brooks Davis 27676ae365 syscalls.master: use __acl_type_t
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44418
2024-03-19 23:13:27 +00:00
Brooks Davis 55513a1b6e 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
2024-03-19 23:13:26 +00:00
Brooks Davis d0efabdf15 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
2024-03-19 23:13:26 +00:00
Brooks Davis cab73e5305 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
2024-03-19 23:13:26 +00:00
Brooks Davis d060b420e0 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
2024-03-19 23:13:26 +00:00
Brooks Davis 7936d4e4d0 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
2024-03-19 23:13:26 +00:00