Commit Graph

285902 Commits

Author SHA1 Message Date
Dmitry Chagin
43c3beb741 linux(4): Drop bogus empty line in linux_socket.c
MFC after:	1 week
2023-08-14 15:46:12 +03:00
Dmitry Chagin
7d561928e6 linux(4): Fix control message size calculation again
It looks Linux recvmsg allows msg_controllen size less then CMSG_SPACE
buffer, at least for case with one cmsghdr. Glibc misc/tst-scm_rights
test succed on Ubuntu 23.04

Fixes:	 	67116c69 "linux(4): Fix control message size calculation"
MFC after:	1 week
2023-08-14 15:46:11 +03:00
Michael Tuexen
749a7fb588 sctp: cleanup
Do not put a variable in the stcb for passing it to a function.
Just use a parameter of the function. No functional change intended.

MFC after:	1 week
2023-08-14 12:27:39 +02:00
Corvin Köhne
85a775e61b
bhyve: add Qemu PPI emulation for TPM devices
Windows requires a physical presence interface to recognize the TPM
device. Qemu's OVMF has an implementation for the PPI which can be
reused. Using the Qemu PPI makes it very easy because we don't have to
implement new PPI functionality into our OVMF. The Qemu implementation
is already there.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40462
2023-08-14 10:17:36 +02:00
Michael Tuexen
e8eb0b7134 sctp: add an assert
This enforces a condition mentioned in a comment.

MFC after:	1 week
2023-08-13 22:47:43 +02:00
Michael Tuexen
6cb8b3b5cd sctp: use consistent names for locking macros
While there, add also a macro for an assert. Will be used shortly.
No functional change intended.

MFC after:	1 week
2023-08-13 22:35:53 +02:00
Kevin Bowling
bef7d49101 ixgbe: define IXGBE_LE32_TO_CPUS
Richard Lowe notes in PR 170267 IXGBE_LE32_TO_CPUS was previously
directly defined as le32dec() which is a pure function but the shared
code is expecting an in place conversion.

In SVN r282289 its assignment was removed altogether.

There was some deliberation in the PR on what to define this as, we
just need to do the update in place which is easy enough.

The uintptr_t casts in the shared code were from a DPDK sync and are
unwanted with our new ixgbe_osdep.h implementation.

PR:		170267
Reported by:	Richard Lowe <richlowe@richlowe.net>
MFC after:	1 week
2023-08-13 18:55:39 -07:00
Emmanuel Vadot
69f8cc60aa ofw_firmware: Only match if there is no compatible
If there is a compatible string it likely means that the firmware needs
a dedicated driver (like on RPI*).

PR:	273087
Tested-by:	Mark Millard <marklmi26-fbsd@yahoo.com>
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Fixes:		fdfd3a90b6 ("ofw: Add a ofw_firmware driver")
2023-08-13 11:19:44 +02:00
Peter Holm
a953ac19db stress2: Added a 'fsck_ffs -B' regression test 2023-08-13 11:09:39 +02:00
Michal Meloun
e59b6e48f4 gdtoa: Regenerate configuration headers for 32-bit arm.
These configuration headers were only guessed, but unfortunately not exactly
correctly. Therefore, re-generate them on real HW.

Generated on CA15, verified on CA9, CA7(with VFP lite) and on 32-bit ARMv9.

PR:	272229
Reported by:	Robert Clausecker <fuz@FreeBSD.org>
MFC after:	2 weeks
2023-08-13 09:35:48 +02:00
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