Commit Graph

284026 Commits

Author SHA1 Message Date
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
Dmitry Chagin
78c2e58fa5 linux(4): Fix stack unwinding across signal frame on x86_64
Get rid of using register numbers which is undefined in libunwind
on x86_64.

Differential Revision:	https://reviews.freebsd.org/D40156
MFC after:		1 month
2023-05-28 17:07:28 +03:00
Dmitry Chagin
037b60fb0f linux(4): Preserve %rcx (return address) like a Linux do
Perhaps, this does not makes much sense as destroyng %rcx declared by
the x86_64 Linux syscall ABI. However,:
a) if we get a signal while we are in the kernel, we should restore
   tf_rcx when preparing machine context for signal handlers.
b) the Linux world is strange, someone can depend on %rcx value
   after syscall, something like go.

Differential Revision:	https://reviews.freebsd.org/D40155
MFC after:		1 month
2023-05-28 17:06:47 +03:00
Dmitry Chagin
185bd9fa30 linux(4): Simplify %r10 restoring on amd64
Restore %r10 at system call entry to avoid doing this multiply times.

Differential Revision:	https://reviews.freebsd.org/D40154
MFC after:		1 month
2023-05-28 17:06:23 +03:00
Dmitry Chagin
a463dd8108 linux(4): Add a comment explaining registers at syscall entry point on amd64
Differential Revision:	https://reviews.freebsd.org/D40153
MFC after:		1 month
2023-05-28 17:06:05 +03:00
Dmitry Chagin
a99b890ecd linux(4): Drop a weird comment from linux_set_syscall_retval on amd64
I agree, it would be great to avoid PCB_FULL_IRET, however we should
follow Linux system call ABI.

Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D40152
MFC after:		1 month
2023-05-28 17:05:44 +03:00
Enji Cooper
27234ad699 Fix the build post-dcf5d5603b3af8
I didn't compile test the prior code before committing.

MFC after:	1 week
MFC with:	dcf5d5603b
2023-05-27 19:18:43 -07:00
Kirk McKusick
101a9ac071 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Check for valid file size before processing journal entries for it.
Done by extracting the file size check from pass1.c into chkfilesize()
then using it in the journal code in suj.c

Reported-by:  Robert Morris
PR:           271378
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-27 17:12:30 -07:00
Enji Cooper
dcf5d5603b Reduce ifdef soup by adding pre-3.0 compat support
This change creates a static inline function, BN_check_prime, for
pre-3.0 use which is implemented with the previous (1.1) compatible call
under the covers, `BN_is_prime_ex`.

The `nchecks` parameter value is maintained, even though it has no
noticable behavior change, given that the documentation clearly states
that at least 64 or 128 rounds are executed on the backend, depending on
how many bits there are in the given number being factored out.

MFC after:	1 week
Differential Revision:	 https://reviews.freebsd.org/D40305
2023-05-27 17:05:39 -07:00
Kirk McKusick
11ce203e05 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
The last valid inode in the filesystem is maxino - 1, not maxino.
Thus validity checks should ino < maxino, not ino <= maxino.

Reported-by:  Robert Morris
PR:           271312
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-27 16:07:09 -07:00
Kirk McKusick
c79a141695 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Verify that the summary information does not extend past the end
of the filesystem.

No legitimate superblocks should fail as a result of these changes.

Reported-by:  Robert Morris
PR:           271351
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-27 12:24:11 -07:00
Enji Cooper
537cd76643 factor: support OpenSSL 3
This change ports the BN APIs to an OpenSSL 3 compatible set of APIs.

This removes the need for requesting OpenSSL 1.1 compatible APIs.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40298
2023-05-27 11:11:44 -07:00
Enji Cooper
c60be9ea6b Add simple factor/primes regression tests
This will help ensure that the change following this
one to support OpenSSL 3 is sane.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40297
2023-05-27 11:11:44 -07:00
John Reimer
b498331b03 netgdb: Fix netgdb double ack, print proxy address
- Fixes netgdb's double ack
- Moving ack responsibility to debugnet, decision to ack made by netdump/netgdb.
- Finish responsibility moved to debugnet, new finish handler.
- netgdb now prints the address to connect to in case the user doesn't have
  access to the proxy machine.

Sponsored by:	Dell EMC
Reviewed By:	markj, bdrewery (earlier version)
Differential Revision:	https://reviews.freebsd.org/D40064
2023-05-27 09:34:17 -07:00
Dimitry Andric
1f571f8767 Apply libc++ fix for compiling <type_traits> with clang 16
Merge commit 0e7971154ecb from llvm-project (by Christopher Di Bella):

  [libcxx][NFC] utilises compiler builtins for unary transform type-traits

  Depends on D116203

  Reviewed By: #libc, philnik

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

Clang 16 got new builtins that are equivalent to hand-written parts of
<type_traits>. When building world with the devel/llvm16 package
installed and CROSS_TOOLCHAIN=llvm16 set, this would lead to -Werror
warnings about those builtins being overridden.

Reported by:	emaste
MFC after:	3 days
2023-05-27 18:19:37 +02:00
Joseph Mingrone
270d20ce91
libpcap: Update PACKAGE_STRING to 1.10.4
Reviewed by:	emaste
Fixes:		6f9cba8f8b (libpcap: Update to 1.10.3)
Fixes:		dd744a896b (libpcap: Update to 1.10.4)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40295
2023-05-27 12:38:38 -03:00
Alexander V. Chernikov
c90901245e netlink: update rta_multipath conditions in arp/ndp after 656a39c1a0 2023-05-27 13:25:16 +00:00
Alexander V. Chernikov
30376771fc netlink: fix build 2023-05-27 12:29:14 +00:00
Alexander V. Chernikov
7ee6b0f125 netlink: add snl(3) support for listing genetlink multicast groups
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D40282
MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Alexander V. Chernikov
656a39c1a0 netlink: use newly-added snl(3) array parsing for handling multipath
routes.

MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Alexander V. Chernikov
5f19f790b3 netlink: add snl(3) support for parsing unknown-size arrays
Reviewed by:	bapt
Differential Review: https://reviews.freebsd.org/D40282
MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Alexander V. Chernikov
99ea21744b netlink: fix bulding with NOINET6 2023-05-27 10:46:25 +00:00
Alexander V. Chernikov
dfc15e761b netlink: call IPv6 hook after the ifaddr operation when ifp is brought
up.

This change fixes the case when the first address added to the interface
 is IPv6 GU address. Before the change, IPv6 LL addition was not
triggered.

PR: 271661
MFC after:	2 weeks
2023-05-27 10:38:32 +00:00
Peter Holm
750ae32b9e stress2: Initialize variable 2023-05-27 10:34:48 +02:00