Commit Graph

285712 Commits

Author SHA1 Message Date
Gleb Smirnoff
d29b95ecc0 sockets: on accept(2) don't copy all of so_options to new socket
As uncovered by e3ba0d6add we are copying lots of irrelevant options
from the listener to an accepted socket, even those that aren't relevant
to a non-listener, e.g. SO_REUSE*, SO_ACCEPTFILTER.  Stop doing that
and provide a fixed opt-in list for options to be inherited.  Ideally
we shall not inherit anything at all.  For compatibility inherit a set
of options that are meaningful for a non-listening socket of a protocol
that can listen(2).

Differential Revision:	https://reviews.freebsd.org/D41412
Fixes:			e3ba0d6add
2023-08-14 12:56:08 -07:00
John Baldwin
e3637e2f5b RELNOTES: Trim spurious blank line. 2023-08-14 12:02:29 -07:00
Dmitry Chagin
f3e11927dc vm: Allow MAP_32BIT for all architectures
Reviewed by:		alc, kib, markj
Differential revision:	https://reviews.freebsd.org/D41435
2023-08-14 20:20:20 +03:00
Dmitry Chagin
0ddd32b617 vm: MAP_32BIT_MAX_ADDR defined in sys/mman.h
Reviewed by:		kib
Differential revision:	https://reviews.freebsd.org/D41434
2023-08-14 20:18:30 +03:00
Bartosz Sobczak
8e6654a6a5
ofed: fix roce gid insertion for vlan interfaces
When attempting to use vlan interface the correct GID
wasn't created due to incorrect ifp validation.

The problem was introduced in
3e142e0767 ('ofed: Mechanically convert to IfAPI)

Signed-off-by: Bartosz Sobczak bartosz.sobczak@intel.com
Signed-off-by: Eric Joyner <erj@FreeBSD.org>

PR:		273043
Sponsored by:	Intel Corporation
Reviewed by:	jhibbits@, erj@
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41426
2023-08-14 08:53:43 -07:00
Dmitry Chagin
2467ccddc0 linux(4): Fix MSG_CTRUNC handling in recvmsg()
The MSG_CTRUNC flag of the msg_flags member of the message header is
set uppon successful completition if the control data was truncated.
Upon return from a successful call msg_controllen should contain the
length of the control message sequence.

Fixes:		0eda2cea
MFC after:	1 week
2023-08-14 15:46:12 +03:00
Dmitry Chagin
9d0c9b6d6a linux(4): Add a comment explaining udata freeing on error
MFC after:	1 week
2023-08-14 15:46:12 +03:00
Dmitry Chagin
de20eb26d0 linux(4): Refactor recvmsg
As the amount of handled anxiliary messages grows move they handlers
into a separate functions.

MFC after:	1 week
2023-08-14 15:46:12 +03:00
Dmitry Chagin
bbaa5523c0 linux(4): Skip unsupported anxiliary message
Instead of returning error, skip unsupported anxiliary messages and
fail if no one handled.

MFC after:	1 week
2023-08-14 15:46:12 +03:00
Dmitry Chagin
a21238d843 linux(4): Improve readability of recvmsg control buffer copyout code
MFC after:	1 week
2023-08-14 15:46:12 +03:00
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