Commit Graph

285592 Commits

Author SHA1 Message Date
Xin LI
f80a33ea41 MFV: less v643.
MFC after:	2 weeks
2023-08-13 00:13:31 -07:00
Xin LI
448d114b25 Vendor import of less v643. 2023-08-13 00:06:29 -07:00
Kyle Evans
09078445fb vis(3): need <stdint.h> for SIZE_MAX 2023-08-13 00:28:12 -05:00
Kyle Evans
ea46e63863 Merge commit 'acb089b983171667467adc66f56a723b609ed22e' into kbsd/vis
Highlights:
- Some style fixes
- Bumped mbbuf in istrsenvisx() to MB_LEN_MAX to avoid VLAs
- mbslength cannot go negative, so make it unsigned
- Further bounds checking & fix an additional overrun, with dlen == 0
- Avoid duplicate call to wcslen(start)
2023-08-13 00:23:02 -05:00
Kyle Evans
acb089b983 Vendor import of NetBSD's (un)vis(3) at 2023-08-13 2023-08-13 00:16:33 -05:00
Konstantin Belousov
93626d5437 tc_fill_vdso_timehands32(): fix
On 64bit, there is a 4-byte hole in struct vdso_timekeep32 after
tk_current, if the structure is not packed.  This is due to the MD
th_x86_pvc_last_systime being 64bit.

Change amd64 VDSO_TIMEHANDS_MD32 to not use uint64_t, replace it with
pair of uint32_t, as it is done for all other members.

PR:	273085
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-08-13 01:34:08 +03:00
Konstantin Belousov
41acfee690 libc vdso time functions: correctly convert errors into errnos
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-08-13 01:34:08 +03:00
Kirk McKusick
220427da0e Set UFS/FFS file type to snapshot before changing its block pointers.
A UFS/FFS snapshot file is identified with the SF_SNAPSHOT
flag to identify it as a snapshot. This flag needs to be
set before setting some of its block pointers to the special
values BLK_SNAP and BLK_NOCOPY. If the snapshot creation fails
and we call VOP_REMOVE(), the SF_SNAPSHOT flag will let the
remove routine know that the special block pointer values need
to be rolled back before attempting deletion of the file.

Also ensure that an fsck is required after setting superblock
values in the ffs_checkcgintegrity() routine.

Reported-by:  Peter Holm
Tested-by:    Peter Holm
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-08-12 11:20:40 -07:00
Kevin Bowling
b1a39c31a3 vlan: Respect IFCAP_LRO mask
vlan_capabilities(), used by the IFCAP ioctl, was not respecting the
IFCAP_LRO bit if it was masked by the requestor.

This prevented if_bridge(4) from automasking LRO with a message like:
bridge0: can't disable some capabilities on em3.11: 0x400

This also prevented manually disabling LRO from any vlan interface.

PR:		254596
Reported by:	Paul Vixie <paul@redbarn.org>
MFC after:	1 week
2023-08-12 09:39:23 -07:00
Kristof Provost
fb69ed397e Revert "if_vlan: do not enable LRO for bridge interaces"
This reverts commit 5f11a33cee.

As requested by Kevin Bowling. He explains:

> The subtle bug was that vlan_capabilities() in if_vlan was not obeying
> the requested mask from its IFCAP ioctl.
2023-08-12 15:56:21 +02:00
Shailend Chand
543cf924bc gve: Simplify tx loop over buffer ring
Reviewed by:	markj
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D41281
2023-08-12 01:01:53 -07:00
Alan Cox
37e5d49e1e vm: Fix address hints of 0 with MAP_32BIT
Also, rename min_addr to default_addr, which better reflects what it
represents.  The min_addr is not a minimum address in the same way that
max_addr is actually a maximum address that can be allocated.  For
example, a non-zero hint can be less than min_addr and be allocated.

Reported by:	dchagin
Reviewed by:	dchagin, kib, markj
Fixes:	d8e6f4946c "vm: Fix anonymous memory clustering under ASLR"
Differential Revision:	https://reviews.freebsd.org/D41397
2023-08-12 02:35:21 -05:00
Konstantin Belousov
9b65fa6940 linuxolator: implement Linux' PROT_GROWSDOWN
From the Linux man page for mprotect(2):
   PROT_GROWSDOWN
       Apply  the  protection  mode  down to the beginning of a mapping
       that grows downward (which should be a stack segment or a
       segment mapped with the MAP_GROWSDOWN flag set).

Reported by:	dchagin
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:14 +03:00
Konstantin Belousov
90049eabcf vm_map_protect(): add VM_MAP_PROTECT_GROWSDOWN flag
which requests to propagate lowest stack segment protection to the grow gap.
This seems to be required for Linux emulation.

Reported by:	dchagin
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:14 +03:00
Konstantin Belousov
b6037edbd1 vm_map_growstack(): restore stack gap data if gap entry was removed
and then restored.

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
9d7ea6cff7 vm_map: do not allow to merge stack gap entries
At least, offset handling is wrong for them.

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
55be6be12c vm_map_protect(): handle stack protection stored in the stack guard
mprotect(2) on the stack region needs to adjust guard stored protection,
so that e.g. enable executing on stack worked properly on stack growth.

Reported by:	dchagin
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
79169929f0 vm_map_protect(): move guard handling at the last phase into an empty dedicated helper
Restructure the first phase slightly, to facilitate further changes.

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
aa928a5216 vm_map_growstack(): handle max protection for stacks
Do not assume that protection is same as max_protection.  Store both in
offset, packed in the same way as the prot syscall parameter.

Reviewed by:	alc, markj (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
0fb6aae7f0 vm_map.c: add CONTAINS_BITS macro
Suggested by:	dougm
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
ba41b0de3e Add vm_map_insert1(9)
The function returns the newly created entry.
Use vm_map_insert1() in stack grow code to avoid gap entry re-lookup.

The comment update for vm_map_try_merge_entries() was suggested by dougm.

Suggested by:	alc
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Konstantin Belousov
3b44ee50be vm_map_insert(): update herald comment
Only a part of the object may be mapped.

Noted by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D41099
2023-08-12 09:28:13 +03:00
Warner Losh
efbfa74caf rpi: Simplify dtb file tests
Now that we no longer support armv[45] devices, these tests can be
simplified. While here, update the comment to reflect which rpi devices
we support. It's been way more thant he Pi-B for a long time.

Sponsored by:		Netflix
2023-08-11 22:55:10 -06:00
Warner Losh
0bc26e3254 clang: Minor build simplification now that armv[45] is not supported
Simplify these expressions a little and remove an obsolete comment.

Sponsored by:		Netflix
2023-08-11 22:55:10 -06:00
Warner Losh
2726978bd8 Makefile.inc1: Remove redundant test for armv[67]
If MACHINE is arm, then MACHINE_ARCH is going to be either armv6* or
armv7*.

Sponsored by:		Netflix
2023-08-11 22:55:10 -06:00
Li-Wen Hsu
962c2a4925
release(7): Bump date after introducing VMFSLIST in 32ae9a6b39
Sponsored by:	The FreeBSD Foundation
2023-08-12 12:39:53 +08:00
Li-Wen Hsu
b231322dbe
tests: Also exclude powerpc/powerpcspe from mmap_map_32bit_test
Sponsored by:	The FreeBSD Foundation
2023-08-12 09:24:15 +08:00
Paul Vixie
5f11a33cee if_vlan: do not enable LRO for bridge interaces
If the parent interface is not a bridge and can do LRO and
checksum offloading on VLANs, then guess it may do LRO on VLANs.
False positive here cost nothing, while false negative may lead
to some confusions. According to Wikipedia:

"LRO should not operate on machines acting as routers, as it breaks
the end-to-end principle and can significantly impact performance."

The same reasoning applies to machines acting as bridges.

PR:		254596
MFC after:	3 weeks
2023-08-12 00:50:37 +02:00
Konstantin Belousov
765ad5b28d tmpfs: add the "pgread" mount option to the allowed options list for mount
Fixes:	0f613ab85e
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-08-11 21:01:49 +03:00
Doug Rabson
54cfeb8484 pkgbase: move libcom_err from kerberos to kerberos-lib
This makes it possible to install kerberos-lib (which is used by common
utilities such as curl) without pulling in the rest of kerberos.

MFC after:	1 week
2023-08-11 14:34:23 +01:00
Kristof Provost
580cadd6a5 vtnet: allow IFF_ALLMULTI to be set without VIRTIO_NET_F_CTRL_RX
If the host doesn't announce VIRTIO_NET_F_CTRL_RX we cannot disable all
multicast traffic. Previously we'd refuse to set the IFF_ALLMULTI flag,
which is the exact opposite of what is actually happening.

This broke things such as igmpproxy.

See also:	https://redmine.pfsense.org/issues/14301
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D41356
2023-08-11 09:42:29 +02:00
Kirk McKusick
c3046779b2 Optimize operations on UFS/FFS filesystems with bad cylinder group(s).
If a UFS/FFS filesystem develops a broken cylinder group (which is
usually detected when its check hash fails), that cylinder group
will not be usable until the filesystem has been unmounted and fsck
has been run to repair it. On the first attempt to to allocate
resources from the broken cylinder group, its available resources
are set to zero in the superblock summary information. Since it
will appear to have no resources available, no further calls will
be made to allocate resources from it. When resources are freed to
the broken cylinder group, the resource free routines will find the
cylinder group unusable so the resource will simply be discarded
and thus will not show up in the superblock summary information
until they are recovered by fsck.

Reported-by:  Peter Holm
Tested-by:    Peter Holm
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-08-10 23:02:47 -07:00
Kirk McKusick
677023529d Cleanups to UFS/FFS ffs_checkblk().
Rename to ffs_checkfreeblk() to better describe that it is checking
to find out if a block or fragment is free. Clarify its implementation.

No functional change intended.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-08-10 22:39:35 -07:00
Enji Cooper
e835ee68e1 Link /usr/bin/cpuset to a relative path
This creates an appropriate symlink instead of a potentially incorrect
path pointing to the absolute path for cpuset(8) on the host.

MFC after:	2 weeks
MFC with:	f05948d4e9
Requested by:	imp
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41419
2023-08-11 04:20:16 -07:00
Wei Hu
7b9bd54ae8 mana: fix a KASSERT panic on recursed lock access in mana_cfg_vport
The panic stack looks like this:
panic: _sx_xlock_hard: recursed on non-recursive sx MANA port lock
@ /usr/src/sys/dev/mana/mana_en.c:1022

KDB: stack backtrace:
vpanic() at vpanic+0x150/frame 0xfffffe011b3c1970
panic() at panic+0x43/frame 0xfffffe011b3c19d0
_sx_xlock_hard() at _sx_xlock_hard+0x82d/frame 0xfffffe011b3c1a70
_sx_xlock() at _sx_xlock+0xb0/frame 0xfffffe011b3c1ab0
mana_cfg_vport() at mana_cfg_vport+0x79/frame 0xfffffe011b3c1b40
mana_alloc_queues() at mana_alloc_queues+0x3b/frame 0xfffffe011b3c1c50
mana_up() at mana_up+0x40/frame 0xfffffe011b3c1c70
mana_ioctl() at mana_ioctl+0x25b/frame 0xfffffe011b3c1cb0
ifhwioctl() at ifhwioctl+0xd11/frame 0xfffffe011b3c1db0
hn_xpnt_vf_init() at hn_xpnt_vf_init+0x15f/frame 0xfffffe011b3c1e10

The lock has already been held in the caller. Remove this
redundant lock attempt.

Reported by:	NetApp
Sponsored by:	Microsoft
2023-08-11 03:30:38 +00:00
Ed Maste
535af610a4 ssh: Update to OpenSSH 9.4p1
Excerpts from the release notes:

 * ssh-agent(1): PKCS#11 modules must now be specified by their full
   paths. Previously dlopen(3) could search for them in system
   library directories.

 * ssh(1): allow forwarding Unix Domain sockets via ssh -W.

 * ssh(1): add support for configuration tags to ssh(1).
   This adds a ssh_config(5) "Tag" directive and corresponding
   "Match tag" predicate that may be used to select blocks of
   configuration similar to the pf.conf(5) keywords of the same
   name.

 * ssh(1): add a "match localnetwork" predicate. This allows matching
   on the addresses of available network interfaces and may be used to
   vary the effective client configuration based on network location.

 * ssh-agent(1): improve isolation between loaded PKCS#11 modules
   by running separate ssh-pkcs11-helpers for each loaded provider.

 * ssh-agent(1), ssh(1): improve defences against invalid PKCS#11
   modules being loaded by checking that the requested module
   contains the required symbol before loading it.

 * ssh(1): don't incorrectly disable hostname canonicalization when
   CanonicalizeHostname=yes and ProxyJump was expicitly set to
   "none". bz3567

Full release notes at https://www.openssh.com/txt/release-9.4

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2023-08-10 23:10:18 -04:00
Jung-uk Kim
6b405053c9 OpenSSL: clean up botched merges in OpenSSL 3.0.9 import
No functional change intended.
2023-08-10 22:36:15 -04:00
Bjoern A. Zeeb
bfed2417f4 qcom: fix panic in qcom_mdio_ipq4018 implementation
Fix a boot-time panic in qcom_mdio_ipq4018 due to a missing bus function
and hook the file up to the build so that it will not rot away.

Test booted on an ipq807x in 2022.
X-Differential Revision: extracted from D37882
2023-08-11 02:12:55 +00:00
Kirk McKusick
886fd36e1a Clean up and document UFS/FFS error returns.
The ffs_inotovp() function returns a vnode from a mounted filesystem
for an inode number with specified generation number. We now
consistently return ESTALE if the inode with given generation number
no longer exists on that filesystem.

The ffs_reload() function reloads all incore data for a filesystem.
It is used after running fsck on a mounted filesystem and finding
things to fix. It now returns the EINTEGRITY error if it is unable
to find a valid superblock.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-08-10 17:54:06 -07:00
Enji Cooper
f05948d4e9 cpuset(8): move to /bin/
Summary:
This change moves /usr/bin/cpuset to /bin/cpuset so it is more readily
available on hosts where the /usr partition might not be mounted at the
time / has been mounted.

Remove some complexity from rc.subr(8) since /bin is assumed to always
be present if/when / is mounted.

MFC after:	2 weeks
MFC with:	0661f93892, 271d552379af

Test Plan:
- Test out rc.subr change.
- Confirm that the installation logic does what's needed.

Relnotes:	yes (moving cpuset may impact strict file permissions/mode checking)
Reviewers:	kevans
Subscribers:	imp
Differential Revision: https://reviews.freebsd.org/D40057
2023-08-11 00:49:02 -07:00
Jung-uk Kim
fb055b01eb OpenSSL: regen opensslv.h for OpenSSL 3.0.10 2023-08-10 20:17:23 -04:00
Glen Barber
136fc49561 release: update main to ALPHA1
Update CURRENT to ALPHA1 as part of the 14.0-RELEASE cycle.

Approved by:	re (implicit)
Sponsored by:	GoFundMe https://www.gofundme.com/f/gjbbsd
Sponsored by:	PayPal https://paypal.me/gjbbsd
2023-08-10 20:02:11 -04:00
Jessica Clarke
8aaa123089 Makefile.libcompat: Fix DTRACE variable
Back when Makefile.lib32 was turned into Makefile.libcompat, a typo was
introduced; it should have been LIBCOMPATDTRACE, but instead gained a
dollar sign in it as LIB$COMPATDTRACE (and with COMPATDTRACE not being
defined, was equivalent to ${LIB:U${DTRACE}}). This then meant it was
not converted to LIB${_LIBCOMPAT}DTRACE in 91d7edd549 ("Generalise
libcompat to be a list rather than a single option") and instead left
broken. Belatedly fix this long-standing seemingly-inconsequential bug.

Fixes:	dba75e9fa5 ("Move Makefile.lib32 to Makefile.libcompat and generalize it.")
2023-08-11 00:48:01 +01:00
Enji Cooper
c45e66dca3 Unbreak usr.bin/dc with OpenSSL 3
OpenSSL's BN_zero API has had a void return value since 1.1.x: chase the
change to unbreak the build on OpenSSL 3.x with MK_GH_BC == no.

MFC after:	2 weeks
Reviewed by:	emaste, kevans
Differential Revision:	https://reviews.freebsd.org/D41410
2023-08-10 23:33:44 -07:00
Rick Macklem
2409231121 mountd: Fix type of signal variable
Without this patch got_sighup(), which is the SIGHUP handler,
would set a variable of type int.

This would appear to be incorrect, although it has worked reliably.
This patch changes the type to "_Atomic(int)", which appears
to be all that is needed to correct it.

Reported by:	pen@lysator.lui.se
Reviewed by:	theraven, karels (prev version), kevans (prev version)
Differential Revision:	https://reviews.freebsd.org/D41265
2023-08-10 12:50:35 -07:00
John Baldwin
9795f14ec4 netlink: Align allocations on __max_align_t, not uint64_t.
uint64_t is not sufficient alignment for allocators on all platforms.
On a CHERI platform pointers require 16 byte alignment, but also if a
type contained a uint128_t or long double it would not be aligned
correctly either.  C11 added max_align_t precisely to provide a
portable type for allocators to use.

Reviewed by:	melifaro
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41301
2023-08-10 11:12:52 -07:00
Kyle Evans
2bd446d7f1 kern: osd: avoid dereferencing freed slots
If a slot is freed that isn't the last one, we'll set its destructor to
NULL to indicate that it's been freed and leave a hole in the slot map.
Check osd_destructors in osd_call() to avoid dereferencing a method that
is potentially from a module that's been unloaded.

This scenario would most commonly surface when two modules are loaded
that osd_register(), then the earlier one deregisters and an osd_call()
is made after the fact.  In the specific report that triggered the
investigation, kldload if_wg -> kldload linux* -> kldunload if_wg ->
destroy a jail -> panic.

Noted in the review, but left for follow-up work, is that the realloc
that may happen in osd_deregister() should likely go away and the
assumption that reallocating to a smaller size cannot fail is actually
not correct.

Reported by:	dim
Reviewed by:	markj, jamie
Differential Revision:	https://reviews.freebsd.org/D41404
2023-08-10 12:33:26 -05:00
Chuck Silvers
60a41168d1 UFS: panic rather than forcibly unmount the root fs
If the root fs is forcibly unmounted then basically every process
will die with a SEGV as soon as it tries to run again because libc.so
is gone, which leaves the system basically hung.  It seems better
to just panic instead, so let's do that.

Requested-by:	karels
Reviewed-by:	imp, mckusick, karels
Sponsored-by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D41387
2023-08-10 09:59:06 -07:00
Ed Maste
78f30535bc Vendor import of OpenSSH 9.4p1 2023-08-10 12:16:53 -04:00
Pierre Pronchery
aa79573457 OpenSSL: update to 3.0.10
OpenSSL 3.0.10 addresses:
- CVE-2023-3817
- CVE-2023-3446
- CVE-2023-2975

(Note that the vendor branch commit incorrectly referenced 3.0.9.)

Relnotes:	Yes
Pull request:	https://github.com/freebsd/freebsd-src/pull/808
Sponsored by:	The FreeBSD Foundation
2023-08-10 12:07:32 -04:00