]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 months agoetc: Automatically generate BSD.lib${libcompat}.dist lists
Jessica Clarke [Thu, 27 Jul 2023 04:10:44 +0000 (05:10 +0100)]
etc: Automatically generate BSD.lib${libcompat}.dist lists

Note that each libcompat still has its own file that must exist.

Reviewed by: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D41182

11 months agoObsoleteFiles.inc: Automatically generate OpenSSL 3 obsoleted libcompat dirs
Jessica Clarke [Thu, 27 Jul 2023 04:10:44 +0000 (05:10 +0100)]
ObsoleteFiles.inc: Automatically generate OpenSSL 3 obsoleted libcompat dirs

Older entries in this file are left alone as hard-coding lib32 as
they're not worth the churn; downstreams will have already moved past
them (in particular, CheriBSD, which adds additional libcompats).

Reviewed by: brooks, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41181

11 months agoMakefile.inc1: Automatically generate _LIBCOMPATS and list-old-* libcompats
Jessica Clarke [Thu, 27 Jul 2023 04:10:43 +0000 (05:10 +0100)]
Makefile.inc1: Automatically generate _LIBCOMPATS and list-old-* libcompats

Reviewed by: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D41180

11 months agoMakefile: Automatically generate list of libcompat targets
Jessica Clarke [Thu, 27 Jul 2023 04:10:43 +0000 (05:10 +0100)]
Makefile: Automatically generate list of libcompat targets

Reviewed by: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D41179

11 months agobsd.compat.mk Extract _ALL_LIBCOMPATS and add related variables
Jessica Clarke [Thu, 27 Jul 2023 04:10:43 +0000 (05:10 +0100)]
bsd.compat.mk Extract _ALL_LIBCOMPATS and add related variables

Adding these to a new bsd.compat.pre.mk will allow other parts of the
tree to iterate over the set of possible libcompats (upper and/or lower)
rather than having to hard-code the list.

Reviewed by: brooks, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41178

11 months agoinpcb: do not copy so_options into inp_flags2
Gleb Smirnoff [Thu, 27 Jul 2023 03:35:41 +0000 (20:35 -0700)]
inpcb: do not copy so_options into inp_flags2

Since f71cb9f74808 socket stays connnected with inpcb through latter's
lifetime and there is no reason to complicate things and copy these
flags.

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

11 months agoinpcb: use internal flag to mark pcbs that are inserted into lbgroup
Gleb Smirnoff [Thu, 27 Jul 2023 03:35:30 +0000 (20:35 -0700)]
inpcb: use internal flag to mark pcbs that are inserted into lbgroup

Using INP_REUSEPORT_LB is unsafe, as it is basically a copy of socket's
SO_REUSEPORT_LB flag, which can be cleared by userland after bind().

Reviewed by: markj
Reported by: syzbot+e7d2e451f89fb444319b@syzkaller.appspotmail.com
Differential Revision: https://reviews.freebsd.org/D41197

11 months agofork1(): properly track the state of the pg_killsx lock
Konstantin Belousov [Wed, 26 Jul 2023 23:24:30 +0000 (02:24 +0300)]
fork1(): properly track the state of the pg_killsx lock

Reported by: dchagin
Fixes: 232b922cb363e01ac0dd2a277d93cf74d8485e79
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

11 months agotcp: fix handling of <RST,ACK> segments in SYN-RCVD for RACK and BBR
Michael Tuexen [Wed, 26 Jul 2023 14:22:13 +0000 (16:22 +0200)]
tcp: fix handling of <RST,ACK> segments in SYN-RCVD for RACK and BBR

This deals with TCP endpoints in the SYN-RCVD state coming from the
SYN-SENT state.

Reviewed by: rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D41203

11 months agotcp: Handle <RST,ACK> in SYN-RCVD
Richard Scheffenegger [Wed, 26 Jul 2023 22:41:25 +0000 (00:41 +0200)]
tcp: Handle <RST,ACK> in SYN-RCVD

Patch base stack to correctly handle the RST bit independently
of other header flags per TCP RFC.

MFC after: 1 week
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D40982

11 months agoAdd diagnostics to fsck_ffs(8) for journaled soft-updates debugging.
Kirk McKusick [Wed, 26 Jul 2023 21:49:07 +0000 (14:49 -0700)]
Add diagnostics to fsck_ffs(8) for journaled soft-updates debugging.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agomsun: Fix typo in math_private.h comment
Steve Kargl [Wed, 26 Jul 2023 18:21:44 +0000 (02:21 +0800)]
msun: Fix typo in math_private.h comment

PR: 272738
MFC after: 3 days

11 months agonetstat -i: compute most field widths dynamically
Mike Karels [Wed, 26 Jul 2023 15:56:52 +0000 (10:56 -0500)]
netstat -i: compute most field widths dynamically

The network and address fields were sometimes truncated for netstat -i
without -W, and often much too wide for netstat -i with the -W option.
Fields such as normal packet counts often overflowed.  As a result,
columns didn't line up, and large white spaces made it harder to
follow a line across the display.  Change the code to compute the
required field sizes for network, address, and various packet counts.
Hoist the code to format network and address into a subroutine that
can be called twice, once to measure the required field widths,
and once to emit the values.  Use separate field widths for input
and output packets, byte counts, and error and drop counters.
These are left at defaults (the preceding values) with the -h
option, in which case the fields have a limited total width.
An extra space is included between the Network and Address, which
otherwise seemed too close.

Change the mention of -W with -i in the man page to say that most
field widths are computed dynamically in this case.

MFC after: 1 week
Reviewed by: sjg, glebius
Differential Revision: https://reviews.freebsd.org/D41160

11 months agokillpg(): close a race with fork(), part 2
Konstantin Belousov [Thu, 20 Jul 2023 21:19:03 +0000 (00:19 +0300)]
killpg(): close a race with fork(), part 2

When we are sending terminating signal to the group, killpg() needs
to guarantee that all group members are to be terminated (it does not
need to ensure that they are terminated on return from killpg()).  The
pg_killsx change eliminates the largest window there, but still, if
a multithreaded process is signalled, the following could happen:
- thread 1 is selected for the signal delivery and gets descheduled
- thread 2 waits for pg_killsx lock, obtains it and forks
- thread 1 continue executing and terminates the process
This scenario allows the child to escape still.

Fix it by single-threading forking parent if a conflict with pg_killsx
is noted.  We try to lock pg_killsx without sleeping, and failure to
acquire it means that a parallel killpg(2) is executed.  Then, stop
other threads for running and in particular, receive signals, to avoid
the situation explained above.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41128

11 months agosigtd(): prefer non-stopped thread as a target for signal queue
Konstantin Belousov [Fri, 21 Jul 2023 09:41:39 +0000 (12:41 +0300)]
sigtd(): prefer non-stopped thread as a target for signal queue

This should improve signal delivery latency and better expose the
process state to the executing threads.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41128

11 months agoRevert "killpg(): close a race with fork(), part 2"
Konstantin Belousov [Thu, 20 Jul 2023 20:59:41 +0000 (23:59 +0300)]
Revert "killpg(): close a race with fork(), part 2"

This reverts commits 81a37995c757b4e3ad8a5c699864197fd1ebdcf5 and
565a343ae3a30bc2973182ff8dfd2fa37d7f615f.

There is still a leakage of the p_killpg_cnt, some but not all sources
of which were identified.

Second, and more important, is that there is a fundamental issue with
blocked signals having KSI_KILLPG flag set.  Queueing of such signal
increments p_killpg_cnt, but it cannot be decremented until the signal
is delivered.  If, for instance, a single-threaded process with blocked
signal receives killpg-kill and executes fork(2), the fork enter check
returns with ERESTART.  And since signal is blocked, the condition
cannot be cleared.

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

11 months agothr_mutex.c: style
Konstantin Belousov [Sat, 22 Jul 2023 17:59:26 +0000 (20:59 +0300)]
thr_mutex.c: style

Reindend and re-fill the statement.

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

11 months agortld_malloc: add cp2op() helper
Konstantin Belousov [Sat, 22 Jul 2023 04:24:03 +0000 (07:24 +0300)]
rtld_malloc: add cp2op() helper

converting user allocation address into overhead pointer

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

11 months agortld_malloc: only include internal rtld headers when building for rtld
Konstantin Belousov [Sat, 22 Jul 2023 04:39:20 +0000 (07:39 +0300)]
rtld_malloc: only include internal rtld headers when building for rtld

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

11 months agortld: remove dup __crt_malloc prototypes
Konstantin Belousov [Sat, 22 Jul 2023 04:37:50 +0000 (07:37 +0300)]
rtld: remove dup __crt_malloc prototypes

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

11 months agortld_malloc: remove outdated comments
Konstantin Belousov [Sat, 22 Jul 2023 04:13:58 +0000 (07:13 +0300)]
rtld_malloc: remove outdated comments

The ovu_magic is not neccessary overlaps with low byte of the ov_next,
for the big endian machines.

There is no range checking in the allocator.

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

11 months agobase: Remove support for the VTOC8 partitioning scheme
Marius Strobl [Wed, 26 Jul 2023 11:08:37 +0000 (13:08 +0200)]
base: Remove support for the VTOC8 partitioning scheme

The removal of the sparc64 support in February 2020 obsoleted the
VTOC8 partitioning scheme as no other FreeBSD platform makes use
of it. Moreover, the code is bitrotting as nothing defines e. g.
LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With
this change, the following commits are reverted as far as VTOC8
is concerned and parts haven't already previously been deleted
along with prior sparc64 removals:
094fcb157d4c98211899cf09d06e2cf19149b7e0
a7d366e9589c95feda6f3bc78c59c6355d51f126
ba8d50d08b9df4e8213f9a6997ff6792ecebcd9b

The alignment example d9711c28efc4ec89ba5ea11f8fd63e9d0a7fc81b
added to the VTOC8 section of gpart.8 is folded into the MBR one.

This should finally conclude the deorbit of sparc64-specific bits.

        We had joy, we had fun
        we ran Unix on a Sun.
        But that source and the song
        of FreeBSD have all gone.

Credits to Michael Bueker for the original "Unix on a Sun" and Rod
McKuen for the "Seasons in the Sun" lyrics.

11 months agoofw(4): Add my copyright and additional history for ofw_reg_to_paddr()
Marius Strobl [Wed, 26 Jul 2023 07:38:53 +0000 (09:38 +0200)]
ofw(4): Add my copyright and additional history for ofw_reg_to_paddr()

The ofw_reg_to_paddr() in this file is the powerpc OF_decode_addr()
formerly added in 812403402e0bc2165c03e37c6f657c7405f95c15. However,
the latter function in turn was based on the sparc64 counterpart I
previously added in 2b2250b149706f492dd615a518aa669e39b78d0a.

11 months agogif(4): Assert that gif_output() isn't called for EtherIP
Marius Strobl [Sun, 23 Jul 2023 16:58:42 +0000 (18:58 +0200)]
gif(4): Assert that gif_output() isn't called for EtherIP

With the current implementation of if_bridge(4), bridge_enqueue()
calls gif_transmit() only. Ensure it stays that way so that the
expectations in both drivers are either met or changed accordingly.

PR: 227450

11 months agogif(4): Revert in{,6}_gif_output() misalignment handling
Marius Strobl [Wed, 19 Jul 2023 17:17:43 +0000 (19:17 +0200)]
gif(4): Revert in{,6}_gif_output() misalignment handling

The code added in c89c8a1029860182eece5d51ec09119b9500e5a1 in order
to compensate possible misalignment caused by prepending the IP4/6
header with an EtherIP one got broken at some point by a rewrite of
gif(4). For better or worse, 8018ac153f7671699ca008f31c0fad9caef2f531
relaxed the alignment of struct ip from 32 bit to 16 bit, though. As
a result, a 16 bit offset of the IPv4 header induced by the addition
of the 16 bit EtherIP one no longer is a problem in the first place.
The alignment of struct ip6_hdr currently is even only 8 bit, making
it even less problematic with regards to possible misalignment.
Thus, remove the code for handling misalignment in in{,6}_gif_output()
altogether again.
While at it, replace the 3 bcopy(9) calls in gif(4) with memcpy(9) as
there's no need to handle overlap here.

11 months agotzsetup: fix "misleading indentation" warning with -DVERBOSE
Yuri Pankov [Wed, 26 Jul 2023 10:33:42 +0000 (12:33 +0200)]
tzsetup: fix "misleading indentation" warning with -DVERBOSE

11 months agolibpfct: ensure the initial allocation is large enough
Kristof Provost [Wed, 26 Jul 2023 08:30:22 +0000 (10:30 +0200)]
libpfct: ensure the initial allocation is large enough

Ensure that we allocate enough memory for the packed nvlist, no matter
what size hint was provided.

MFC after: 1 week
Reported by: R. Christian McDonald <rcm@rcm.sh>
Sponsored by: Rubicon Communications, LLC ("Netgate")

11 months agoarm64 pmap: Eliminate unnecessary TLB invalidations
Alan Cox [Sun, 23 Jul 2023 07:11:43 +0000 (02:11 -0500)]
arm64 pmap: Eliminate unnecessary TLB invalidations

Eliminate unnecessary TLB invalidations by pmap_kenter(),
pmap_qenter(), and pmap_mapbios() when the old page table entries
were invalid.

While I'm here, correct some nearby whitespace issues.

MFC after: 2 weeks

11 months agovm: Fix vm_map_find_min()
Alan Cox [Tue, 25 Jul 2023 07:24:19 +0000 (02:24 -0500)]
vm: Fix vm_map_find_min()

Fix the handling of address hints that are less than min_addr by
vm_map_find_min().

Reported by: dchagin
Reviewed by: kib
Fixes: d8e6f4946cec0 "vm: Fix anonymous memory clustering under ASLR"
Differential Revision: https://reviews.freebsd.org/D41159

11 months agoAdd quitclean command to fsdb(8) to request a filesystem not be marked dirty.
Kirk McKusick [Wed, 26 Jul 2023 02:42:41 +0000 (19:42 -0700)]
Add quitclean command to fsdb(8) to request a filesystem not be marked dirty.

A new command, quitclean, is added to fsdb(8) to request that the
filesystem not be marked as needing a full fsck(8). This is useful
when creating deliberately bad filesystem images to be used to check
that fsck is properly able to clean them up.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agoHave fsdb(8) only mark a filesystem dirty when it is modified.
Kirk McKusick [Wed, 26 Jul 2023 02:27:59 +0000 (19:27 -0700)]
Have fsdb(8) only mark a filesystem dirty when it is modified.

Until this update, the fsdb(8) command always marked a filesystem
as needing a full fsck unless it was run with the -n flag which
allowed no changes to be made.

This change tracks modifications to the filesystem. Two types of
changes are tracked. The first type of changes are those that are
not critical to the integrity of the filesystem such as changes to
owner, group, time stamps, access mode, and generation number. The
second type of changes are those that do affect the integrity of
the filesystem including zeroing inodes, changing block pointers,
directory entries, link counts, file lengths, file types, and file
flags.

When quitting having made no changes or only changes to data that
is not critical to filesystem integrity, the clean state of the
filesystem is left unchanged. But if filesystem critical data are
changed then fsdb will set the unclean flag which will require a
full fsck to be run before the filesystem can be mounted.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agomac_ipacl: new MAC policy module to limit jail/vnet IP configuration
Shivank Garg [Tue, 25 Jul 2023 20:27:06 +0000 (20:27 +0000)]
mac_ipacl: new MAC policy module to limit jail/vnet IP configuration

The mac_ipacl policy module enables fine-grained control over IP address
configuration within VNET jails from the base system.
It allows the root user to define rules governing IP addresses for
jails and their interfaces using the sysctl interface.

Requested by: multiple
Sponsored by: Google, Inc. (GSoC 2019)
MFC after: 2 months
Reviewed by: bz, dch (both earlier versions)
Differential Revision: https://reviews.freebsd.org/D20967

11 months agoarm64 lib32: enable building of lib32 on arm64
Mike Karels [Tue, 25 Jul 2023 23:59:52 +0000 (18:59 -0500)]
arm64 lib32: enable building of lib32 on arm64

Enable LIB32 option on aarch64, defaulting to YES; it had defaulted
to "broken".  Add required variables for how to compile lib32 on
arm.  Use /usr/include/arm for armv7 (32-bit) headers, analogous to
/usr/include/i386 on amd64.  Omit libomp from lib32; it is not
supported on armv7.

Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D40945

11 months agoarm64 lib32: prepare arm64 headers to redirect to arm
Mike Karels [Tue, 25 Jul 2023 23:59:26 +0000 (18:59 -0500)]
arm64 lib32: prepare arm64 headers to redirect to arm

In order to compile lib32 libraries and other 32-bit code on arm64,
<machine/foo.h> needs to be redirected to an arm header rather
than arm64 when building with -m32.  Ifdef the arm64 headers that
are installed in /usr/include/machine and used by user-level software
(including references from /usr/include/*.h) so that if __arm__ is
defined when including the arm64 version, <arm/foo.h> is included
rather than using the rest of the file's contents.  Some arm headers
had no arm64 equivalent; headers were added just to do the redirection.
These files use #error if __arm__ is not defined to guard against
confusion.  Also add an include/arm Makefile, and modify Makefiles
as needed to install everything, including the arm files in
/usr/include/arm.  fenv.h comes from lib/msun/arm/fenv.h.

The new arm64 headers are:
    acle-compat.h
    cpuinfo.h
    sysreg.h

Reviewed by: jrtc27, imp
Differential Revision: https://reviews.freebsd.org/D40944

11 months agoarm64 lib32: change clang to allow -m32 on arm64
Mike Karels [Tue, 25 Jul 2023 23:58:51 +0000 (18:58 -0500)]
arm64 lib32: change clang to allow -m32 on arm64

The FreeBSD driver support for clang tested explicitly for 32-bit
Intel, MIPS, or PowerPC targets where /usr/lib32/libcrt1.o was
present to decide whether -m32 should use /usr/lib32.  At jrtc27's
suggestion, simply test for a 32-bit platform rather than adding
arm to the list.  Upstreamed as
https://github.com/llvm/llvm-project/commit/3450272fc281979388bb845a9fffb59b42cc2e7e
Bump the freebsd version to force a bootstrap build.  This is one
step in adding support for -m32 on arm64.

Reviewed by: jrtc27, brooks, dim
Differential Revision: https://reviews.freebsd.org/D40943

11 months agoMakefile.inc1: add LIBCOMPAT_INCLUDE_DIRS to reduce arch ifdefs
Mike Karels [Tue, 25 Jul 2023 23:58:29 +0000 (18:58 -0500)]
Makefile.inc1: add LIBCOMPAT_INCLUDE_DIRS to reduce arch ifdefs

In preparation for adding support for building lib32 on arm64,
add a list of architecture-specific include directories,
LIBCOMPAT_INCLUDE_DIRS, then replace the architecture-specific
ifdefs throughout the file with simple loops.  Another commit
will add a definition of LIBCOMPAT_INCLUDE_DIRS for aarch64.

Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D40977

11 months agotools/build: Tidy up whitespace and comments, and delete duplicate code
Jessica Clarke [Tue, 25 Jul 2023 21:24:02 +0000 (22:24 +0100)]
tools/build: Tidy up whitespace and comments, and delete duplicate code

We already handle the make and bmake links unconditionally above.

11 months agoComment cleanup.
Kirk McKusick [Tue, 25 Jul 2023 21:07:31 +0000 (14:07 -0700)]
Comment cleanup.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agoDebugging output additions. No functional changes intended.
Kirk McKusick [Tue, 25 Jul 2023 21:02:33 +0000 (14:02 -0700)]
Debugging output additions. No functional changes intended.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agokern_sig.c: include sys/jail.h per style(9)
Brooks Davis [Tue, 25 Jul 2023 00:13:37 +0000 (01:13 +0100)]
kern_sig.c: include sys/jail.h per style(9)

Fixes: e7228204343ac61d2316e74891e3606361a23f6e
Sponsored by: DARPA

11 months agobhyvectl: Add '--get-debug-cpus' command
Vitaliy Gusev [Tue, 25 Jul 2023 12:03:54 +0000 (14:03 +0200)]
bhyvectl: Add '--get-debug-cpus' command

vmm and libvmmapi already have handlers for that. When adding debug
cpus, they were only used for the debug stub. Over time, they were
reused by other parts like snapshots or idle APs.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40804

11 months agobhyve: do not hold CRB mutex when executing TPM commands
Corvin Köhne [Fri, 23 Jun 2023 06:31:38 +0000 (08:31 +0200)]
bhyve: do not hold CRB mutex when executing TPM commands

TPM commands can take up to several seconds to execute. If we hold the
CRB mutex while executing the command, MMIO accesses could be blocked
for a long time. Therefore, just copy all required values and work on
the copied values.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40724

11 months agoRELNOTES: add a note about lua config files in loader
Kyle Evans [Tue, 25 Jul 2023 04:35:25 +0000 (23:35 -0500)]
RELNOTES: add a note about lua config files in loader

Scripted configuration can make safer some use-cases that currently use
local.lua, but don't actually need to access external resources to make
their changes.  Let's note the new feature in RELNOTES.

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

11 months agoUPDATING: Update nvd info
Warner Losh [Tue, 25 Jul 2023 04:32:39 +0000 (22:32 -0600)]
UPDATING: Update nvd info

Sponsored by: Netflix

11 months agoUPDATING: Note CAM update
Warner Losh [Tue, 25 Jul 2023 04:25:57 +0000 (22:25 -0600)]
UPDATING: Note CAM update

Not the update to standard uintXX_t from the traditional BSD u_intXX_t
types.

Sponsored by: Netflix

11 months agolibcam: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
libcam: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocamcontrol: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
camcontrol: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocam/mmc: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
cam/mmc: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocam/nvme: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
cam/nvme: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocam/ctl: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
cam/ctl: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocam/scsi: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
cam/scsi: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocam/ata: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
cam/ata: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agocam: Migrate to modern uintXX_t from u_intXX_t
Warner Losh [Tue, 25 Jul 2023 03:17:41 +0000 (21:17 -0600)]
cam: Migrate to modern uintXX_t from u_intXX_t

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After: 3 days
Sponsored by: Netflix

11 months agoamd64: Use a larger boot stack
Mark Johnston [Mon, 24 Jul 2023 22:47:42 +0000 (18:47 -0400)]
amd64: Use a larger boot stack

With sanitizers enabled, it becomes possible to overflow the stack when
only a single page is used.  Follow arm64's example and use the default
kernel stack size instead.  This is a bit wasteful, but without a guard
page, overflow merely corrupts adjacent .bss entries and is thus
difficult to debug.

Note, with a GENERIC kernel we already consume over half of the
available boot stack space, see the review for an example.

Reviewed by: kib
Reported by: Jenkins
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41166

11 months agovnode read(2)/write(2): acquire rangelock regardless of do_vn_io_fault()
Konstantin Belousov [Sun, 23 Jul 2023 15:55:50 +0000 (18:55 +0300)]
vnode read(2)/write(2): acquire rangelock regardless of do_vn_io_fault()

To ensure atomicity of reads against parallel writes and truncates,
vnode lock was not enough at least since introduction of vn_io_fault().
That code only take rangelock when it was possible that vn_read() and
vn_write() could drop the vnode lock.

At least since the introduction of VOP_READ_PGCACHE() which generally
does not lock the vnode at all, rangelocks become required even
for filesystems that do not need vn_io_fault() workaround.  For
instance, tmpfs.

PR: 272678
Analyzed and reviewed by: Andrew Gierth  <andrew@tao11.riddles.org.uk>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41158

11 months agoarm64/disassem.c: add extended register instruction definitions
Mykola Hohsadze [Mon, 24 Jul 2023 20:49:24 +0000 (17:49 -0300)]
arm64/disassem.c: add extended register instruction definitions

Add disassembly support for the following extended register
instructions: add, adds, sub, subs, cmp, cmn.

Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://reviews.freebsd.org/D40967

11 months agoarm64/disassem.c: remove redundant OP_RN_SP for TYPE_02
Mykola Hohsadze [Mon, 24 Jul 2023 20:47:17 +0000 (17:47 -0300)]
arm64/disassem.c: remove redundant OP_RN_SP for TYPE_02

Removed redundant OP_RN_SP for TYPE_02, since these addressing modes
always use the SP register, never XZR.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40588

11 months agonvme: Use a memdesc for the request buffer instead of a bespoke union.
John Baldwin [Mon, 24 Jul 2023 17:32:58 +0000 (10:32 -0700)]
nvme: Use a memdesc for the request buffer instead of a bespoke union.

This avoids encoding CAM-specific knowledge in nvme_qpair.c.

Reviewed by: chuck, imp, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41119

11 months agobus_dma: Trim CAM includes from subr_bus_dma.c
Marius Strobl [Mon, 24 Jul 2023 17:26:06 +0000 (10:26 -0700)]
bus_dma: Trim CAM includes from subr_bus_dma.c

These are no longer needed after commit c5312bd79e66.  This did
require adding an include of <sys/limits.h> instead for SIZE_T_MAX
which previously was dragged in via header pollution.

11 months agoarm: Only include sysreg.h when needed in asm.h
Andrew Turner [Mon, 24 Jul 2023 16:58:16 +0000 (17:58 +0100)]
arm: Only include sysreg.h when needed in asm.h

We only need sysreg.h for armv6 barriers

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41141

11 months agoAdd old arm headers to ObsoleteFiles.inc
Andrew Turner [Mon, 24 Jul 2023 16:58:15 +0000 (17:58 +0100)]
Add old arm headers to ObsoleteFiles.inc

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41140

11 months agoarm: Rename pte-v6.h to pte.h
Andrew Turner [Mon, 24 Jul 2023 16:58:15 +0000 (17:58 +0100)]
arm: Rename pte-v6.h to pte.h

There is no need for this to be versioned after the removal of armv4/v5

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41139

11 months agoarm: Move contents of pmap-v6.h into pmap.h
Andrew Turner [Mon, 24 Jul 2023 16:58:15 +0000 (17:58 +0100)]
arm: Move contents of pmap-v6.h into pmap.h

Previously we had an armv4/v5 and armv6/v7 copy of the pmap header. As
we have removed armv4/v5 support we can now merge the armv6/v7 code
into pmap.h

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

11 months agoarm: Move contents of cpu-v6.h into cpu.h
Andrew Turner [Mon, 24 Jul 2023 16:58:14 +0000 (17:58 +0100)]
arm: Move contents of cpu-v6.h into cpu.h

Previously we had an armv4/v5 and armv6/v7 copy of the cpu.h header. As
we have removed armv4/v5 support we can now merge the armv6/v7 code
into cpu.h

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

11 months agoarm: Remove swi.h
Andrew Turner [Mon, 24 Jul 2023 16:58:14 +0000 (17:58 +0100)]
arm: Remove swi.h

It has been unneeded since moving to the Arm EABI

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41136

11 months agoarm: Move contents of atomic-v6.h into atomic.h
Andrew Turner [Mon, 24 Jul 2023 16:58:13 +0000 (17:58 +0100)]
arm: Move contents of atomic-v6.h into atomic.h

Previously we had an armv4/v5 and armv6/v7 implementation of the atomic
operations. As we have removed armv4/v5 support we can now merge the
armv6/v7 code into atomic.h

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

11 months agoarm: Explain why _atomic_subword.h is needed
Andrew Turner [Mon, 24 Jul 2023 16:58:13 +0000 (17:58 +0100)]
arm: Explain why _atomic_subword.h is needed

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41134

11 months agoRemove left over includes from armv4/v5
Andrew Turner [Mon, 24 Jul 2023 16:58:13 +0000 (17:58 +0100)]
Remove left over includes from armv4/v5

These includes were added for armv4 and armv5 support. Remove them as
this has been removed from the tree.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41133

11 months agonetinet6 tests: test for loss of Solicited-node multicast groups
Kristof Provost [Wed, 19 Jul 2023 14:37:28 +0000 (16:37 +0200)]
netinet6 tests: test for loss of Solicited-node multicast groups

The multicast code has an issue where it can lose the Solicited-node
multicast group subscription if the same address is added twice.

Test for this.

PR: 233683
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41123

11 months agomld: always commit state changes on leaving
Kristof Provost [Thu, 20 Jul 2023 07:41:45 +0000 (09:41 +0200)]
mld: always commit state changes on leaving

Resolve a race condition where we'd lose the Solicited-node multicast
group subscription if we assigned the same IPv6 address twice.

PR: 233683
Reviewed by: ae
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41124

11 months agosys_getrandom: fix a function reference in a comment
Mitchell Horne [Mon, 24 Jul 2023 13:48:38 +0000 (10:48 -0300)]
sys_getrandom: fix a function reference in a comment

MFC after: 3 days
Sponsored by: FreeBSD Foundation

11 months agopuc: fix man page reference
Mitchell Horne [Mon, 24 Jul 2023 12:52:19 +0000 (09:52 -0300)]
puc: fix man page reference

The reference to puc(9) is wrong; the page does not exist, and drivers
belong to section 4. Change the reference to puc(4), which does exist.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

11 months agolibarchive: merge from vendor branch
Martin Matuska [Mon, 24 Jul 2023 05:42:43 +0000 (07:42 +0200)]
libarchive: merge from vendor branch

Libarchive 3.7.0

Important changes (relevant to FreeBSD):
  #1814 Do not account for NULL terminator when comparing with "TRAILER!!!"
  #1818 Add ability to produce multi-frame zstd archives
  #1840 year 2038 fix for pax archives on platforms with 64-bit time_t
  #1860 Make single bit bitfields unsigned to avoid clang 16 warning
  #1869 Fix FreeBSD builds with WARNS=6
  #1873 bsdunzip ported to libarchive from FreeBSD
  #1894 read support for zstd compression in 7zip archives
  #1918 ARM64 filter support in 7zip archives

MFC after: 2 weeks
PR: 272567 (exp-run)

11 months agobsd.linker.mk: Use :C not :S for regex
Jessica Clarke [Mon, 24 Jul 2023 00:50:55 +0000 (01:50 +0100)]
bsd.linker.mk: Use :C not :S for regex

Whilst ^ and $ are supported with C, those are special cases, and
general regex syntax like groups and alternations are not. Use the
correct modifier so we get a version number out that's not 0 (which is
what happens when it can't be parsed by the later code).

Fixes: c4177f5b41d4 ("bsd.linker.mk: Handle Xcode 15 linker identification")
MFC after: 1 week

11 months agobsd.linker.mk: Handle Xcode 15 linker identification
Jessica Clarke [Mon, 24 Jul 2023 00:34:17 +0000 (01:34 +0100)]
bsd.linker.mk: Handle Xcode 15 linker identification

The upcoming Xcode 15 introduces a new linker (called ld-prime or ld-new
in some documentation) to replace the classic ld64, which we need to
handle.

Previously, the linker would identify itself as:

  @(#)PROGRAM:ld  PROJECT:ld64-<version>

Now, there are two cases. When the classic ld64 is in use, it identifies
itself as:

  @(#)PROGRAM:ld-classic  PROJECT:ld64-<version>

When the new linker is in use, it identifies itself as:

  @(#)PROGRAM:ld  PROJECT:dyld-<version>

Thus, tweak the detection to allow a -classic suffix in the PROGRAM
string and to allow a dyld- prefix instead of an ld64- prefix on the
version number in the PROJECT string.

MFC after: 1 week

11 months agoWork around VNET and DPCPU related panics on aarch64
Dimitry Andric [Sun, 23 Jul 2023 13:48:36 +0000 (15:48 +0200)]
Work around VNET and DPCPU related panics on aarch64

lld >= 14 and recent GNU ld can relax adrp+add and adrp+ldr
instructions, which breaks VNET and DPCPU when used in modules.

Until VNET and DPCPU can be fixed to deal with these relaxed
instructions, disable linker relaxation for now.

PR: 264094
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41156

11 months agosctp: include sctp_module.c in kernel builds
Michael Tuexen [Sun, 23 Jul 2023 12:31:17 +0000 (14:31 +0200)]
sctp: include sctp_module.c in kernel builds

Allow kldload to detect that SCTP has been build into the kernel.

MFC after: 3 days

11 months agoMove LIBADD lines from usr.bin/clang/*/Makefile one level up
Dimitry Andric [Sun, 23 Jul 2023 20:04:46 +0000 (22:04 +0200)]
Move LIBADD lines from usr.bin/clang/*/Makefile one level up

Some utilities under usr.bin/clang were only linked to libz, while most
others were linked to libz and libzstd. Make this consistent, and remove
repetition, by moving these LIBADD lines to usr.bin/clang/clang.prog.mk
and usr.bin/clang/clang.prog.mk.

MFC after: 3 days

11 months agologin_getclassbyname(3): use calloc.
Xin LI [Sun, 23 Jul 2023 18:18:24 +0000 (11:18 -0700)]
login_getclassbyname(3): use calloc.

11 months agovfs: fix up NDFREE_PNBUF usage in vfs_mountroot_shuffle
Mateusz Guzik [Sun, 23 Jul 2023 13:42:34 +0000 (13:42 +0000)]
vfs: fix up NDFREE_PNBUF usage in vfs_mountroot_shuffle

Noted by: karels

11 months agoufs: stop using LK_SLEEPFAIL in ffs_sync
Mateusz Guzik [Sat, 22 Jul 2023 07:19:03 +0000 (07:19 +0000)]
ufs: stop using LK_SLEEPFAIL in ffs_sync

It provides nothing as either locking succeeds or fails with ENOENT as
is.

11 months agosctp: update zero checksum support
Michael Tuexen [Sun, 23 Jul 2023 04:41:32 +0000 (06:41 +0200)]
sctp: update zero checksum support

Implement support for the error detection method identifier.
MFC after: 2 weeks

11 months agoMerge commit 2b0f5df7b4e0 from llvm-project (by Jessica Clarke):
Dimitry Andric [Sun, 23 Jul 2023 11:01:42 +0000 (13:01 +0200)]
Merge commit 2b0f5df7b4e0 from llvm-project (by Jessica Clarke):

  [builtins][Mips] Un-break FreeBSD build of __clear_cache

  Commit 674a17e9bbe8 ("MIPS/compiler_rt: use synci to flush icache on
  r6") completely removed the OS-specific guards under the guise of "For
  pre-r6, we can use cacheflush libc function, which is same on Linux and
  FreeBSD." However, the code in question had guards for Linux and
  OpenBSD, not Linux and FreeBSD, and FreeBSD does not have a cacheflush
  libc function as claimed, so this was neither the statement they
  intended to make nor was it sufficient justification for making the code
  completely unconditional. Whilst the upcoming FreeBSD 14 release has
  dropped support for MIPS, FreeBSD 13 has support for it.

  Fix this by only calling cacheflush on the OSes where it was previously
  called, and not on other OSes where it either definitely isn't available
  (FreeBSD) or is unknown (any other OS than the three mentioned in this
  commit).

This is only needed for MFC'ing, as mips has been removed from
14-CURRENT.

PR: 271047
MFC after: immediately

11 months agoxhci(4): Describe AMD 400 Series USB 3.1 controllers
Marius Strobl [Sat, 22 Jul 2023 21:13:46 +0000 (23:13 +0200)]
xhci(4): Describe AMD 400 Series USB 3.1 controllers

While at it, correct the string for 300 series ones, these also are
already xHCI 3.1.

Fixes: d171d2f2 Add AHCI/XHCI device IDs found on AMD Ryzen+B350 system

11 months agoarm64 pmap: Retire PMAP_INLINE
Alan Cox [Sat, 22 Jul 2023 17:55:43 +0000 (12:55 -0500)]
arm64 pmap: Retire PMAP_INLINE

Neither of the remaining callers to pmap_kremove() warrant inlining.
Those calls rarely occur.  In other words, we were optimizing for the
uncommon case.

MFC after: 1 week

11 months agoarm64 pmap: Eliminate some duplication of code
Alan Cox [Sat, 22 Jul 2023 17:41:49 +0000 (12:41 -0500)]
arm64 pmap: Eliminate some duplication of code

pmap_unmapbios() can simply call pmap_kremove_device() rather than
duplicating its code.

While I'm here, add a comment to pmap_kremove_device() explaining its
proper use, and fix a whitespace issue.

MFC after: 1 week

11 months agoe1000: add missing parens in csum setup
Kevin Bowling [Sun, 23 Jul 2023 00:03:26 +0000 (17:03 -0700)]
e1000: add missing parens in csum setup

Reported by: rscheff
Fixes: 4f9a44a215f8 e1000: Fix/enable IPv6 transmit checksum offload
MFC after: 2 weeks

11 months agoe1000: Fix/enable IPv6 transmit checksum offload
Kevin Bowling [Sat, 22 Jul 2023 22:58:34 +0000 (15:58 -0700)]
e1000: Fix/enable IPv6 transmit checksum offload

Fixes and enables txcsum6 offload for lem(4) and em(4).

MFC after: 2 weeks

11 months agoe1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
Kevin Bowling [Sat, 22 Jul 2023 18:33:27 +0000 (11:33 -0700)]
e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes

* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30072

11 months agolinux(4): Implement xattr syscalls
Dmitry Chagin [Sat, 22 Jul 2023 11:03:33 +0000 (14:03 +0300)]
linux(4): Implement xattr syscalls

Reviewed by:
Differential revision: https://reviews.freebsd.org/D35544
MFC after: 1 month

11 months agovfs: Export exattr methods to reuse by Linuxulator
Dmitry Chagin [Sat, 22 Jul 2023 11:03:33 +0000 (14:03 +0300)]
vfs: Export exattr methods to reuse by Linuxulator

Reviewed by:
Differential revision: https://reviews.freebsd.org/D35543
MFC after: 1 month

11 months agolinux(4): Regen for xattr syscalls
Dmitry Chagin [Sat, 22 Jul 2023 11:03:32 +0000 (14:03 +0300)]
linux(4): Regen for xattr syscalls

MFC after: 1 month

11 months agolinux(4): Modify xattr syscalls to match Linux
Dmitry Chagin [Sat, 22 Jul 2023 11:03:31 +0000 (14:03 +0300)]
linux(4): Modify xattr syscalls to match Linux

MFC after: 1 month

11 months agolibc/csu: Do not compile the finalizer() for PIC build
Dmitry Chagin [Sat, 22 Jul 2023 08:56:06 +0000 (11:56 +0300)]
libc/csu: Do not compile the finalizer() for PIC build

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

11 months agoarm64/riscv pmap: Initialize the pmap's pm_pvchunk field
Alan Cox [Sun, 16 Jul 2023 20:58:04 +0000 (15:58 -0500)]
arm64/riscv pmap: Initialize the pmap's pm_pvchunk field

I believe that there are two reasons that the missing TAILQ
initialization operations haven't caused a problem.  First, the TAILQ
head's first field is being initialized to zeroes elsewhere.  Second,
the first access to the TAILQ head's last field is by
TAILQ_INSERT_HEAD(), which assigns to the last field without reading
it when the first field is NULL.

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

11 months agoRevert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"
Kevin Bowling [Sat, 22 Jul 2023 04:42:23 +0000 (21:42 -0700)]
Revert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"

Seems to cause a panic when booting under VitrualBox.

Reported by: yasu

This reverts commit 95f7b36e8fac45092b9a4eea5e32732e979989f0.

11 months agoip output: ensure that mbufs are mapped if ipsec is enabled
Konstantin Belousov [Thu, 20 Jul 2023 12:08:24 +0000 (15:08 +0300)]
ip output: ensure that mbufs are mapped if ipsec is enabled

Ipsec needs access to packet headers to determine if a policy is
applicable. It seems that typically IP headers are mapped, but the code
is arguably needs to check this before blindly accessing them. Then,
operations like m_unshare() and m_makespace() are not yet ready for
unmapped mbufs.

Ensure that the packet is mapped before calling into IPSEC_OUTPUT().

PR: 272616
Reviewed by: jhb, markj
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41112

11 months agocam_periph: Comment about why we need to reset cbfcnp
Warner Losh [Fri, 21 Jul 2023 16:11:37 +0000 (10:11 -0600)]
cam_periph: Comment about why we need to reset cbfcnp

Just spent a few minutes puzzling out why we do this. Add a comment to
remind my future self (and other intersted folk) why we do the reset
here when we'd set it a few lines above.

Sponsored by: Netflix

11 months agocam_periph: Fix a comment
Warner Losh [Fri, 21 Jul 2023 16:06:03 +0000 (10:06 -0600)]
cam_periph: Fix a comment

Add a couple of words so that this sentence makes sense.

Sponsored by: Netflix

11 months agoseq: style(9) cleanup
Ed Maste [Sun, 25 Jun 2023 23:33:49 +0000 (19:33 -0400)]
seq: style(9) cleanup

This is in part for diff reduction with OpenBSD.

Sponsored by: The FreeBSD Foundation