Commit Graph

284124 Commits

Author SHA1 Message Date
Alexandre Snarskii
0ec220df52 tap(4): allow full-duplex and non-zero speed
tap(4) devices advertise themselves as just 'ethernet autoselect',
without duplex or speed capabilities.
This advertisement makes them unable to be aggregated into lacp-based
lagg(4):
- lacp code requires underlying interfaces to be full-duplex, else
  interface will not participate in lacp at all
- lacp code requires underlying interface to have non-zero speed, else
  this interface can not be selected as active aggregator

PR: 217374
Reported-by: Alexandre Snarskii <snar@snar.spb.ru>
Co-authored-by: Mina Galić <freebsd@igalic.co>
Reviewed-by: imp,karles
Pull-request: https://github.com/freebsd/freebsd-src/pull/745
2023-05-31 09:53:48 -06:00
Andrew Turner
ae16cbfdd2 gicv3: Use an offset to find the redist registers
To find the redistributor registers use the resource we have already
found and add an offset. This removed the need to create a
per-redistributor resource as it can now be a pointer to the resource
found in attach.

While here check the offset is within the bounds of the resource. Some
ACPI tables list each redistributor as a separate memory range, even
if they are physically contiguous. In this case we may not have each
resource virtually contiguous with neighbouring resources. This can
lead to a data abort when reading past the resource range.

Reviewed by:	kevans
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40263
2023-05-31 15:10:41 +01:00
Pierre Pronchery
aa4cf5647c libunbound: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update may migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-05-31 10:05:07 -04:00
Alexander V. Chernikov
4e9a97de01 netlink: fix ifconfig P2P inet ADDR ADDR netmask 255.255.255.255 addition
Adding P2P addresses is complex in both ioctl and Netlink.
In the ioctl interface, "broadcast" field is the same field as the
"peer". In is possible to specify non-p2p address for the p2p
 interface in IPv6, but not in IPv4.
In the Netlink interface, "address" field means "peer" address.
As a result, a common notion for the Netlink users is to submit
 same address/peer for non-P2P interfaces.

This change customises mapping the attribute on per-family basis.
Specifically,
for IPv4 - if the interface is P2P, assume "address" is p2p and
 "local" is the address. If the interfase is non-p2p, use "local"
 attribute as the address. If it's not set, use "address" attribute.
for IPv6 - start with "local" attribute as the address. If it's not set,
 use use "address" attribute. If both are set and both are the same,
 assume non p2p, otherwise add as p2p.

MFC after:	2 weeks
Reported by:	jkim
2023-05-31 10:38:38 +00:00
Doug Rabson
5ab151574c netinet*: Fix redirects for connections from localhost
Redirect rules use PFIL_IN and PFIL_OUT events to allow packet filter
rules to change the destination address and port for a connection.
Typically, the rule triggers on an input event when a packet is received
by a router and the destination address and/or port is changed to
implement the redirect. When a reply packet on this connection is output
to the network, the rule triggers again, reversing the modification.

When the connection is initiated on the same host as the packet filter,
it is initially output via lo0 which queues it for input processing.
This causes an input event on the lo0 interface, allowing redirect
processing to rewrite the destination and create state for the
connection. However, when the reply is received, no corresponding output
event is generated; instead, the packet is delivered to the higher level
protocol (e.g. tcp or udp) without reversing the redirect, the reply is
not matched to the connection and the packet is dropped (for tcp, a
connection reset is also sent).

This commit fixes the problem by adding a second packet filter call in
the input path. The second call happens right before the handoff to
higher level processing and provides the missing output event to allow
the redirect's reply processing to perform its rewrite. This extra
processing is disabled by default and can be enabled using pfilctl:

	pfilctl link -o pf:default-out inet-local
	pfilctl link -o pf:default-out6 inet6-local

PR:		268717
Reviewed-by:	kp, melifaro
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40256
2023-05-31 11:11:05 +01:00
Ed Maste
dc10368634 unbound: avoid calling deprecated OpenSSL function
SSL_CTX_set_ecdh_auto is deprecated and has no effect (for reference see
2ecb9f2d18).

As unbound's config.h is manually maintained just turn off
HAVE_DECL_SSL_CTX_SET_ECDH_AUTO so that the deprecated function won't
be called.

Reviewed by:	ngie
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40341
2023-05-30 19:55:55 -04:00
Jessica Clarke
d6f00fa046 pmc: Bump major version for just-committed breaking changes
Reviewed by:	jkoshy, mhorne, emaste
Differential Revision:	https://reviews.freebsd.org/D40050
2023-05-31 00:23:36 +01:00
Jessica Clarke
94426d21bf pmc: Rework PROCEXEC event to support PIEs
Currently the PROCEXEC event only reports a single address, entryaddr,
which is the entry point of the interpreter in the typical dynamic case,
and used solely to calculate the base address of the interpreter. For
PDEs this is fine, since the base address is known from the program
headers, but for PIEs the base address varies at run time based on where
the kernel chooses to load it, and so pmcstat has no way of knowing the
real address ranges for the executable. This was less of an issue in the
past since PIEs were rare, but now they're on by default on 64-bit
architectures it's more of a problem.

To solve this, pass through what was picked for et_dyn_addr by the
kernel, and use that as the offset for the executable's start address
just as is done for everything in the kernel. Since we're changing this
interface, sanitise the way we determine the interpreter's base address
by passing it through directly rather than indirectly via the entry
point and having to subtract off whatever the ELF header's e_entry is
(and anything that wants the entry point in future can still add that
back on as needed; this merely changes the interface to directly provide
the underlying variables involved).

This will be followed up by a bump to the pmc major version.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D39595
2023-05-31 00:20:36 +01:00
Jessica Clarke
659a0041dd imgact: Make et_dyn_addr part of image_params
This already gets passed around between various imgact_elf functions, so
moving it removes an argument from all those places. A future commit
will make use of this for hwpmc, though, to provide the load base for
PIEs, which currently isn't available to tools like pmcstat.

Reviewed by:	kib, markj, jhb
Differential Revision:	https://reviews.freebsd.org/D39594
2023-05-31 00:15:43 +01:00
Jessica Clarke
53d0b9e438 pmc: Provide full path to modules from kernel linker
This unifies the user object and kernel module paths in libpmcstat,
allows modules loaded from non-standard locations (e.g. from a user's
home directory when testing) to be found and, since buffer is what all
the warnings here use (they were never updated when buffer_modules were
added to pick based on where the file was found) has the side-effect of
ensuring the messages are correct.

This includes obsoleting the now-superfluous -k option in pmcstat.

This change breaks the hwpmc ABI and will be followed by a bump to the
pmc major version.

Reviewed by:	jhb, jkoshy, mhorne
Differential Revision:	https://reviews.freebsd.org/D40048
2023-05-31 00:15:34 +01:00
Jessica Clarke
8e63e787ab pmc: Initialise and check the pm_flags field for CONFIGURELOG
Whilst the former is not breaking, the latter is, and so this will be
followed by a bump to the pmc major version. This will allow the flags
to actually be usable in future, as otherwise we cannot distinguish
uninitialised stack junk from a deliberately-initialised value.

Reviewed by:	jhb, mhorne
Differential Revision:	https://reviews.freebsd.org/D40049
2023-05-31 00:15:24 +01:00
Graham Perrin
2071e54c22 hier(7): alphabetical order
Approved by:  mhorne
Pull request: https://github.com/freebsd/freebsd-src/pull/756
2023-05-30 20:34:18 +01:00
Mark Johnston
a306ed50ec inpcb: Restore missing validation of local addresses for jailed sockets
When looking up a listening socket, the SMR-protected lookup routine may
return a jailed socket with no local address.  This happens when using
classic jails with more than one IP address; in a single-IP classic
jail, a bound socket's local address is always rewritten to be that of
the jail.

After commit 7b92493ab1, the lookup path failed to check whether the
jail corresponding to a matched wildcard socket actually owns the
address, and would return the match regardless.  Restore the omitted
checks.

Fixes:		7b92493ab1 ("inpcb: Avoid inp_cred dereferences in SMR-protected lookup")
Reported by:	peter
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D40268
2023-05-30 15:15:48 -04:00
Mark Johnston
4e78addbef buf: Make the number of pbufs slightly more dynamic
Various subsystems pre-allocate a set of pbufs, allocated to implement
I/O operations.  pbuf allocations are transient, unlike most buf
allocations.

Most subsystems preallocate nswbuf or nswbuf/2 pbufs each.  The
preallocation ensures that pbuf allocation will succeed in low memory
conditions, which might help avoid deadlocks.  Currently we initialize
nswbuf = min(nbuf / 4, 256).

nbuf/4 > 256 on anything but the smallest systems.  For example,
nswbuf is 256 in a VM with 128MB of memory.  In this configuration, a
firecracker VM with one CPU preallocates over 900 pbufs.  This consumes
2MB of RAM and adds several milliseconds to the kernel's (very small)
boot time.

Scale nswbuf by ncpu in the common case.  I think this makes more sense
than scaling by the amount of RAM, since pbuf allocations are transient
and aren't used for caching.  With the change, we get nswbuf=256 with 8
CPUs.  With fewer than 8 CPUs we'll preallocate fewer pbufs than before,
and with more we'll preallocate more.

Event:		BSDCan 2023
Reported by:	cperciva
Reviewed by:	glebius, kib
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D40216
2023-05-30 15:11:32 -04:00
Cheng Cui
7a52b570e7
siftr: bring back the siftr_pkts_per_log feature
Summary: this missing feature is introduced by commit aa61cff424

Test Plan: verified in Emulab.net

Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40336
2023-05-30 08:23:36 -04:00
Jung-uk Kim
84ffbd7782 OpenSSL: Merge OpenSSL 1.1.1u 2023-05-30 11:14:28 -04:00
Christos Margiolis
7a8cf053d1 dtrace: deduplicate some RISC-V functions
match_opcode() is defined in FBT, kinst, and dtrace_subr.c. The function
prologue-checking functions are defined in FBT and kinst.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40335
2023-05-30 18:07:18 +03:00
Jung-uk Kim
5b1268252c OpenSSL: Regen manual pages for OpenSSL 1.1.1u 2023-05-30 11:03:10 -04:00
Jung-uk Kim
8f1ef87a6b OpenSSL: Merge OpenSSL 1.1.1u
(cherry picked from commit 8ecb489345f08012fdc92a202a40119891cac330)
2023-05-30 10:40:04 -04:00
Mateusz Guzik
60bd7f97b6 vfs cache: restore sorted order of CACHE_FPL_SUPPORTED_CN_FLAGS 2023-05-30 13:19:53 +00:00
Ed Maste
df042dcf26 Cirrus-CI: add amd64 and arm64 Clang/LLVM 16 jobs
Reviewed by:	lwhsu (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40286
2023-05-30 09:17:15 -04:00
Ed Maste
98c5211847 Cirrus-CI: move arch and toolchain to beginning of task names
This is the key difference between the tasks, so make it the most
prominent.

Sponsored by:	The FreeBSD Foundation
2023-05-30 09:17:09 -04:00
Mateusz Guzik
6217c2473d amd64: zero-pad register dumps on panic
de gustibus and so on

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-30 13:15:56 +00:00
Jan Schaumann
ac17fc816e split(1): add '-c' to continue creating files
Currently, split(1) will clobber any existing output files:

$ split file; ls
xaa xab xac xad
$ split second-file; ls
xaa xab xac xad xae xaf

This patch adds a flag "-c" (mnemonic "create, don't overwrite" or
"continue where you left off"):

$ split file; ls
xaa xab xac xad
$ split -c second-file; ls
xaa xab xac xad xae xaf xag xah xai xaj

Reviewed by:	christos
Approved by:	kevans
Different Revision:	https://reviews.freebsd.org/D38553
2023-05-30 16:13:16 +03:00
Jan Schaumann
c4f7198f47 split(1): auto-extend suffix length if required
If the input cannot be split into the number of files resulting from the
default suffix length, automatically extend the suffix length rather
than bailing out with 'too many files'.

Suffixes are extended such that the resulting files continue to sort
lexically and "cat *" would reproduce the input. For example, splitting
a 1M lines file into (default) 1000 lines per file would yield files
named 'xaa', 'xab', ..., 'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'.

If '-a' is specified, the suffix length is not auto-extended.

This behavior matches GNU sort(1) since around version 8.16.

Reviewed by:	christos
Approved by:	kevans
Different Revision:	https://reviews.freebsd.org/D38279
2023-05-30 15:55:38 +03:00
Kajetan Staszkiewicz
c45d6b0ec0 pfctl: Add missing state parameters in DIOCGETSTATESV2
Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Different Revision:	https://reviews.freebsd.org/D40259
2023-05-30 14:28:57 +02:00
Kajetan Staszkiewicz
4bf98559d9 pf: make contents of struct pfsync_state configurable
Make struct pfsync_state contents configurable by sending out new
versions of the structure in separate subheader actions. Both old and
new version of struct pfsync_state can be understood, so replication of
states from a system running an older kernel is possible. The version
being sent out is configured using ifconfig pfsync0 … version XXXX. The
version is an user-friendly string - 1301 stands for FreeBSD 13.1 (I
have checked synchronization against a host running 13.1), 1400 stands
for 14.0.

A host running an older kernel will just ignore the messages and count
them as "packets discarded for bad action".

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39392
2023-05-30 14:28:56 +02:00
Baptiste Daroussin
153145efcd src.conf.5: regen after readd of NETLINK option 2023-05-30 13:36:43 +02:00
Baptiste Daroussin
cb1fc924d2 genl: add new command to list genetlink(4)
This commands list genetlink protocols and its operations and
capabilities

Name: nlctrl
	ID: 0x10, Version: 00, header size: 2, max attributes: 10
	supported operations:
	 - ID: 0x3, Capabilities: 0xe (can modify; can get/dump;
has policy)
	multicast groups:
	 - ID: 0x30, Name: notify
Name: carp
	ID: 0x11, Version: 00, header size: 2, max attributes: 2
	supported operations:
	 - ID: 0x1, Capabilities: 0xe (can modify; can get/dump;
has policy)
	 - ID: 0x2, Capabilities: 0xb (requires admin permission;
can modify; has policy)

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D40330
2023-05-30 13:36:43 +02:00
Cheng Cui
b71f278465
siftr: convert this tval.tv_sec to type intmax_t to print across platforms
Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40323
2023-05-30 02:27:33 -04:00
Konstantin Belousov
1fc174cba6 open(2): fix typo
__aLC_aclcheck_fd -> acl_aclcheck_fd

Reported by:	Peter Eriksson  <pen@lysator.liu.se>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-05-30 12:18:25 +03:00
Dmitry Chagin
4f2c2a122c avx_sig: Adapt avx_sig test for Aarch64
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40309
2023-05-30 11:19:40 +03:00
Dmitry Chagin
68348f41c9 avx_sig: Prepare to add arm64 neon test
Move inlined asm code to a separate source and rename x86 specific xmm
names to more general simd names.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40312
2023-05-30 11:18:57 +03:00
Konstantin Belousov
7a292504ba __acl_get_fd(2), __acl_aclcheck_fd(2): enable for O_PATH filedescriptors
PR:	271704
Reported by:	Peter Eriksson  <pen@lysator.liu.se>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40318
2023-05-30 08:53:56 +03:00
Chuck Silvers
d464a7698d ffs: restore backward compatibility of newfs and makefs with older binaries
The previous change to CGSIZE had the unintended side-effect of allowing
newfs and makefs to create file systems that would fail validation when
examined by older commands and kernels, by allowing newfs/makefs to pack
slightly more blocks into a CG than those older binaries think is valid.
Fix this by having newfs/makefs artificially restrict the number of blocks
in a CG to the slightly smaller value that those older binaries will accept.
The validation code will continue to accept the slightly larger value
that the current newfs/makefs (before this change) could create.

Fixes:		0a6e34e950
Reviewed by:	mckusick
MFC after:	3 days
Sponsored by:	Netflix
2023-05-29 19:26:28 -07:00
Konstantin Belousov
8164032a49 reapkill: handle possible pid reuse after the pid was recorded as signalled
Nothing prevents the signalled process from exiting, and then other
process among eligible for signalling to reuse the exited process pid.
In this case, presence of the pid in the 'pids' unr set prevents it from
getting the deserved signal.

Handle it by marking each process with the new flag P2_REAPKILLED when
we are about to send the signal.  If the process pid is present in the
pids unr, but the struct proc is not marked with P2_REAPKILLED, we must
send signal to the pid again.

The use of the flag relies on the global sapblk preventing parallel
reapkills.

The pids unr must be used to clear the flags to all signalled processes.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
ea95173dbb unr(9): document iterators
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
12db3c914f unr(9) iterator: add naive test
To use, compile userspace code e.g. into the subr_unit binary, then do
	$ while ./subr_unit -iv >|/tmp/subr_unit.log ; do :; done
The loop should be left run for as long as possible.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
c4cc0cab1e unr(9): add 'show unrhdr_iter' command
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
a014e0a398 unr(9): add iterator interface
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
f386b27736 unr(9): add 'show unrhdr' ddb command
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
f8c3708085 unr(9): document clean_unrhdr()
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:36 +03:00
Konstantin Belousov
d44f477038 subr_unit.c: explain first/last special ranges
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:35 +03:00
Konstantin Belousov
36b1f8a81e kern/subr_unit.c: more uses for is_bitmap()
To facilitate it, move the is_bitmap() definition earlier.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:35 +03:00
Konstantin Belousov
042ec55f9d kern/subr_unit.c: some style
Use NBBY instead of spelling '8' literally.
Put space into the type specifier.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40089
2023-05-30 01:10:35 +03:00
Konstantin Belousov
cf85818e05 setkey(8): document NAT-T and NAT-T MTU extensions syntax
Reviewed by:	ae
Discussed with:	bz
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40300
2023-05-30 01:10:02 +03:00
Konstantin Belousov
2fa1b8617f setkey(8): NAT-T manual configuration support
This is needed for testing of offload capabilities.

Reviewed by:	ae
Discussed with:	bz
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40300
2023-05-30 01:10:02 +03:00
Konstantin Belousov
2c1296a3c5 setkey(8): extract prefixlen calculation info helper
While there, hide AF_INET case under #ifdef INET.

Reviewed by:	ae
Discussed with:	bz
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40300
2023-05-30 01:10:02 +03:00
Kirk McKusick
6a71277c30 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
When loading the root directory ensure that it is a directory
and has a size greater than the minimum directory size. If an
invalid root directory is found, fall back to full fsck.

Reported-by:  Robert Morris
PR:           271414
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-29 14:58:20 -07:00
Kirk McKusick
5267120645 Cleanups to fsck_ffs(8).
When checking an inode ensure that it does not have a negative size.
Stop scaning a directory when an unallocated block is found.
Fully clear an inode when it is first allocated.
Ensure that an inode is marked dirty whenever it is updated and that
it has a correct check hash when it is released.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-29 14:55:54 -07:00