Commit Graph

284049 Commits

Author SHA1 Message Date
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
Rick Macklem
a94018e200 nfsuserd: Improve failure message when running in a jail
If a jail is not correctly configured to run nfsd(8)
in the jail, nfsuserd(8) cannot run.
This patch improves the failure message for this case.

MFC after:	2 weeks
2023-05-29 13:38:07 -07:00
Cheng Cui
78914cd641
siftr: sync-up man page with recent code changes, and cleanup code
Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40322
2023-05-29 12:16:09 -04:00
Cheng Cui
d29a9a615c
siftr: fix a build error for powerpc and arm platforms
Summary: This is introduced by commit aa61cff424.

Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40320
2023-05-29 12:10:46 -04:00
Tetsuya Uemura
9d35469e9a bcm2835_gpio: Handle BCM2711 pin configuration
Add support for GPIO internal pull up/down configuration on RPi4 family.

BCM2711 SoC on 4th generation Raspberry Pi changed the way to configure
its GPIO pins' internal pull up/down resistors. NetBSD already have
support for this change, and port it to FreeBSD is trivial.

This patch, based on the NetBSD commit adds the appropriate method for
BCM2711 and now we can properly configure the GPIO pins' pull status.

PR:		256372
Reviewed by:	mhorne
Obtained from:	NetBSD bb88cfa64ad8
Pull Request:	https://github.com/freebsd/freebsd-src/pull/746
2023-05-29 15:47:12 -03:00
Joseph Mingrone
67c802c948
libpcap: Update PACKAGE_VERSION definition to 1.10.4
Reviewed by:    kp
Fixes:          6f9cba8f8b (libpcap: Update to 1.10.3)
Fixes:          dd744a896b (libpcap: Update to 1.10.4)
Sponsored by:   The FreeBSD Foundation
2023-05-29 15:41:01 -03:00
Alan Cox
3e7e2bb246 arm64 pmap: Make VM_PAGE_TO_PV_LIST_LOCK() a constant-time operation
The prior implementation of VM_PAGE_TO_PV_LIST_LOCK() performed a
linear-time search of the vm_phys_segs[] array.  However, in contrast to
PHYS_TO_PV_LIST_LOCK(), that search is unnecessary because every (non-
fictitious) vm_page contains the index of the vm_phys_seg in which it
resides.

Change most of the remaining uses of CHANGE_PV_LIST_LOCK_TO_PHYS() and
PHYS_TO_PV_LIST_LOCK() to CHANGE_PV_LIST_LOCK_TO_VM_PAGE() and
VM_PAGE_TO_PV_LIST_LOCK(), respectively.

Collectively, these changes also reduce the size of a GENERIC-NODEBUG
kernel's pmap.

Before:

  text   data    bss     dec       hex   filename
 70144   3200   2248   75592   0x12748   pmap.o

After:

  text   data    bss     dec       hex   filename
 69192   3200   2248   74640   0x12390   pmap.o

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D40306
2023-05-29 11:22:55 -05:00
Dimitry Andric
8792c03886 Apply clang fixes for crashes compiling ARM/AArch64 CRC intrinsics
Merge commit 069ecd0c6e2c from llvm-project (by Fangrui Song):

  [ARM] Check target feature support for __builtin_arm_crc*

  `__builtin_arm_crc*` requires the target feature crc which is available on armv8
  and above. Calling the fuctions for armv7 leads to a SelectionDAG crash.

  ```
  % clang -c --target=armv7-unknown-linux-gnueabi -c a.c
  fatal error: error in backend: Cannot select: intrinsic %llvm.arm.crc32b
  PLEASE submit a bug report to ...
  ```

  Add `TARGET_BUILTIN` and define required features for these builtins to
  report an error in `CodeGenFunction::checkTargetFeatures`. The problem is quite widespread.
  I will add `TARGET_BUILTIN` for more builtins later.

  Fix https://github.com/llvm/llvm-project/issues/57802

  Differential Revision: https://reviews.llvm.org/D134127

Merge commit b2d7a0dcf1ff from llvm-project (by Fangrui Song):

  [AArch64] Check target feature support for __builtin_arm_crc*

  This is the AArch64 counterpart of D134127.
  Daniel Kiss will change more `BUILTIN` to `TARGET_BUILTIN`.

  Fix #57802

Note that programs attempting to use ARM/AArch64 CRC intrinsics, when
they are not supported by the targeted CPU, will still receive a regular
compilation error (instead of a fatal backend error) similar to:

  7zCrc.c:4:10: error: '__builtin_arm_crc32b' needs target feature crc
    return __builtin_arm_crc32b(a, b);
           ^

Reported by:	Alastair Hogge <agh@riseup.net>
PR:		271624
MFC after:	3 days
2023-05-29 16:28:18 +02:00
Cheng Cui
aa61cff424
siftr: three changes that improve performance
Summary:
(1) use inp_flowid or a new packet hash for a flow identification
(2) cache constant connection info into struct flow_hash_node
(3) use compressed notation for IPv6 address representation

Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40302
2023-05-29 05:11:18 -04:00
Dmitry Chagin
eb98f77910 linux(4): Regen for linux_execve
MFC after:		2 month
2023-05-29 12:18:30 +03:00
Dmitry Chagin
8340b03425 linux(4): Add a dedicated linux_exec_copyin_args()
Because Linux allows to exec binaries with 0 argc.

Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D40148
MFC after:		2 month
2023-05-29 12:18:16 +03:00
Dmitry Chagin
07c0b6e535 vfs: Retire kern_alternate_path() as unused anymore
From now a non-native ABI should use pwd_altroot() ability to tell
to the namei() its root directory to dynamically reroots lookups.

Differential Revision:	https://reviews.freebsd.org/D40093
MFC after:		2 month
2023-05-29 11:19:41 +03:00
Dmitry Chagin
c4299cec48 linux(4): Make linux_emul_path private
There is no need to refer to linux_emul_path from outside anymore.

MFC after:		2 month
2023-05-29 11:19:08 +03:00
Dmitry Chagin
a482fffc7e linprocfs: Rework according to the new ABI altroot facility
By 3d2fec7d the ABI prefix path added to the struct pwd.
Use it in the mounts, mountinfo filler functions.

Differential revision:	https://reviews.freebsd.org/D39438
MFC after:		2 month
2023-05-29 11:18:37 +03:00
Dmitry Chagin
d706d02edb sysentvec: Retire sv_imgact_try as unneeded anymore
The sysentvec sv_imgact_try was used by kern_exec() to allow
non-native ABI to fixup shell path according to ABI root directory.
Since the non-native ABI can now specify its root directory directly
to namei() via pwd_altroot() call this facility is not needed anymore.

Differential Revision:	https://reviews.freebsd.org/D40092
MFC after:		2 month
2023-05-29 11:18:11 +03:00
Dmitry Chagin
57578deac7 Brandinfo: Retire emul_path as unneeded anymore
The Barndinfo emul_path was used by the Elf image activator to fixup
interpreter file name according to ABI root directory. Since the
non-native ABI can now specify its root directory directly to namei()
via pwd_altroot() call this facility is not needed anymore.

Differential Revision:	https://reviews.freebsd.org/D40091
MFC after:		2 month
2023-05-29 11:17:28 +03:00
Dmitry Chagin
fd745e1db6 linux(4): Use pwd_altroot() to tell namei() about ABI root path
PR:			72920
Differential Revision:	https://reviews.freebsd.org/D40090
MFC after:		2 month
2023-05-29 11:16:46 +03:00
Dmitry Chagin
3d2fec7db8 namei: Add the abilty for the ABI to specify an alternate root path
For now a non-native ABI (i.e., Linux) uses the kern_alternate_path()
facility to dynamically reroot lookups. First, an attempt is made to
lookup the file in /compat/linux/original-path. If that fails, the
lookup is done in /original-path. Thats requires a bit of code in
every ABI syscall implementation where path name translation is needed.
Also our kern_alternate_path() does not properly lookups absolute symlinks
in second attempt, i.e., does not append /compat/linux part to the resolved
link.
The change is intended to avoid this by specifiyng the ABI root directory
for namei(), using one call to pwd_altroot() during exec-time into the ABI.
In that case namei() will dynamically reroot lookups as mentioned above.

PR:			72920
Reviewed by:		kib
Differential revision:	https://reviews.freebsd.org/D38933
MFC after:		2 month
2023-05-29 11:15:28 +03:00
Dmitry Chagin
723e25f128 avx_sig: Print statistics by interval enstead of by pressing ^T
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40311
2023-05-29 11:09:17 +03:00
Dmitry Chagin
0a09cfb3f7 avx_sig: Avoid libbsd dependency for modern Glibc
Due to arc4random functions are povided by Glibc 2.36.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40310
2023-05-29 11:08:35 +03:00
Kirk McKusick
b796bfce48 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Check for valid block numbers while loading journal entries that
contain block numbers. If an invalid block number is found, fall
back to full fsck.

Reported-by:  Robert Morris
PR:           271383
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-28 15:23:37 -07:00
Kyle Evans
9ed4ec4ae3 stand: libefi: avoid a null pointer deref in eficom
We don't keep comc_port around anymore if the console's not present, but
some things might still try to set one of the environment variables we
hook.  In particular, one need not even set efi_com_port/efi_com_speed
in loader.conf; loader may do it itself and induce the crash if ConOut
depicts an available uart.

Probably reported by:	dch
OK for now:	imp
2023-05-28 13:54:50 -05:00
Rick Macklem
697727110b gssd: Improve failure message when running in a jail
If a jail is not correctly configured to run nfsd(8)
in the jail, gssd(8) cannot run.
This patch improves the failure message for this case.

MFC after:	2 weeks
2023-05-28 11:08:38 -07:00
Kyle Evans
e15da6b10a libc: locale: fix collation file size validation
At a minimum, we need enough for the colllation format version string +
locale definition version string and a full collate_info definition,
rather than just the first two and a pointer.

Sponsored by:	Klara, Inc.
2023-05-28 12:54:24 -05:00
Cy Schubert
402cee1f19 sqlite3: Vendor import of sqlite3 3.42.0
Release notes at https://www.sqlite.org/releaselog/3_42_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz

Merge commit '92b2b066353ddd32e1d59f8c52c430d552d9a9a5' into sqlite3/main
2023-05-28 07:31:36 -07:00
Cy Schubert
92b2b06635 sqlite3: Vendor import of sqlite3 3.42.0
Release notes at https://www.sqlite.org/releaselog/3_42_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz
2023-05-28 07:07:30 -07:00