Commit graph

285156 commits

Author SHA1 Message Date
Martin Matuska e64fe029e9 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)
2023-07-24 07:42:43 +02:00
Jessica Clarke 7f9318a022 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:		c4177f5b41 ("bsd.linker.mk: Handle Xcode 15 linker identification")
MFC after:	1 week
2023-07-24 01:50:55 +01:00
Jessica Clarke c4177f5b41 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
2023-07-24 01:34:17 +01:00
Dimitry Andric 80e4ac2964 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
2023-07-24 00:35:04 +02:00
Michael Tuexen 058d1722b0 sctp: include sctp_module.c in kernel builds
Allow kldload to detect that SCTP has been build into the kernel.

MFC after:	3 days
2023-07-23 14:34:10 +02:00
Dimitry Andric f576172682 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
2023-07-23 22:04:55 +02:00
Xin LI 9df529b8a1 login_getclassbyname(3): use calloc. 2023-07-23 11:18:24 -07:00
Mateusz Guzik 176d83eafc vfs: fix up NDFREE_PNBUF usage in vfs_mountroot_shuffle
Noted by:	karels
2023-07-23 13:44:15 +00:00
Mateusz Guzik 4d9b2ed34b ufs: stop using LK_SLEEPFAIL in ffs_sync
It provides nothing as either locking succeeds or fails with ENOENT as
is.
2023-07-23 13:44:15 +00:00
Michael Tuexen 52640d6174 sctp: update zero checksum support
Implement support for the error detection method identifier.
MFC after:	2 weeks
2023-07-23 06:41:32 +02:00
Dimitry Andric b8f1c9dd9b 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
2023-07-23 13:01:42 +02:00
Marius Strobl 83e67a9d14 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
2023-07-23 09:21:46 +02:00
Alan Cox 7b1e606c72 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
2023-07-23 00:34:17 -05:00
Alan Cox 0aebcfc9f4 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
2023-07-23 00:34:17 -05:00
Kevin Bowling 92fd2f39e5 e1000: add missing parens in csum setup
Reported by:	rscheff
Fixes:	4f9a44a215 e1000: Fix/enable IPv6 transmit checksum offload
MFC after:	2 weeks
2023-07-22 17:05:55 -07:00
Kevin Bowling 4f9a44a215 e1000: Fix/enable IPv6 transmit checksum offload
Fixes and enables txcsum6 offload for lem(4) and em(4).

MFC after:	2 weeks
2023-07-22 15:58:34 -07:00
Kevin Bowling 918c25677d 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
2023-07-22 12:13:43 -07:00
Dmitry Chagin 22dca7acf7 linux(4): Implement xattr syscalls
Reviewed by:
Differential revision:	https://reviews.freebsd.org/D35544
MFC after:		1 month
2023-07-22 14:03:33 +03:00
Dmitry Chagin 6453d4240f vfs: Export exattr methods to reuse by Linuxulator
Reviewed by:
Differential revision:	https://reviews.freebsd.org/D35543
MFC after:		1 month
2023-07-22 14:03:33 +03:00
Dmitry Chagin d9c2dc6bf1 linux(4): Regen for xattr syscalls
MFC after:		1 month
2023-07-22 14:03:32 +03:00
Dmitry Chagin 41f2c69ee3 linux(4): Modify xattr syscalls to match Linux
MFC after:		1 month
2023-07-22 14:03:31 +03:00
Dmitry Chagin 241a55b461 libc/csu: Do not compile the finalizer() for PIC build
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D41148
2023-07-22 11:56:06 +03:00
Alan Cox 29edff0dea 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
2023-07-21 23:58:18 -05:00
Kevin Bowling 5d3c982549 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 95f7b36e8f.
2023-07-21 21:42:23 -07:00
Konstantin Belousov bc310a95c5 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
2023-07-21 21:51:13 +03:00
Warner Losh ff4633d9f8 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
2023-07-21 10:11:37 -06:00
Warner Losh b4993704d6 cam_periph: Fix a comment
Add a couple of words so that this sentence makes sense.

Sponsored by:		Netflix
2023-07-21 10:07:13 -06:00
Ed Maste 8f8da1bcc7 seq: style(9) cleanup
This is in part for diff reduction with OpenBSD.

Sponsored by:	The FreeBSD Foundation
2023-07-21 10:17:24 -04:00
Kristof Provost 47d0c1fe7d pf.conf.5: document SCTP support
Mention SCTP in the pf.conf.5

Reviewed by:	tuexen
MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40870
2023-07-21 12:32:19 +02:00
Kristof Provost b7a9a5773a pf tests: test SCTP pfsync
Ensure that SCTP connections survive a failover to the backup pf
instance.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40869
2023-07-21 12:32:19 +02:00
Kristof Provost 4369a57514 pf tests: test 'rdr' for SCTP
Explicitly test that we cannot change the port number with rdr.
That's not a desireable feature on SCTP, because it could break
multihomed connections.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40868
2023-07-21 12:32:19 +02:00
Kristof Provost 1e02b7cb07 pf tests: test SCTP NAT
MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40867
2023-07-21 12:32:19 +02:00
Kristof Provost 6053adafaa pf: add SCTP NAT support
Support NAT-ing SCTP connections.

This is mostly similar to UDP and TCP, but we refuse to change ports for
SCTP, to avoid interfering with multihomed connections.

As a result we also never copy the SCTP header back or recalculate
checksums as we'd do for TCP or UDP (because we don't modify the header
for SCTP).

We do use the existing pf_change_ap() function to modify the packet,
because we may still need to update the IPv4 header checksum.

Reviewed by:	tuexen
MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40866
2023-07-21 12:32:19 +02:00
Kristof Provost 2d42aa9d7b pf tests: test SCTP 'return'
Ensure that we send a correct abort message for 'block return' rules.

Test this by validating that nc doesn't sit around waiting for a
connection. It should give up immediately when it receives the abort.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40865
2023-07-21 12:32:18 +02:00
Kristof Provost d1bc1e9e1a pf: support 'return' for SCTP
Send an SCTP Abort message if we're refusing a connection, just like we
send a RST for TCP.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40864
2023-07-21 12:32:18 +02:00
Kristof Provost 9536347379 pf tests: basic SCTP connection test
pf can now inspect SCTP. Check that we can set up a connection.
IPv4 and IPv6 tests.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40863
2023-07-21 12:32:18 +02:00
Kristof Provost 010ee43f56 pf: initial SCTP support
Basic state tracking for SCTP. This means we scan through the packet to
identify the different chunks (so we can identify state changes).

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40862
2023-07-21 12:32:18 +02:00
Kristof Provost 0bd4a6837c pfctl: SCTP can have port numbers
MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40861
2023-07-21 12:32:18 +02:00
Kristof Provost 61e22e9b29 pf: use sctp_calculate_cksum()
This function is always available, even if the SCTP or SCTP_SUPPORT options
are not set.
That lets us remove an ifdef, and also means we improve pf's SCTP handling
when the options are not set.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D40911
2023-07-21 12:32:17 +02:00
Kristof Provost 9f23cbd6ca atf_pytest_wrapper: fix use with pytest-7.4
As of pytest 7.4 it no longer walks all the way to the root directory
of the file system to find conftest files. As a result we don't find /
usr/tests/conftest.py, and don't load atf_python. That in turn causes
atf_python tests to fail.

Explicitly set the confcutdir, as advised by the pytest changelog.

See also:	https://github.com/pytest-dev/pytest/pull/11043
MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D41064
2023-07-21 11:23:21 +02:00
Elliott Mitchell 20fc5bf7df xen: move vcpu_info to common, leave hook for setup
vcpu_info is crucial for the Xen event channel core.  Since both the
data and setup steps are identical between architectures, move them to
the common file.  Since there is no cross-architecture method to call
a function on every processor during bring-up, simply leave the setup
function.

The number of vcpu_info structures available on the shared information
page varies by architecture.  Instead of hard-coding the count use
nitems().  Add a warning message for this being used.

Switch to XEN_VCPUID() and use Xen's typedefs.

panic() on failure since >32 processors is no longer unusual.

royger: Specify 64-byte alignment for vcpu_info to try to defend
against vcpu_info crossing a page boundary.  Add detection for this
limit.

Reviewed by: royger
2023-07-21 10:59:12 +02:00
Warner Losh 774ab87cf2 cam: Add CAM_NVME_STATUS_ERROR error code
Add CAM_NVME_STATUS_ERROR error code. Flag all NVME commands that
completed with an error status as CAM_NVME_STATUS_ERROR (a new value)
instaead of CAM_REQ_CMP_ERR. This indicates to the upper layers of CAM
that the 'cpl' field for nvmeio CCBs is valid and can be examined for
error recovery, if desired.

No functional change. nda will still see these as errors, call
ndaerror() to get the error recovery action, etc. cam_periph_error will
select the same case as before (even w/o the change, though the change
makes it explicit).

Sponsored by:		Netflix
Reviewed by:		chuck, mav, jhb
Differential Revision:	https://reviews.freebsd.org/D41085
2023-07-20 22:32:31 -06:00
Warner Losh 0732617ec1 cam/nda: Remove impossible CAM codes
The NVME SIM does not generate these status values, so remove them.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D41084
2023-07-20 22:32:31 -06:00
Warner Losh 33734ddf2b cam: Be explict about CAM_SMP_STATUS_ERROR
This is normally caught by default:, but no harm in making it explicit
that we'll retry valid periphs.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D41083
2023-07-20 22:32:31 -06:00
Warner Losh 367699ca7a cam/scsi: Better action for ASC/ASCQ 0x18/0x08
0x18/0x8 is another code to indicate that the data was recovered
successfully, so complete the command w/o an error rather than retry the
operation.

Sponsored by:		Netflix
Reviewed by:		mav, jhb
Differential Revision:	https://reviews.freebsd.org/D41082
2023-07-20 22:32:30 -06:00
Warner Losh 38e831a895 cam: Add comment about recovery ccbs
SS_START and higher actions (currently only SS_TUR) allocate a recovery
CCB to send a command to the periph. Add a quick comment about that here.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D41081
2023-07-20 22:32:30 -06:00
Kyle Evans b744861818 libc: locale: flesh out an incomplete comment
Extrapolate from the context what the intention for the rest of the
comment probably was -- that the C/POSIX (and now C.UTF-8) locales may
avoid an allocation and reuse a global table.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41087
2023-07-20 23:27:24 -05:00
Kevin Bowling 95f7b36e8f 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
2023-07-20 20:44:04 -07:00
Kevin Bowling 201c4b7c29 e1000: Some fixes for em(4) TSO setup
Always set TXD_CMD_IP for 82544
Otherwise set TXD_CMD_IP for IPv4, not IPv6

Reviewed by:	markj (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30072
2023-07-20 18:52:53 -07:00
John Baldwin 92053e4f8a share/mk: Pass -znoexecstack to ld.bfd when linking libraries and programs.
lld assumes -znoexecstack by default whereas ld.bfd still defaults to
-zexecstack in the absence of .note.GNU-stack annotations.  Adding the
flags centrally avoids having to patch various libraries in the tree
as one-offs (e.g. OpenSSL 3 is the current thing generating new
warnings with ld.bfd).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41120
2023-07-20 16:37:46 -07:00