]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 months agotests: Add ktrace regression test for shm_open
Jake Freeland [Wed, 10 Apr 2024 02:18:11 +0000 (21:18 -0500)]
tests: Add ktrace regression test for shm_open

Verify that a capability violation is recorded when shm_open(2) is called
with a non-anonymous path.

Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44733

2 months agouipc_shm: Copyin userpath for ktrace(2)
Jake Freeland [Wed, 10 Apr 2024 02:17:11 +0000 (21:17 -0500)]
uipc_shm: Copyin userpath for ktrace(2)

If userpath is not SHM_ANON, then copy it in early so ktrace(2) can
record it. Without this change, ktrace(2) will attempt to strcpy a
userspace string and trigger a page fault.

Reported by: syzbot+490b9c2a89f53b1b9779@syzkaller.appspotmail.com
Fixes: 0cd9cde767c3
Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44702

2 months agounionfs_lookup(): fix wild accesses to vnode private data
Jason A. Harmening [Sun, 18 Feb 2024 00:19:32 +0000 (18:19 -0600)]
unionfs_lookup(): fix wild accesses to vnode private data

There are a few spots in which unionfs_lookup() accesses unionfs vnode
private data without holding the corresponding vnode lock or interlock.

Reviewed by: kib, olce
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44601

2 months agoNOTES: Move NVMe entries to MI file
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Move NVMe entries to MI file

While here, adjust the sample setting for NVME_USE_NVD to use a
non-default setting as is typical in entries in NOTES.

Discussed with: imp
Reviewed by: manu
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44691

2 months agosys: Enable NVMe drivers on all architectures
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
sys: Enable NVMe drivers on all architectures

The NVMe drivers are portable and are already included statically in
GENERIC on other architectures such as aarch64 and riscv64.

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

2 months agoNOTES: Tidy entries for SATA controllers
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Tidy entries for SATA controllers

- Add typical comments after device entries (copied from amd64
  GENERIC)

- Add an entry for 'device ada'.  Normally this is pulled in via
  'device sd', but is documented in ada(4) and can be used to include
  ATA/SATA disk support in a kernel without SCSI disk support.

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

2 months agoNOTES: Add devices for iSCSI support
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Add devices for iSCSI support

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

2 months agoiser: Add kernel build glue
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
iser: Add kernel build glue

'device iser' is documented in iser(4) but not supported.  Hook it up
to the build.

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

2 months agoNOTES: Move OFED options to MI NOTES
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Move OFED options to MI NOTES

Disable in armv7 NOTES to match sys/modules/Makefile

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

2 months agoperiodic/daily/801.trim-zfs: Add a daily zfs trim script
Lexi Winter [Tue, 9 Apr 2024 21:49:56 +0000 (15:49 -0600)]
periodic/daily/801.trim-zfs: Add a daily zfs trim script

As mentioned in zpoolprops(7), on some SSDs, it may not be desirable to
use ZFS autotrim because a large number of trim requests can degrade
disk performance; instead, the pool should be manually trimmed at
regular intervals.

Add a new daily periodic script for this purpose, 801.trim-zfs.  If
enabled (daily_trim_zfs_enable=YES; the default is NO), it will run a
'zpool trim' operation on all online pools, or on the pools listed in
'daily_trim_zfs_pools'.

The trim is not started if the pool is degraded (which matches the
behaviour of the existing 800.scrub-zfs script) or if a trim is already
running on that pool.  Having autotrim enabled does not inhibit the
periodic trim; it's sometimes desirable to run periodic trims even with
autotrim enabled, because autotrim can elide trims for very small
regions.

PR: 275965
MFC after: 1 week
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/956

2 months agopci_host_generic: Tolerate range resource allocation failures
John Baldwin [Tue, 9 Apr 2024 21:55:40 +0000 (14:55 -0700)]
pci_host_generic: Tolerate range resource allocation failures

QEMU for armv7 includes a PCI memory range whose CPU address is
greater than 4GB.  This falls outside the range of armv7's global
mem_rman used by the nexus driver.  As a result, pcib0 fails to
attach blocking all PCI devices.

Instead, change the driver to be a bit more tolerant.  If allocating a
resource for a range fails, don't fail attaching the entire driver,
but do skip adding the associated PCI range to the relevant rman in
the pcib driver.  This will prevent child devices from using BARs that
allocate from this range.  In the case of QEMU on armv7 devices can
still allocate from an earlier PCI memory range that is within the
32-bit address space (and in fact none of the firmware-assigned memory
BARs use addresses from the upper range).

While here, reorder the operations on I/O ranges a bit: 1) print the
range under bootverbose first (rather than last) so that the range is
printed before any relevant errors for the range, 2) move
rman_manage_region last after the parent resource has been set and
allocated.

Reported by: markj, Jenkins
Reviewed by: markj
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision: https://reviews.freebsd.org/D44698

2 months agoRevert "unix: new implementation of unix/stream & unix/seqpacket"
Gleb Smirnoff [Tue, 9 Apr 2024 20:15:16 +0000 (13:15 -0700)]
Revert "unix: new implementation of unix/stream & unix/seqpacket"

The regressions in aio(4) and kernel RPC aren't a 5 minute problem.

This reverts commit d80a97def9a1db6f07f5d2e68f7ad62b27918947.
This reverts commit d1cbb17a873c787a527316bbb27551e97d5ad30c.
This reverts commit fb8a8333b481cc4256d0b3f0b5b4feaa4594e01f.

2 months agoconfig.mk: Add MK_VIMAGE knob
Stephen J. Kiernan [Tue, 9 Apr 2024 17:04:24 +0000 (13:04 -0400)]
config.mk: Add MK_VIMAGE knob

Default to VIMAGE as yes.
Add VIMAGE to __DEFAULT_DEPENDENT_OPTIONS (to define VIMAGE_SUPPORT)

Only output VIMAGE to opt_global.h when VIMAGE support is wanted.

Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39636

2 months agoarm64 pmap: Add ATTR_CONTIGUOUS support [Part 2]
Alan Cox [Mon, 8 Apr 2024 05:05:54 +0000 (00:05 -0500)]
arm64 pmap: Add ATTR_CONTIGUOUS support [Part 2]

Create ATTR_CONTIGUOUS mappings in pmap_enter_object().  As a result,
when the base page size is 4 KB, the read-only data and text sections
of large (2 MB+) executables, e.g., clang, can be mapped using 64 KB
pages.  Similarly, when the base page size is 16 KB, the read-only
data section of large executables can be mapped using 2 MB pages.

Rename pmap_enter_2mpage().  Given that we have grown support for 16 KB
base pages, we should no longer include page sizes that may vary, e.g.,
2mpage, in pmap function names.  Requested by: andrew

Co-authored-by: Eliot Solomon <ehs3@rice.edu>
Differential Revision: https://reviews.freebsd.org/D44575

2 months agorpc: use new macros to lock socket buffers
Gleb Smirnoff [Tue, 9 Apr 2024 16:17:19 +0000 (09:17 -0700)]
rpc: use new macros to lock socket buffers

Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947

2 months agovm: add macro to mark arguments used when NUMA is defined
Stephen J. Kiernan [Wed, 3 Apr 2024 21:05:24 +0000 (17:05 -0400)]
vm: add macro to mark arguments used when NUMA is defined

This fixes compiler warnings when -Wunused-arguments is enabled and
not quieted.

Reviewed by: kib, markj
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44623

2 months agong_socket: Treat EEXIST from kern_kldload() as success
Zhenlei Huang [Tue, 9 Apr 2024 10:04:47 +0000 (18:04 +0800)]
ng_socket: Treat EEXIST from kern_kldload() as success

EEXIST is possible in a race condition.

Inspired by: ffc72591b1f5 (Don't worry if a module is already loaded ...)
Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44633

2 months agomountd.8: Document the new -A mountd option
Rick Macklem [Tue, 9 Apr 2024 01:58:40 +0000 (18:58 -0700)]
mountd.8: Document the new -A mountd option

Commit fefb7c399b39 added warning messages noting
that administrative controls that exported directories
that are not local server file system mount points actually
export the entire local server file system.
This commit also added a new command line option "-A' that
silences these warnings.

This patch documents the new "-A' mountd option.

This is a content change.

Reviewed by: markj, pauamma_gundo.com (manpages)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44692

2 months agosockets: Add hhook in sonewconn for inheriting OSD specific data
Stephen J. Kiernan [Tue, 9 Apr 2024 01:31:34 +0000 (21:31 -0400)]
sockets: Add hhook in sonewconn for inheriting OSD specific data

Added HHOOK_SOCKET_NEWCONN and bumped HHOOK_SOCKET_LAST

Reviewed by: glebius, tuexen
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44632

2 months agounix: return immediately on MSG_OOB
Gleb Smirnoff [Tue, 9 Apr 2024 00:09:16 +0000 (17:09 -0700)]
unix: return immediately on MSG_OOB

Jumping to cleanup routines will work on uninitialized stack mc.

Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947
Reported-by: syzbot+4adf0b37849ea7723586@syzkaller.appspotmail.com

2 months agounix: fix the ad hoc STAILQ_PREPEND()
Gleb Smirnoff [Tue, 9 Apr 2024 00:02:00 +0000 (17:02 -0700)]
unix: fix the ad hoc STAILQ_PREPEND()

If there is nothing to prepend, don't try STAILQ_INSERT_HEAD().

Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947
Reported-by: syzbot+bb7f3d07c79b5faf8de8@syzkaller.appspotmail.com
2 months agoicmp: correct the assertion that checks limit + jitter
Gleb Smirnoff [Mon, 8 Apr 2024 23:54:19 +0000 (16:54 -0700)]
icmp: correct the assertion that checks limit + jitter

Fixes: 4399e055ea610cdefa1470ad1ee614dd81ba5e56

2 months agocp: Never follow symbolic links in destination.
Dag-Erling Smørgrav [Mon, 8 Apr 2024 22:41:33 +0000 (00:41 +0200)]
cp: Never follow symbolic links in destination.

Historically, BSD cp has followed symbolic links in the destination
when copying recursively, while GNU cp has not.  POSIX is somewhat
vague on the topic, but both interpretations are within bounds.  In
33ad990ce974, cp was changed to apply the same logic for symbolic
links in the destination as for symbolic links in the source: follow
if not recursing (which is moot, as this situation can only arise
while recursing) or if the `-L` option was given.  There is no support
for this in POSIX.  We can either switch back, or go all the way.

Having carefully weighed the kind of trouble you can run into by
following unexpected symlinks up against the kind of trouble you can
run into by not following symlinks you expected to follow, we choose
to go all the way.

Note that this means we need to stat the destination twice: once,
following links, to check if it is or references the same file as the
source, and a second time, not following links, to set the dne flag
and determine the destination's type.

While here, remove a needless complication in the dne logic.  We don't
need to explicitly reject overwriting a directory with a non-directory,
because it will fail anyway.

Finally, add test cases for copying a directory to a symlink and
overwriting a directory with a non-directory.

MFC after: never
Relnotes:  yes
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44578

2 months agounix: new implementation of unix/stream & unix/seqpacket
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
unix: new implementation of unix/stream & unix/seqpacket

Provide protocol specific pr_sosend and pr_soreceive for PF_UNIX
SOCK_STREAM sockets and implement SOCK_SEQPACKET sockets as an extension
of SOCK_STREAM.  The change meets three goals: get rid of unix(4) specific
stuff in the generic socket code, provide a faster and robust unix/stream
sockets and bring unix/seqpacket much closer to specification.  Highlights
follow:

- The send buffer now is truly bypassed.  Previously it was always empty,
but the send(2) still needed to acquire its lock and do a variety of
tricks to be woken up in the right time while sleeping on it.  Now the
only two things we care about in the send buffer is the I/O sx(9) lock
that serializes operations and value of so_snd.sb_hiwat, which we can read
without obtaining a lock.  The sleep of a send(2) happens on the mutex of
the receive buffer of the peer.  A bulk send/recv of data with large
socket buffers will make both syscalls just bounce between owning the
receive buffer lock and copyin(9)/copyout(9), no other locks would be
involved.

- The implementation uses new mchain structure to manipulate mbuf chains.
Note that this required converting to mchain two functions that are shared
with unix/dgram: unp_internalize() and unp_addsockcred() as well as adding
a new shared one uipc_process_kernel_mbuf().  This induces some non-
functional changes in the unix/dgram code as well.  There is a space for
improvement here, as right now it is a mix of mchain and manually managed
mbuf chains.

- unix/seqpacket previously marked as PR_ADDR & PR_ATOMIC and thus treated
as a datagram socket by the generic socket code, now becomes a true stream
socket with record markers.

- unix/stream loses the sendfile(2) support.  This can be brought back,
but requires some work.  Let's first see if there is any interest in this
feature, except purely academical.

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44151

2 months agombuf: provide mc_uiotomc() a function to copy from uio(9) to mchain
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: provide mc_uiotomc() a function to copy from uio(9) to mchain

Implement m_uiotombuf() as a wrapper around mc_uiotomc().  The M_EXTPG is
left untouched.  The m_uiotombuf() is left as a compat KPI.  New code
should use either mc_uiotomc() or m_uiotombuf_nomap().

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44150

2 months agombuf: provide mc_get() that allocates struct mchain of given length
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: provide mc_get() that allocates struct mchain of given length

Implement m_getm2(), which is widely used via m_getm() macro, as a wrapper
around mc_get().  New code is advised to use mc_get().

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44149

2 months agombuf: add mc_split() that works on two struct mchain
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: add mc_split() that works on two struct mchain

It preserves tail points and all length/memory accounting, so that caller
doesn't need to do any extra traversals.  It doesn't respect M_PKTHDR but
it may be improved if needed.  It respects M_EOR, though.  First consumer
will be the new unix(4) SOCK_STREAM and SOCK_SEQPACKET.

Also provide much more simple mc_concat() that glues two chains back.

Reviewed by: markj
Differentail Revision: https://reviews.freebsd.org/D44148

2 months agombuf: provide new type for mbuf manipulation - mbuf chain
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: provide new type for mbuf manipulation - mbuf chain

It tracks both the first mbuf and last mbuf, making it handy to use inside
functions that are interested in both. It also tracks length of data and
memory usage. It can be allocated on stack and passed to an mbuf
allocation or another mbuf manipulation function. It can be embedded into
some kernel facility internal structure representing most simple data
buffer. It uses modern queue(3) based linkage, but is also compatible with
old style m_next linkage. Transitioning older code to new type can be done
gradually - a code that doesn't understand the chain yet, can be supplied
with STAILQ_FIRST(&mc.mc_q). So you can have a mix of old style and new
style code in one function as a temporary solution.

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44147

2 months agosendfile: mark it explicitly as a TCP only feature
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
sendfile: mark it explicitly as a TCP only feature

Back in 2015 when it turned non-blocking, it was working with PF_UNIX
and it may still work.  However, the usefullness of such application
of sendfile(2) is questionable.  Disable the feature while unix/stream
is under refactoring.

Relnotes: yes

2 months agotests/unix_seqpacket: remove workaround for a kernel bug that is no longer
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
tests/unix_seqpacket: remove workaround for a kernel bug that is no longer

2 months agotests/unix_seqpacket: test send(2) to a closed or aborted peer socket
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:50 +0000 (13:16 -0700)]
tests/unix_seqpacket: test send(2) to a closed or aborted peer socket

In both cases the kernel returns EPIPE and delivers SIGPIPE, unless
blocked or disabled.  The test isn't specific to SOCK_SEQPACKET, it is the
same for SOCK_STREAM.  Put the test into this file, since it has all
primitives to write this test tersely.

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

2 months agotests/unix_seqpacket: provide random data pumping test with MSG_EOR
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:50 +0000 (13:16 -0700)]
tests/unix_seqpacket: provide random data pumping test with MSG_EOR

Allocate a big chunk of randomly initialized memory.  Send it to the peer
in random sized chunks, throwing MSG_EOR at randomly initialized offsets.
Receive into random sized chunks setting MSG_WAITALL randomly.  Check that
MSG_EORs where they should be, check that MSG_WAITALL is abode, but
overriden by MSG_EOR.  And finally memcmp() what we receive.

Reviewed by: asomers, tuexen
Differential Revision: https://reviews.freebsd.org/D43775

2 months agosys/queue.h: Add {LIST,TAILQ}_REPLACE().
Dag-Erling Smørgrav [Mon, 8 Apr 2024 18:16:40 +0000 (20:16 +0200)]
sys/queue.h: Add {LIST,TAILQ}_REPLACE().

MFC after: 1 week
Obtained from: NetBSD
Sponsored by: Klara, Inc.
Reviewed by: cperciva, imp
Differential Revision: https://reviews.freebsd.org/D44679

2 months agosys/queue.h: Whitespace cleanup.
Dag-Erling Smørgrav [Mon, 8 Apr 2024 18:16:35 +0000 (20:16 +0200)]
sys/queue.h: Whitespace cleanup.

MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44678

2 months agong_bridge: document the limitation brought in f961caf2184c
Gleb Smirnoff [Mon, 8 Apr 2024 17:48:22 +0000 (10:48 -0700)]
ng_bridge: document the limitation brought in f961caf2184c

2 months agong_bridge: allow to automatically assign numbers to new hooks
David Marker [Mon, 8 Apr 2024 17:48:22 +0000 (10:48 -0700)]
ng_bridge: allow to automatically assign numbers to new hooks

This will allow a userland machinery that orchestrates a bridge (e.g. a
jail or vm manager) to not double the number allocation logic.  See bug
278130 for longer description and examples.

Reviewed by: glebius, afedorov
Differential Revision: https://reviews.freebsd.org/D44615
PR: 278130

2 months agodebugnet: Fix logging of frame length
Zhenlei Huang [Mon, 8 Apr 2024 16:47:06 +0000 (00:47 +0800)]
debugnet: Fix logging of frame length

MFC after: 1 week

2 months agoethernet: Fix logging of frame length
Zhenlei Huang [Mon, 8 Apr 2024 16:44:33 +0000 (00:44 +0800)]
ethernet: Fix logging of frame length

Both the mbuf length and the total packet length are signed.

While here, update a stall comment to reflect the current practice.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42390

2 months agoecho(1): Add EXAMPLES
Fernando Apesteguía [Thu, 7 Sep 2023 13:27:49 +0000 (15:27 +0200)]
echo(1): Add EXAMPLES

While here add CAVEAT section and promote the use of printf(1)

Reviewed by: gbe@, imp@
Approved by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D43493

2 months agonetinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters
Kristof Provost [Thu, 18 Jan 2024 19:44:47 +0000 (20:44 +0100)]
netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters

When debugging network issues one common clue is an unexpectedly
incrementing error counter. This is helpful, in that it gives us an
idea of what might be going wrong, but often these counters may be
incremented in different functions.

Add a static probe point for them so that we can use dtrace to get
futher information (e.g. a stack trace).

For example:
dtrace -n 'mib:ip:count: { printf("%d", arg0); stack(); }'

This can be disabled by setting the following kernel option:
options  KDTRACE_NO_MIB_SDT

Reviewed by: gallatin, tuexen (previous version), gnn (previous version)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D43504

2 months agocapsicum.h: Include ktrace.h only in kernel
Jake Freeland [Mon, 8 Apr 2024 13:27:17 +0000 (08:27 -0500)]
capsicum.h: Include ktrace.h only in kernel

Fix cross build failure by including ktrace.h only when _KERNEL is
defined.

Fixes: 9bec84131215
Approved by: markj (mentor)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

2 months agolibvmmapi: add missing capability strings
Rob Norris [Mon, 8 Apr 2024 13:08:20 +0000 (13:08 +0000)]
libvmmapi: add missing capability strings

Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44642

2 months agobhyvectl: generate usage from options table
Rob Norris [Mon, 8 Apr 2024 13:07:32 +0000 (13:07 +0000)]
bhyvectl: generate usage from options table

The usage text had fallen out of sync with the actually available
options. Rather than keep them in sync by hand, just generate usage from
the available options.

Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44641

2 months agoswap_pager: Unbusy readahead pages after an I/O error
Mark Johnston [Mon, 8 Apr 2024 13:02:48 +0000 (09:02 -0400)]
swap_pager: Unbusy readahead pages after an I/O error

The swap pager itself allocates readahead pages, so should take care to
unbusy them after a read error, just as it does in the non-error case.

PR: 277538
Reviewed by: olce, dougm, alc, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44646

2 months agoLinuxKPI: Stub sysfs_remove_link in linux/sysfs.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Stub sysfs_remove_link in linux/sysfs.h

sysfs_create_link is stubbed already. Stub sysfs_remove_link too to be
feature-complete.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add want_init_on_free to linux/mm.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add want_init_on_free to linux/mm.h

want_init_on_free returns if heap memory zeroing on free is enabled.
FreeBSD does not zeroes heap memory on free().

Sponsored by: Serenity Cyber Security
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add ACPI_ID_LEN const to linux/mod_devicetable.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add ACPI_ID_LEN const to linux/mod_devicetable.h

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add pci_dev_id to linux/pci.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add pci_dev_id to linux/pci.h

It returns bus/device/function number for given PCI device.
Also add intermediate PCI_DEVID macro used in some drivers.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add the accelerator PCIe class
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add the accelerator PCIe class

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add PTR_IF macro
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add PTR_IF macro

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add vm_flags_(clear|set) functions
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add vm_flags_(clear|set) functions

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Improve timer_shutdown_sync
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Improve timer_shutdown_sync

timer_shutdown_sync not only shutdowns a timer but prevents it rearming.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add get_random_u32_below function
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add get_random_u32_below function

get_random_u32_below returns a random integer in the interval [0, ceil),
with uniform distribution.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add VM_ACCESS_FLAGS define to linux/mm.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add VM_ACCESS_FLAGS define to linux/mm.h

VM_ACCESS_FLAGS is a basic access permission flags.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Import vanilla linux/overflow.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Import vanilla linux/overflow.h

It is dual-licensed (GPLv2 & MIT) and self-contained header file.
No need to reimplement it.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Move [SU](8|16|32|64)_(MAX|MIN) defines to linux/limits.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Move [SU](8|16|32|64)_(MAX|MIN) defines to linux/limits.h

Some source files get them from linux/limits.h directly rather than from
linux/kernel.h.
While here replace Linux constant values with sys/stdint.h provided ones.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Add strnchr function
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add strnchr function

strnchr() finds a character in a length limited string.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 month

2 months agoLinuxKPI: Add ms_to_ktime
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add ms_to_ktime

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

2 months agoLinuxKPI: Set suspend type on syspend/resume cycle enter
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:41 +0000 (09:47 +0300)]
LinuxKPI: Set suspend type on syspend/resume cycle enter

Recent amdgpu depends on pm_suspend_target_state value to separate
S3 and S0ix support.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu (in bugzilla)
MFC after: 1 week

2 months agoRELNOTES: Add entry for updates to ktrace(2)
Jake Freeland [Sat, 6 Apr 2024 18:39:42 +0000 (13:39 -0500)]
RELNOTES: Add entry for updates to ktrace(2)

Approved by: markj (mentor)

2 months agotests: Add ktrace capability violation test cases
Jake Freeland [Sat, 6 Apr 2024 18:31:30 +0000 (13:31 -0500)]
tests: Add ktrace capability violation test cases

Introduce regression tests for ktrace(2) that target capability
violations.

These test cases ensure that ktrace(2) records these violations:
- CAPFAIL_NOTCAPABLE
- CAPFAIL_INCREASE
- CAPFAIL_SYSCALL
- CAPFAIL_SIGNAL
- CAPFAIL_PROTO
- CAPFAIL_SOCKADDR
- CAPFAIL_NAMEI
- CAPFAIL_CPUSET

A portion of these test cases create processes that do NOT enter
capability mode, but raise violations. This is intended behavior.
Users may run `ktrace -t p` on non-Capsicumized programs to detect
violations that would occur if the process were in capability mode.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40682

2 months agoktrace: Record socket violations with KTR_CAPFAIL
Jake Freeland [Sat, 6 Apr 2024 18:31:28 +0000 (13:31 -0500)]
ktrace: Record socket violations with KTR_CAPFAIL

Report restricted access to socket addresses and protocols while
Capsicum violation tracing with CAPFAIL_ADDR and CAPFAIL_PROTO.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40681

2 months agoktrace: Record namei violations with KTR_CAPFAIL
Jake Freeland [Sat, 6 Apr 2024 18:31:25 +0000 (13:31 -0500)]
ktrace: Record namei violations with KTR_CAPFAIL

Report namei path lookups while Capsicum violation tracing with
CAPFAIL_NAMEI. vfs caching is also ignored when tracing to mimic
capability mode behavior.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40680

2 months agoktrace: Record signal violations with KTR_CAPFAIL
Jake Freeland [Sat, 6 Apr 2024 18:31:21 +0000 (13:31 -0500)]
ktrace: Record signal violations with KTR_CAPFAIL

Report the delivery of signals to processes other than self while
Capsicum violation tracing with CAPFAIL_SIGNAL.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40679

2 months agoktrace: Record syscall violations with KTR_CAPFAIL
Jake Freeland [Sat, 6 Apr 2024 18:31:18 +0000 (13:31 -0500)]
ktrace: Record syscall violations with KTR_CAPFAIL

Report syscalls that are not allowed in capability mode with
CAPFAIL_SYSCALL.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40678

2 months agoktrace: Record cpuset violations with KTR_CAPFAIL
Jake Freeland [Sat, 6 Apr 2024 18:31:14 +0000 (13:31 -0500)]
ktrace: Record cpuset violations with KTR_CAPFAIL

Report Capsicum violations in the cpuset namespace with CAPFAIL_CPUSET.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40677

2 months agoktrace: Record detailed ECAPMODE violations
Jake Freeland [Sat, 6 Apr 2024 18:29:45 +0000 (13:29 -0500)]
ktrace: Record detailed ECAPMODE violations

When a Capsicum violation occurs in the kernel, ktrace will now record
detailed information pertaining to the violation.

For example:
- When a namei lookup violation occurs, ktrace will record the path.
- When a signal violation occurs, ktrace will record the signal number.
- When a sendto(2) violation occurs, ktrace will record the recipient
  sockaddr.

For all violations, the syscall and ABI is recorded.

kdump is also modified to display this new information to the user.

Reviewed by: oshogbo, markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40676

2 months agoexports.5: Add RFC number for NFS over TLS
Rick Macklem [Sun, 7 Apr 2024 23:35:55 +0000 (16:35 -0700)]
exports.5: Add RFC number for NFS over TLS

This is a content change.

MFC after: 1 week

2 months agoCirrus-CI: switch to llvm18 by default
Ed Maste [Sat, 6 Apr 2024 21:53:17 +0000 (17:53 -0400)]
Cirrus-CI: switch to llvm18 by default

As of commit 439352ac8257 Clang/LLVM 18 is the default in-tree compiler.
Follow suit in with the external toolchain package used by Cirrus-CI.

Sponsored by: The FreeBSD Foundation

2 months agotcp: add some debug output
Michael Tuexen [Sun, 7 Apr 2024 20:41:24 +0000 (22:41 +0200)]
tcp: add some debug output

Also log, when dropping text or FIN after having received a FIN.
This is the intended behavior described in RFC 9293.
A follow-up patch will enforce this behavior for the base stack
and the RACK stack.
Reviewed by: rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D44669

2 months agolibcompiler_rt Makefile.inc: include bsd.compiler.mk to fix build
Dimitry Andric [Sun, 7 Apr 2024 19:45:51 +0000 (21:45 +0200)]
libcompiler_rt Makefile.inc: include bsd.compiler.mk to fix build

Apparently libgcc_s has always included libcompiler_rt's Makefile.inc
without first including bsd.compiler.mk, even though Makefile.inc used
COMPILER_TYPE already. It looks like we were just lucky that the
expression was not malformed.

PR: 276104
Reported by: Herbert J. Skuhra <herbert@gojira.at>
MFC after: 1 month

2 months agolibcompiler_rt Makefile.inc: don't build bfloat16 support for gcc < 13
Dimitry Andric [Sun, 7 Apr 2024 18:21:01 +0000 (20:21 +0200)]
libcompiler_rt Makefile.inc: don't build bfloat16 support for gcc < 13

Older versions of gcc produce "error: unknown type name '__bf16'".

PR: 276104
MFC after: 1 month

2 months agolibcompiler_rt Makefile.inc: remove debugging messages
Dimitry Andric [Sun, 7 Apr 2024 18:16:50 +0000 (20:16 +0200)]
libcompiler_rt Makefile.inc: remove debugging messages

PR: 276104
MFC after: 1 month

2 months agoFix GENERIC-KASAN kernel build for amd64
Dimitry Andric [Sun, 7 Apr 2024 17:56:03 +0000 (19:56 +0200)]
Fix GENERIC-KASAN kernel build for amd64

Work around https://github.com/llvm/llvm-project/issues/87923, which
leads to an assertion failure compiling several kernel source files with
asan enabled.

PR: 276104
MFC after: 1 month

2 months agovm_reserv: Add vm_reserv_is_populated
Doug Moore [Sun, 7 Apr 2024 17:19:41 +0000 (12:19 -0500)]
vm_reserv: Add vm_reserv_is_populated

Add a function to check whether an aligned block of vm pages are
allocated, for use with impending changes to arm64 superpage
managment.

Reviewed by: alc
Differential Revision: http://reviews.freebsd.org/D44575

2 months agoFix arm64 build after llvm 18.1.3 upgrade (take 2)
Dimitry Andric [Sun, 7 Apr 2024 09:23:06 +0000 (11:23 +0200)]
Fix arm64 build after llvm 18.1.3 upgrade (take 2)

Instead of compiling the whole sys/arm64/arm64/vfp.c file without
-mgeneral-regs-only, which might have unwanted side effects, add
".arch_extension fp" / ".arch_extension nofp" pairs to the inline
assembly.

PR: 276104
Suggested by: andrew
MFC after: 1 month

2 months agoFix arm64 build after llvm 18.1.3 upgrade
Dimitry Andric [Sun, 7 Apr 2024 00:07:38 +0000 (02:07 +0200)]
Fix arm64 build after llvm 18.1.3 upgrade

Apparently clang 18 has become more strict about using floating point
registers in inline assembly when -mgeneral-regs-only is used. This
causes sys/arm64/arm64/vfp.c to fail to compile, with "error:
instruction requires: fp-armv8", and "error: expected readable system
register".

To fix it, similar to other files compiled for arm64, disable
-mgeneral-regs-only for this particular file.

PR: 276104
MFC after: 1 month

2 months agoBump __FreeBSD_version for llvm 18.1.3 merge
Dimitry Andric [Sat, 6 Apr 2024 20:15:21 +0000 (22:15 +0200)]
Bump __FreeBSD_version for llvm 18.1.3 merge

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project release/18.x llvmorg-18.1.3-0-gc13b7485b879
Dimitry Andric [Fri, 5 Apr 2024 22:02:56 +0000 (00:02 +0200)]
Merge llvm-project release/18.x llvmorg-18.1.3-0-gc13b7485b879

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.3-0-gc13b7485b879.

PR: 276104
MFC after: 1 month

2 months agoMerge commit f5f3d5d6534f from llvm-project (by Qizhi Hu):
Dimitry Andric [Thu, 21 Mar 2024 20:50:26 +0000 (21:50 +0100)]
Merge commit f5f3d5d6534f from llvm-project (by Qizhi Hu):

  [Clang][Sema] Fix a crash in lambda instantiation (#85565)

  Fix https://github.com/llvm/llvm-project/issues/85343
  When build lambda expression in lambda instantiation, `ThisType` is
  required in `Sema::CheckCXXThisCapture` to build `this` capture. Set
  `this` type by import `Sema::CXXThisScopeRAII` and it will be used later
  in lambda expression transformation.

Co-authored-by: huqizhi <836744285@qq.com>
This fixes 'Assertion failed: (!isNull() && "Cannot retrieve a NULL type
pointer"), function getCommonPtr" when building the x11-wm/wayfire port.

PR: 276104
MFC after: 1 month

2 months agoRevert commit 6255157d24e2 from llvm-project (by Dimitry Andric):
Dimitry Andric [Tue, 19 Mar 2024 13:07:27 +0000 (14:07 +0100)]
Revert commit 6255157d24e2 from llvm-project (by Dimitry Andric):

  [libc++] Re-enable std::pair trivial copy constructor for FreeBSD >= 14

  After many years of using the really old std::pair ABI which did not yet
  have a trivial copy constructor, FreeBSD 14 and later will finally get
  rid of it. Only use the old ABI for FreeBSD 13 and earlier.

  Note: on the FreeBSD side, we will bump our libc++.so version for this,
  and keep an old compatibility library in a separate package.

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

This ABI change can cause crashes when binaries compiled against older
libc++ versions are run against binaries compiled against this libc++
version.

For example, lang/ldc uses a precompiled bootstrap ldc2 binary that was
compiled against the old libc++, but also links against libLLVM-15.so.
If libLLVM-15.so is compiled against the new libc++ version, the ABI
mismatch results in segfaults or even stack overflows.

Note: we can only re-enable the std::pair trivial copy constructors
again when the official libc++ ABI version is bumped to 2.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project release/18.x llvmorg-18.1.1-0-gdba2a75e9c7e
Dimitry Andric [Sun, 10 Mar 2024 12:37:50 +0000 (13:37 +0100)]
Merge llvm-project release/18.x llvmorg-18.1.1-0-gdba2a75e9c7e

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.1-0-gdba2a75e9c7e.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project release/18.x llvmorg-18.1.0-rc3-0-g6c90f8dd5463
Dimitry Andric [Wed, 21 Feb 2024 10:24:23 +0000 (11:24 +0100)]
Merge llvm-project release/18.x llvmorg-18.1.0-rc3-0-g6c90f8dd5463

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc3-0-g6c90f8dd5463.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442
Dimitry Andric [Tue, 20 Feb 2024 18:57:23 +0000 (19:57 +0100)]
Merge llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967
Dimitry Andric [Wed, 7 Feb 2024 14:58:02 +0000 (15:58 +0100)]
Merge llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967.

PR: 276104
MFC after: 1 month

2 months ago[libc++] Rename __bit_reference template parameter to avoid conflict
Dimitry Andric [Mon, 5 Feb 2024 11:41:51 +0000 (12:41 +0100)]
[libc++] Rename __bit_reference template parameter to avoid conflict

As of 4d20cfcf4eb08217ed37c4d4c38dc395d7a66d26, `__bit_reference`
contains a template `__fill_n` with a bool `_FillValue` parameter.

Unfortunately there is a relatively widely used piece of scientific
software called NetCDF, which exposes a (C) macro `_FillValue` in its
public headers.

When building the NetCDF C++ bindings, this quickly leads to compilation
errors when the macro interferes with the template in `__bit_reference`.

Rename the parameter to `_FillVal` to avoid the conflict.

PR: 276104
MFC after: 1 month

2 months agoMerge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi):
Dimitry Andric [Mon, 5 Feb 2024 09:16:17 +0000 (10:16 +0100)]
Merge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi):

  [Clang][AST] Fix a crash on attaching doc comments (#78716)

  This crash is basically caused by calling
  `ASTContext::getRawCommentForDeclNoCacheImp` with its input arguments
  `RepresentativeLocForDecl` and `CommentsInTheFile` refering to different
  files. A reduced reproducer is provided in this patch.

  After the source locations for instantiations of funtion template are
  corrected in the commit 256a0b298c68b89688b80350b034daf2f7785b67, the
  variable `CommitsInThisFile` in the function
  `ASTContext::attachCommentsToJustParsedDecls` would refer to the source
  file rather than the header file for implicit function template
  instantiation. Therefore, in the first loop in
  `ASTContext::attachCommentsToJustParsedDecls`, `D` should also be
  adjusted for relevant scenarios like the second loop.

  Fixes #67979
  Fixes #68524
  Fixes #70550

This should fix a segfault when compiling graphics/gdal.

PR: 276104
MFC after: 1 month

2 months agoMerge commit 6e4930c67508 from llvm-project (by Alexander Kornienko):
Dimitry Andric [Sun, 28 Jan 2024 20:34:42 +0000 (21:34 +0100)]
Merge commit 6e4930c67508 from llvm-project (by Alexander Kornienko):

  Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)"

  This reverts commit 924701311aa79180e86ad8ce43d253f27d25ec7d. Causes compilation
  errors on valid code, see
  https://github.com/llvm/llvm-project/pull/77768#issuecomment-1908062472.

In particular, this fixes bogus "call to constructor of 'SomeType' is
ambiguous" errors.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e
Dimitry Andric [Fri, 26 Jan 2024 15:04:14 +0000 (16:04 +0100)]
Merge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18-init-18361-g22683463740e.

PR: 276104
MFC after: 1 month

2 months agoTentatively apply https://github.com/libcxxrt/libcxxrt/pull/27
Dimitry Andric [Fri, 26 Jan 2024 15:03:20 +0000 (16:03 +0100)]
Tentatively apply https://github.com/libcxxrt/libcxxrt/pull/27

This marks __cxa_allocate_exception, __cxa_free_exception and
__cxa_init_primary_exception noexcept, to ensure compatibility with
libc++'s declarations.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project main llvmorg-18-init-18359-g93248729cfae
Dimitry Andric [Wed, 24 Jan 2024 19:17:23 +0000 (20:17 +0100)]
Merge llvm-project main llvmorg-18-init-18359-g93248729cfae

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
last commit before the upstream release/18.x branch was created.

PR: 276104
MFC after: 1 month

2 months agoRedo libc++ customizations
Dimitry Andric [Sun, 14 Jan 2024 13:20:42 +0000 (14:20 +0100)]
Redo libc++ customizations

* Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
* Instead, add direct major __FreeBSD__ check for using ::gets declaration
* Mark EINTEGRITY values as FreeBSD customization
* Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424
Dimitry Andric [Thu, 11 Jan 2024 18:29:01 +0000 (19:29 +0100)]
Merge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde
Dimitry Andric [Tue, 9 Jan 2024 20:00:28 +0000 (21:00 +0100)]
Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

PR: 276104
MFC after: 1 month

2 months agoAdd two FreeBSD customizations to libc++
Dimitry Andric [Sun, 7 Jan 2024 11:32:29 +0000 (12:32 +0100)]
Add two FreeBSD customizations to libc++

This is intended to better support ports usage of older clang versions:
* Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
  version checks, to avoid any warnings about support. This makes some
  ports that use -Werror fall over.
* When using clang < 15.0, avoid using a type visibility attribute on
  the std namespace, as older versions of clang do not support this.

PR: 276104
MFC after: 1 month

2 months agoTentatively merge https://github.com/llvm/llvm-project/pull/77242
Dimitry Andric [Sun, 7 Jan 2024 16:03:13 +0000 (17:03 +0100)]
Tentatively merge https://github.com/llvm/llvm-project/pull/77242

  [libcxx] Re-include <osreldate.h> in __config for FreeBSD

  In 0a97720d0197 some changes were made to `__config` for assuming that
  `__BYTE_ORDER__` is always present.

  However, this deleted a `<osreldate.h>` include for FreeBSD, which is
  required to get the value of `__FreeBSD_version`, and that is used later
  in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
  enabled.

  Include `<osreldate.h>` just after the other includes used for feature
  detection, to fix this.

  Note that when FreeBSD 13 is EOLed, this can be removed, as then all
  supported FreeBSD versions will no longer have `gets()`.

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4
Dimitry Andric [Wed, 3 Jan 2024 18:04:11 +0000 (19:04 +0100)]
Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

PR: 276104
MFC after: 1 month

2 months agoRevert commit 0e46b49de433 from llvm-project (by Matt Arsenault):
Dimitry Andric [Tue, 2 Jan 2024 16:07:31 +0000 (17:07 +0100)]
Revert commit 0e46b49de433 from llvm-project (by Matt Arsenault):

  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
https://github.com/llvm/llvm-project/issues/76416

PR: 276104
MFC after: 1 month

2 months agoMerge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a
Dimitry Andric [Mon, 25 Dec 2023 17:35:41 +0000 (18:35 +0100)]
Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

PR: 276104
MFC after: 1 month

2 months agoTentatively apply https://github.com/llvm/llvm-project/pull/76175
Dimitry Andric [Thu, 21 Dec 2023 22:30:02 +0000 (23:30 +0100)]
Tentatively apply https://github.com/llvm/llvm-project/pull/76175

This fixes libsa including compiler-rt builtins.

PR: 276104
MFC after: 1 month