Commit Graph

284375 Commits

Author SHA1 Message Date
Jessica Clarke
dfa1982352 etc: Don't create stray directories in NO_ROOT distrib-dirs
The loop above is responsible for creating the actual directories,
whilst this one is just responsible for creating the corresponding
METALOG. Since DESTDIR already includes DISTBASE, this results in
creating a second set of roots (one per MTREES entry) within DISTBASE
whenever DISTBASE is non-empty, such as base/base, base/base/var,
base/base/usr, etc. in the distributeworld case. This is purely cosmetic
though as they won't appear in the METALOG.
2023-06-08 19:14:12 +01:00
Jessica Clarke
2e0d99a953 Makefile.inc1: Fix distributeworld mtree mangling for dist root dir
The trailing slash means that ./base itself doesn't get mangled and
remains as-is in the output, leading to a stray /base in base.txz for
NO_ROOT builds and thus in the installed system. Since this action is
running on a line whose file matches one listed by find (and we're
printing all of these as part of that distribution), we don't need to
care about the possibility of a path like ./basefoo/bar where the path
prefix isn't ./base, and can thus just drop the slash rather than
needing something more complicated like "slash or whitespace or EOL" as
one might first think.
2023-06-08 19:14:12 +01:00
Jessica Clarke
469727c966 Makefile.inc1: Use INSTALL_DDIR for distributeworld's distrib-dirs
INSTALL_DDIR is the canonicalised version of DESTDIR/DISTDIR. Whilst
most of what distrib-dirs does doesn't need the canonicalised form, it
is responsible for installing the POSIX and en_US.US_ASCII NLS symlinks
to C, and therefore needs the canonicalised version for those two uses
of install for NO_ROOT builds, since our install does a naive text-based
prefix strip when creating the METALOG entry rather than a smarter path
semantics-aware one (which itself is really a bug, and has bitten us
many times). As a result, using plain DESTDIR/DISTDIR instead can result
in the METALOG having ./path/to/destdir/base/usr/share/nls/$LOCALE
rather than ./base/usr/share/nls/$LOCALE and then being filtered out
when creating base.meta (or, if you're unlucky and the absolute path
begins with base or tests, weird things will probably happen).

Given this footgun an audit of DESTDIR uses is probably in order,
especially those using DESTDIR/DISTDIR, but this is sufficient for now.
2023-06-08 19:14:12 +01:00
Bjoern A. Zeeb
a30a0d940d LinuxKPI: add dummy rhashtable implementation
Add a skeleton implementation of rhashtable in order to keep an
upcoming wireless driver compiling.  We'll implement it as soon as
we get there.

MFC after:	10 days
Reviewed by:	emaste (previous version before his suggested changes)
Differential Revision: https://reviews.freebsd.org/D40176
2023-06-08 18:11:11 +00:00
Bjoern A. Zeeb
4cbd427788 LinuxKPI: add devm_ioremap()
Given we do not seem to support ioremap() do not support the "devm"
version either and simply return NULL, which means we do not have
to keep track of the memory to be freed on device free later.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D40173
2023-06-08 18:07:28 +00:00
Bjoern A. Zeeb
17bde9cbc6 LinuxKPI: pci: update struct msi_desc
It seems struct msi_desc is setup differently (or was changed) compared
to how we added it a while ago.  Catch up in order to keep drivers
directly accessing fields compiling.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40175
2023-06-08 18:04:35 +00:00
Bjoern A. Zeeb
7d7d12ba77 LinuxKPI: pci: add PCI_COMMAND_MEMORY
Add another PCI alias to our native defines for a wireless driver.

MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40247
2023-06-08 18:02:33 +00:00
Bjoern A. Zeeb
7c0c69d1a0 LinuxKPI: add struct_group(...)
Add a struct_group() macro needed by a wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D40138
2023-06-08 18:00:57 +00:00
Bjoern A. Zeeb
b889315da3 LinuxKPI: add ktime_get_real_ts64()
Add a wrapper for ktime_get_real_ts64() used by a wireless driver.

MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40246
2023-06-08 17:58:32 +00:00
Joseph Mingrone
ee67461e56 tpcdump: Update to 4.99.4
Local changes:

- Update some local modifications to fix build
- Synch config.h with upstream as much as possible

Changelog:      https://git.tcpdump.org/tcpdump/blob/55bc126b0216cfe409b8d6bd378f65679d136ddf:/CHANGES
Reviewed by:    emaste
Obtained from:  https://www.tcpdump.org/release/tcpdump-4.99.4.tar.gz
Sponsored by:   The FreeBSD Foundation
2023-06-08 14:30:54 -03:00
Ed Maste
f40cd16bfd kern: Move devctl_systems[] out of sys/sys/devctl.h
The amd64-gcc12 build was failing with `error: 'devctl_systems' defined
but not used`.  Just move it to the C file where it's used.

PR:		271903
Sponsored by:	The FreeBSD Foundation
2023-06-08 12:28:04 -04:00
Andrew Turner
d057b7aac8 arm64: Malloc the cpu_desc array
We only need this during boot. Allocate the array before starting CPUs
to reduce the memory usage.

Reviewed by:	Zach Leaf <zachary.leaf@arm.com>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40433
2023-06-08 17:10:10 +01:00
Andrew Turner
732786a25f arm64: Reduce the direct use of cpu_desc
To help moving to a dynamically allocated cpu_desc array reduce the
places we use it directly and create a pointer that is passed in to
functions that read it.

Reviewed by:	Zach Leaf <zachary.leaf@arm.com>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40392
2023-06-08 17:10:10 +01:00
Ed Maste
b17b639832 contrib/spleen: update to Spleen 2.0.0
Merge commit '533de2d7a9875ff652be477a3f6c817d66a3d3d9'

Submitted by:	Frederic Cambus
Differential Revision:	https://reviews.freebsd.org/D40378
2023-06-08 10:42:25 -04:00
Peter Holm
6b7a06c3bd stress2: Avoid using "__unused" 2023-06-08 09:49:52 +02:00
Colin Percival
267411d164 EC2: Chase awscli package rename
MFC after:	1 week
2023-06-07 21:23:26 -07:00
Joseph Mingrone
1cdec2832d
ndp: Prepare for pending tcpdump update
ndp makes use of gmt2local, however that library has been removed from
tcpdump.  Add utc_offset() as a substitute.

Reviewed by:	emaste, jhb, melifaro
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40445
2023-06-07 22:57:20 -03:00
Xin LI
1232c7884d od(1): Fix skip value handling
POSIX defines -j as the number of bytes that od(1) should skip over the
concatenated input files. The existing code tries to implement this behavior
by checking if the current address was smaller than the skip value. However,
this is not correct, because we adjust both the skip value and the address
at the same time when we do fseeko (when file is seekable) or getchar (when
file is not seekable).

This commit fixes the problem by expecting the skip value to be zero upon
return of next(). If the condition is not satisfied, a diagnostic message
will be issued.

Reported-by:	Mohamed Akram <mohd.akram@outlook.com>
Reviewed-by:	emaste
PR:		271832
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40446
2023-06-07 18:06:07 -07:00
John Baldwin
653738e895 ptrace: Clear TDB_BORN during PT_DETACH.
If a debugger detaches from a process that has a new thread that has
not yet executed, the new thread will raise a SIGTRAP signal to report
it's thread birth event even after the detach.  With the debugger
detached, this results in a SIGTRAP sent to the process and typically
a core dump.  Fix this by clearing TDB_BORN from any new threads
during detach.

Bump __FreeBSD_version for debuggers to notice when the fix is
present.

Reported by:	GDB's testsuite
Reviewed by:	kib, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D39856
2023-06-07 12:28:36 -07:00
Rich Ercolani
6c96269024
Revert "systemd: Use non-absolute paths in Exec* lines"
This reverts commit 79b20949b2 since it
doesn't work with the systemd version shipped with RHEL7-based systems.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #14943
Closes #14945
2023-06-07 11:14:05 -07:00
John Baldwin
aee3611fec pmcstat: Tweak typo fix.
Reviewed by:	imp
2023-06-07 11:03:02 -07:00
Brian Behlendorf
93f8abeff0
Linux: Never sleep in kmem_cache_alloc(..., KM_NOSLEEP) (#14926)
When a kmem cache is exhausted and needs to be expanded a new
slab is allocated.  KM_SLEEP callers can block and wait for the
allocation, but KM_NOSLEEP callers were incorrectly allowed to
block as well.

Resolve this by attempting an emergency allocation as a best
effort.  This may fail but that's fine since any KM_NOSLEEP
consumer is required to handle an allocation failure.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Adam Moss <c@yotes.com>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
2023-06-07 10:43:43 -07:00
Jessica Clarke
21f7397a61 libpmc: Handle PMCALLOCATE log with PMC code on PMU event system
On an arm64 system that reports as a Cortex A72 r0p3, running

  pmcstat -P CPU_CYCLES command

works, but

  pmcstat -P cpu-cycles command

does not. This is because the former uses the PMU event from the JSON
source, resulting in pl_event in the log event being a small index
(here, 5) into the generated events table, whilst the latter does not
match any of the JSON events and falls back on PMC's own tables, mapping
it to the PMC event 0x14111, i.e. PMC_EV_ARMV8_EVENT_11H. Then, when
libpmc gets the PMCALLOCATE event, it tries to use the event as an index
into the JSON-derived table, but doing so only makes sense for the
former, whilst for the latter it will go way out of bounds and either
read junk (which may trigger the != NULL assertion) or segfault. As far
as I can tell we don't have anything lying around to tell us which of
the two cases we're in, but we can exploit the fact that the first
0x1000 PMC event codes are reserved, and that none of our PMU events
tables reach that number of entries yet.

PR:		268857
Reviewed by:	mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D39592
2023-06-07 15:24:29 +01:00
Jessica Clarke
296a0987be pmcstat: Update manpage date
Fixes:	53d0b9e438 ("pmc: Provide full path to modules from kernel linker")
2023-06-07 15:24:29 +01:00
Jessica Clarke
7a706aad83 hwpmc: Update manpage date
Fixes:	8e63e787ab ("pmc: Initialise and check the pm_flags field for CONFIGURELOG")
2023-06-07 15:24:29 +01:00
Andrey V. Elsukov
1f16650989 ipmi: add Block Transfer interface support
Reviewed by:	ambrisko
Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D40421
2023-06-07 12:30:47 +03:00
Wei Hu
4f8c634de0 arm64 Hyper-V: enable Hyper-V SMP for ARM64
Vmbus_synic_setup() is invoked via vmbus_intrhook -> vmbus_doattach
-> smp_rendezvous. On !EARLY_AP_STARTUP (e.g., aarch64), SMP isn't
functional in intrhooks and smp_rendezvous() will just call
vmbus_synic_setup() on the boot processor. There's nothing that will
initialize the pcpu data on every other AP.

To fix it we need to use SI_SUB_SMP for vmbus_doattach(). With this
patch the vmbus interrupt should work on all arm64 cpus on HyperV.

Reported by:	kevans
Reviewed by:	kevans, whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Obtained from:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D40279
2023-06-07 08:24:13 +00:00
Xin LI
1177a6c8dc gve: Unobfuscate code by using nitems directly for loop.
While there, also make MODULE_PNP_INFO to reflect that the device
description is provided.

Reported-by:	jrtc27
Reviewed-by:	jrtc27, imp
Differential Revision: https://reviews.freebsd.org/D40430
2023-06-06 21:14:30 -07:00
Jamie Gritton
e82a629435 jail: add ".include" directive to jail.conf
Jail config files can now include literal filenames and file globs.
They can not (yet) include files based on variables/parameters.
2023-06-06 17:19:12 -07:00
Richard Scheffenegger
eb5bfdd065 tcp: Add and update cubic module variable names
Prepare the cubic congestion control module to better align with
the specifications in RFC8312bis.

Rename a few cubic state variables to the variable names found in
the RFC8312bis specification. This makes the code more understandable
for someone reading the RFC and the code. It also makes the variable
naming convention more uniform. Add some variables needed subsequently.

No functional change.

Submitted By:		Bhaskar Pardeshi, VMware Inc.
Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D40436
2023-06-06 23:09:28 +02:00
Richard Scheffenegger
43b117f88f tcp: make the maximum number of retransmissions tunable per VNET
Both Windows (TcpMaxDataRetransmissions) and Linux (tcp_retries2)
allow to restrict the maximum number of consecutive timer based
retransmissions. Add that same capability on a per-VNet basis to
FreeBSD.

Reviewed By:		cc, tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D40424
2023-06-06 22:58:54 +02:00
Dmitry Chagin
84617f6fcc linux(4) rt_sendsig: Remove the use of caddr_t
Replace caddr_t by more appropriate char *.

MFC after:		2 weeks
2023-06-06 23:01:39 +03:00
George Amanakis
bcd5321039
Fix the L2ARC write size calculating logic
l2arc_write_size() should return the write size after adjusting for trim
and overhead of the L2ARC log blocks. Also take into account the
allocated size of log blocks when deciding when to stop writing buffers
to L2ARC.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #14939
2023-06-06 12:32:37 -07:00
Cy Schubert
82aa1470c9 ntp: Fix build
Two files used to obtain time from reference clocks did not include
ntp_types.h resulting in an undefined NONEMPTY_TRANSLATION_UNIT.

Fixes:		e6bfd18d21
MFC after:	3 days
X-MFC-with:	e6bfd18d21
2023-06-06 06:27:05 -07:00
Cy Schubert
e6bfd18d21 ntp: import ntp-4.2.8p17
Fixes two small bugs including one regression.

MFC after:	3 days

Merge commit 'ab1f1aa8333369a83ff284848fc3fc2e52d5f29f'
2023-06-06 05:44:51 -07:00
Cy Schubert
ab1f1aa833 ntp: import ntp-4.2.8p17 2023-06-06 05:26:44 -07:00
Andrew Turner
62f9bcf2b4 Switch to contigmalloc in the Hyper-V code
In the Hyper-V drivers we need to allocate buffers shared between the
host and guest. This memory has been allocated with bus_dma, however
it doesn't use this correctly, e.g. it is missing calls to
bus_dmamap_sync. Along with this on arm64 we need this memory to be
mapped with the correct memory type that bus_dma may not use.

Switch to contigmalloc to allocate this memory as this will correctly
allocate cacheable memory.

Reviewed by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40227
2023-06-06 10:50:59 +01:00
Kristof Provost
657aec455f pf tests: test reassembly in the slow path
Ensure that 'fragment reassemble' works as expected, even in the IP
stack's slow forwarding path. (So not via ip_tryforward())

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40396
2023-06-06 10:03:50 +02:00
Kristof Provost
185c1cddd7 netinet: re-read IP length after PFIL hook
The pfil hook may modify the packet, so before we check its length (to
decide if it needs to be fragmented or not) we should re-read that
length.

This is most likely to happen when pf is reassembling packets. In that
scenario we'd receive the last fragment, which is likely to be a short
packet, pf would reassemble it (likely exceeding the interface MTU) and
then we'd transmit it without fragmenting, because we're comparing the
MTU to the length of the last fragment, not the fully reassembled
packet.

See also:	https://redmine.pfsense.org/issues/14396
Reviewed by:	cy
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40395
2023-06-06 10:01:03 +02:00
Kristof Provost
a9bfd080d0 if_epair: do not transmit packets that exceed the interface MTU
While if_epair has no issues doing this we should drop those packets
anyway, because it improves the fidelity of the automated tests.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40397
2023-06-06 10:00:48 +02:00
Xin LI
1bbdfb0b43 gve: Add PNP info to PCI attachment of gve(4) driver.
Reviewed-by:		imp
Differential Revision:	https://reviews.freebsd.org/D40429
2023-06-05 21:05:55 -07:00
Rob Norris
8653f1de48 zdb: add -B option to generate backup stream
This is more-or-less like `zfs send`, but specifying the snapshot by its
objset id for situations where it can't be referenced any other way.

Sponsored-By: Klara, Inc.
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: WHR <msl0000023508@gmail.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #14642
2023-06-05 11:54:42 -07:00
Rob Norris
2b9f8ba673 znode: expose zfs_get_zplprop to libzpool
There's no particular reason this function should be kernel-only, and I
want to use it (indirectly) from zdb. I've moved it to zfs_znode.c
because libzpool does not compile in zfs_vfsops.c, and this at least
matches the header its imported from.

Sponsored-By: Klara, Inc.
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: WHR <msl0000023508@gmail.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #14642
2023-06-05 11:53:44 -07:00
Alexander Motin
5ba4025a8d
Introduce zfs_refcount_(add|remove)_few().
There are two places where we need to add/remove several references
with semantics of zfs_refcount_(add|remove). But when debug/tracing
is disabled, it is a crime to run multiple atomic_inc() in a loop,
especially under congested pool-wide allocator lock.

Introduced new functions implement the same semantics as the loop,
but without overhead in production builds.

Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #14934
2023-06-05 11:51:44 -07:00
Brian Behlendorf
dae3c549f5
Linux 6.3 compat: META (#14930)
Update the META file to reflect compatibility with the 6.3 kernel.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
2023-06-05 11:08:24 -07:00
Michael Tuexen
d66540e829 tcp: improve sending of TTL/hoplimit and DSCP
Ensure that a user specified value of TTL/hoplimit and DSCP is
used when sending packets.

Reviewed by:		cc, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D40423
2023-06-05 18:43:06 +02:00
Konstantin Belousov
91880e07f6 rtld: do not allow both dynamic DTV index and static TLS offset
If we are allocating static offset for an object with dynamic index,
return failure.  In the opposite case, if dynamic index is requested for
statically allocated TLS area, directly use the offset instead of
setting the index.

Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c
rev. 1.18.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-06-05 22:33:18 +03:00
Konstantin Belousov
283a4f4097 rtld: rename tls_done to tls_static
The meaning of the flag is that static TLS allocation was done.

Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c
rev. 1.18.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-06-05 22:33:17 +03:00
Konstantin Belousov
a7bca69492 rtld_tls.h: style
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-06-05 22:33:17 +03:00
Dag-Erling Smørgrav
fbc445addf xargs: Consistently use strtonum() to parse arguments.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40425
2023-06-05 20:50:54 +02:00