]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
18 months agolibarchive: merge from vendor branch
Martin Matuska [Tue, 13 Dec 2022 19:21:13 +0000 (20:21 +0100)]
libarchive: merge from vendor branch

Libarchive 3.6.2

Important bug fixes:
  rar5 reader: fix possible garbled output with bsdtar -O (#1745)
  mtree reader: support reading mtree files with tabs (#1783)
  various small fixes for issues found by CodeQL

MFC after: 2 weeks
PR: 286306 (exp-run)

18 months agoRELNOTES: Add mention of growfs addition of swap partition.
Mike Karels [Tue, 13 Dec 2022 14:54:43 +0000 (08:54 -0600)]
RELNOTES: Add mention of growfs addition of swap partition.

As documented in growfs(7).

18 months agossh: describe two additional changes present in base system ssh
Ed Maste [Tue, 13 Dec 2022 14:43:04 +0000 (09:43 -0500)]
ssh: describe two additional changes present in base system ssh

Sponsored by: The FreeBSD Foundation

18 months agostress2: Add problem found
Peter Holm [Tue, 13 Dec 2022 11:00:01 +0000 (12:00 +0100)]
stress2: Add problem found

18 months agokref: replace hand-rolled atomic ops with refcount API
Mateusz Guzik [Mon, 5 Dec 2022 17:38:45 +0000 (17:38 +0000)]
kref: replace hand-rolled atomic ops with refcount API

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37608

18 months agoAdd driver for Motorcomm YT8511 GbE PHY
Søren Schmidt [Tue, 13 Dec 2022 05:58:51 +0000 (05:58 +0000)]
Add driver for Motorcomm YT8511 GbE PHY

Partially from: https://reviews.freebsd.org/D36093

18 months agostand: Make ioctl declaration consistent
Warner Losh [Tue, 13 Dec 2022 04:46:05 +0000 (21:46 -0700)]
stand: Make ioctl declaration consistent

It typically had two args with an optional third from the userland
declaration in sys/ioccom.h. However, the funciton definition used a
non-optional char * argument. This mismatch is UB behavior (but worked
due to the calling convetions of all our machines).

Instead, add a declaration for ioctl to stand.h, make the third arg
'void *' which is a better match to the ... declaration before. This
prevents the convert int * -> char * errors as well. Make the ioctl
user-space declaration truly user-space specific (omit it in the
stand-alone build).

No functional change intended.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37680

18 months agoAdd sizeof(7) manual page
Jan Schaumann [Tue, 13 Dec 2022 04:35:11 +0000 (06:35 +0200)]
Add sizeof(7) manual page

PR: 268310
Reviewed by: kib
Discussed with: brooks, pauamma
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37674

18 months agogeom: minor man page updates suggested by igor(1)
Ed Maste [Mon, 12 Dec 2022 21:26:00 +0000 (16:26 -0500)]
geom: minor man page updates suggested by igor(1)

Reviewed by: pauamma
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37681

18 months agossh: remove note about local change to [Use]PrivilegeSeparation
Ed Maste [Mon, 12 Dec 2022 22:00:13 +0000 (17:00 -0500)]
ssh: remove note about local change to [Use]PrivilegeSeparation

We documented "[Use]PrivilegeSeparation defaults to sandbox" as one of
our modifications to ssh's server-side defaults, but this is not (any
longer) a difference from upstream.

Sponsored by: The FreeBSD Foundation

18 months agogeom: add vinum as a recognized class
Ed Maste [Mon, 12 Dec 2022 17:13:58 +0000 (12:13 -0500)]
geom: add vinum as a recognized class

And note that it is deprecated.

PR: 236569
Reported by: bcran
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37678

18 months agoRELNTOES: Add note for llvm-objdump as objdump
Ed Maste [Mon, 12 Dec 2022 16:29:20 +0000 (11:29 -0500)]
RELNTOES: Add note for llvm-objdump as objdump

18 months agopmap: standardize promotion conditions between amd64 and arm64
Alan Cox [Sat, 8 Oct 2022 07:20:25 +0000 (02:20 -0500)]
pmap: standardize promotion conditions between amd64 and arm64

On amd64, don't abort promotion due to a missing accessed bit in a
mapping before possibly write protecting that mapping.  Previously,
in some cases, we might not repromote after madvise(MADV_FREE) because
there was no write fault to trigger the repromotion.  Conversely, on
arm64, don't pointlessly, yet harmlessly, write protect physical pages
that aren't part of the physical superpage.

Don't count aborted promotions due to explicit promotion prohibition
(arm64) or hardware errata (amd64) as ordinary promotion failures.

Reviewed by: kib, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36916

18 months agorestore: fix restore of NFS4 ACLs
Chuck Silvers [Mon, 12 Dec 2022 16:14:17 +0000 (08:14 -0800)]
restore: fix restore of NFS4 ACLs

Changing the mode bits on a file with an NFS4 ACL results in the
NFS4 ACL being replaced by one matching the new mode bits being set,
so when restoring a file with an NFS4 ACL, set the owner/group/mode first
and then set the NFS4 ACL, so that setting the mode does not throw away
the ACL that we just set.

Reviewed by: mckusick
Differential Revision:  https://reviews.freebsd.org/D37618

18 months agoAlways install llvm-objdump as objdump
Ed Maste [Fri, 18 Nov 2022 20:47:13 +0000 (15:47 -0500)]
Always install llvm-objdump as objdump

Instead of providing no /usr/bin/objdump when LLVM_BINUTILS is false.

PR: 267854 [exp-run]
Reviewed by: dim
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37445

18 months agoRevert "uname: switch machine to HW_MACHINE_ARCH"
Piotr Kubaj [Mon, 12 Dec 2022 14:39:12 +0000 (15:39 +0100)]
Revert "uname: switch machine to HW_MACHINE_ARCH"

Reverting because of issue in Makefile.inc1 during native builds:
make[1]: “.../freebsd/Makefile.inc1" line 163: Unknown target aarch64:aarch64.

Since I only tested this patch with make universe on amd64, this issue wasn't caught.

This reverts commit 83bf6ab568293e325f437342cdb87a626353e27c.

18 months agoAdd driver for Rockchip One Time Programmable (OTP) device.
Søren Schmidt [Mon, 12 Dec 2022 14:34:18 +0000 (14:34 +0000)]
Add driver for Rockchip One Time Programmable (OTP) device.
This driver created the possibility to assign fixed MAC adresses to eqos devices.

18 months agobridge: Fix a potential memory leak in bridge_enqueue()
Mark Johnston [Sun, 11 Dec 2022 16:40:12 +0000 (11:40 -0500)]
bridge: Fix a potential memory leak in bridge_enqueue()

A comment at the beginning of the function notes that we may be
transmitting multiple fragments as distinct packets.  So, the function
loops over all fragments, transmitting each mbuf chain.  If if_transmit
fails, we need to free all of the fragments, but m_freem() only frees an
mbuf chain - it doesn't follow m_nextpkt.

Change the error handler to free each untransmitted packet fragment, and
count each fragment as a separate error since we increment OPACKETS once
per fragment when transmission is successful.

Reviewed by: zlei, kp
MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37635

18 months agolibdtrace: Change the binding of USDT probe symbols to STB_WEAK
Mark Johnston [Sun, 11 Dec 2022 16:27:22 +0000 (11:27 -0500)]
libdtrace: Change the binding of USDT probe symbols to STB_WEAK

Otherwise, if multiple object files contain references to the same
probe, newish lld will refuse to link them by default, raising a
duplicate global symbol definition error.  Previously, duplicate global
symbols with identical absolute st_values were permitted by both lld and
GNU ld.

Since dtrace has no use for probe function symbols after the relocation
performed by dtrace -G, make the symbols weak as well, following a
suggestion from MaskRay.

Reported by: dim
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

18 months agouname: switch machine to HW_MACHINE_ARCH
Piotr Kubaj [Sun, 11 Dec 2022 03:01:44 +0000 (04:01 +0100)]
uname: switch machine to HW_MACHINE_ARCH

On powerpc64, powerpc64le and riscv64 some software wrongly assumes that
it runs on powerpc or riscv (32-bit).

Differential revision: https://reviews.freebsd.org/D35962
Approved by: alfredo, imp

18 months agonullfs: adopt VV_CROSSLOCK
Jason A. Harmening [Sun, 20 Nov 2022 18:33:34 +0000 (12:33 -0600)]
nullfs: adopt VV_CROSSLOCK

When the lower filesystem directory hierarchy is the same as the nullfs
mount point (admittedly not likely to be a useful situation in
practice), nullfs is subject to the exact deadlock between the busy
count drain and the covered vnode lock that VV_CROSSLOCK is intended
to address.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37458

18 months agounionfs: allow recursion on covered vnode lock during mount/unmount
Jason A. Harmening [Sun, 20 Nov 2022 18:25:46 +0000 (12:25 -0600)]
unionfs: allow recursion on covered vnode lock during mount/unmount

When taking the covered vnode lock during mount and unmount operations,
specify LK_CANRECURSE as the existing lock state of the covered vnode
is not guaranteed (AFAIK) either by assertion or documentation for
these code paths.

For the mount path, this is done only for completeness as the covered
vnode lock is not currently held when VFS_MOUNT() is called.
For the unmount path, the covered vnode is currently held across
VFS_UNMOUNT(), and the existing code only happens to work when unionfs
is mounted atop FFS because FFS sets LO_RECURSABLE on its vnode locks.

This of course doesn't cover a hypothetical case in which the covered
vnode may be held shared, but for the mount and unmount paths such a
scenario seems unlikely to materialize.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37458

18 months agoGeneralize the VV_CROSSLOCK logic in vfs_lookup()
Jason A. Harmening [Wed, 26 Oct 2022 22:25:20 +0000 (17:25 -0500)]
Generalize the VV_CROSSLOCK logic in vfs_lookup()

When VV_CROSSLOCK is present, the lock for the vnode at the current
stage of lookup must be held across the VFS_ROOT() call for the
filesystem mounted at the vnode.  Since VV_CROSSLOCK implies that
the root vnode reuses the already-held lock, the possibility for
recursion should be made clear in the flags passed to VFS_ROOT().

For cases in which the lock is held exclusive, this means passing
LK_CANRECURSE.  For cases in which the lock is held shared, it
means clearing LK_NODDLKTREAT to allow VFS_ROOT() to potentially
recurse on the shared lock even in the presence of an exclusive
waiter.

That the existing code works for unionfs is due to a coincidence
of the current unionfs implementation.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37458

18 months agomtx: retire PARTIAL_PICKUP_GIANT
Mateusz Guzik [Sun, 11 Dec 2022 03:26:23 +0000 (03:26 +0000)]
mtx: retire PARTIAL_PICKUP_GIANT

It does not appear to have ever been used.

Sponsored by: Rubicon Communications, LLC ("Netgate")

18 months agouipc: remove accept_mtx
Mateusz Guzik [Sun, 11 Dec 2022 02:47:07 +0000 (02:47 +0000)]
uipc: remove accept_mtx

It is unused since 779f106aa169256b ("Listening sockets improvements.")

Sponsored by: Rubicon Communications, LLC ("Netgate")

18 months agogrowfs(7): document addition of swap partition and growfs_fstab script
Mike Karels [Sat, 10 Dec 2022 19:40:55 +0000 (13:40 -0600)]
growfs(7): document addition of swap partition and growfs_fstab script

Add documentation of the growfs script's new ability to add a swap
partition, expanding on the previous functionality as well.  Add the
growfs_fstab helper script, which runs separately.  Add a description
of how to expand a file system a second time if swap had been added.
While here, fix a typo.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D37465

18 months agodefault rc.conf: Add new growfs_swap_size variable
Mike Karels [Sat, 10 Dec 2022 19:40:33 +0000 (13:40 -0600)]
default rc.conf: Add new growfs_swap_size variable

Add new growfs_swap_size variable with a default value of the empty
string, along with comments on other settings.  Used by the growfs
script.

Differential Revision: https://reviews.freebsd.org/D37464

18 months agogrowfs_fstab: add new /etc/rc.d script to add swap to fstab
Mike Karels [Sat, 10 Dec 2022 19:39:59 +0000 (13:39 -0600)]
growfs_fstab: add new /etc/rc.d script to add swap to fstab

The growfs_fstab script is a helper for the growfs script to add any
new swap partition to /etc/fstab on first boot.  If growfs adds a
swap partition, it sets growfs_swap_pdev in the kenv.   In this case,
after the root file system is read/write, if there is no swap partition
in the fstab, growfs_fstab adds growfs_swap as a swap partition to the
fstab.  Also, it runs dumpon to add the swap partition  (as this
happened earlier in the startup sequence).

Discussed with: cperciva
Differential Revision: https://reviews.freebsd.org/D37463

18 months agogrowfs script: add swap partition as well as growing root
Mike Karels [Sat, 10 Dec 2022 19:38:36 +0000 (13:38 -0600)]
growfs script: add swap partition as well as growing root

Add the ability to create a swap partition in the course of growing
the root file system on first boot, enabling by default.  The default
rules are: add swap if the disk is at least 15 GB (decimal), and the
existing root is less than 40% of the disk.  The default size is 10%
of the disk, but is limited by the memory size.  The limit is twice
memory size up to 4 GB, 8 GB up to 8 GB memory, and memory size over
8 GB memory. Swap size is clamped at vm.swap_maxpages/2 as well.
The new swap partition is labeled as "growfs_swap".

The default behavior can be overridden by setting growfs_swap_size in
/etc/rc.conf or in the kernel environment, with kenv taking priority.
A value of 0 inhibits the addition of swap, an empty value specifies
the default, and other values indicate a swap size in bytes.

By default, addition of swap is inhibited if a swap partition is found
in the output of the sysctl kern.geom.conftxt before the current root
partition, usually meaning that there is another disk present.
Swap space is not added if one is already present in /etc/fstab.

The root partition is read-only when growfs runs, so /etc/fstab can
not be modified.  That step is handled by a new growfs_fstab script,
added in a separate commit.  Set the value "growfs_swap_pdev" in kenv
to indicate that this should be done, as well as for internal use.

There is optional verbose output meant for debugging; it can only be
enabled by modifying the script (in two places, for sh and awk).
This should be removed before release, after testing on -current.

Discussed with: cperciva
Reviewed by: imp (previous version)
Differential Revision: https://reviews.freebsd.org/D37462

18 months agobhyve: Remove the unused vcpu argument from all of the I/O port handlers.
John Baldwin [Fri, 9 Dec 2022 18:35:44 +0000 (10:35 -0800)]
bhyve: Remove the unused vcpu argument from all of the I/O port handlers.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37653

18 months agobhyve: Remove unused vcpu argument from PCI read/write methods.
John Baldwin [Fri, 9 Dec 2022 18:35:28 +0000 (10:35 -0800)]
bhyve: Remove unused vcpu argument from PCI read/write methods.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37652

18 months agobhyve: Pass a vCPU ID of 0 to vm_setup_pptdev_msi*.
John Baldwin [Fri, 9 Dec 2022 18:28:11 +0000 (10:28 -0800)]
bhyve: Pass a vCPU ID of 0 to vm_setup_pptdev_msi*.

These ioctls are not vCPU-specific and the ioctl now ignores the vCPU
ID.  0 is used instead of -1 to provide limited forwards
compatibility.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37651

18 months agobhyve: Remove unused argument from pci_nvme_handle_doorbell.
John Baldwin [Fri, 9 Dec 2022 18:27:36 +0000 (10:27 -0800)]
bhyve: Remove unused argument from pci_nvme_handle_doorbell.

Reviewed by: corvink, chuck, markj
Differential Revision: https://reviews.freebsd.org/D37650

18 months agovmm: Free vCPUs when destroying them.
John Baldwin [Fri, 9 Dec 2022 18:27:05 +0000 (10:27 -0800)]
vmm: Free vCPUs when destroying them.

Reported by: andrew
Reviewed by: corvink, andrew, markj
Differential Revision: https://reviews.freebsd.org/D37649

18 months agovmm: Avoid infinite loop in vcpu_lock_all error case.
John Baldwin [Fri, 9 Dec 2022 18:26:49 +0000 (10:26 -0800)]
vmm: Avoid infinite loop in vcpu_lock_all error case.

Reported by: Coverity (CIDs 1501060,1501071)
Reviewed by: corvink, markj, emaste
Differential Revision: https://reviews.freebsd.org/D37648

18 months agovmm: Don't lock a vCPU for VM_PPTDEV_MSI[X].
John Baldwin [Fri, 9 Dec 2022 18:26:23 +0000 (10:26 -0800)]
vmm: Don't lock a vCPU for VM_PPTDEV_MSI[X].

These are manipulating state in a ppt(4) device none of which is
vCPU-specific.  Mark the vcpu fields in the relevant ioctl structures
as unused, but don't remove them for now.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37639

18 months agovmm: VM_GET/SET_KERNEMU_DEV should run with the vCPU locked.
John Baldwin [Fri, 9 Dec 2022 18:25:30 +0000 (10:25 -0800)]
vmm: VM_GET/SET_KERNEMU_DEV should run with the vCPU locked.

Reviewed by: corvink, kib, markj
Differential Revision: https://reviews.freebsd.org/D37638

18 months agoUpdate vendor/libarchive to libarchive/libarchive@ba80276cc
Martin Matuska [Fri, 9 Dec 2022 16:26:30 +0000 (17:26 +0100)]
Update vendor/libarchive to libarchive/libarchive@ba80276cc

Important Bugfixes:
  rar5 reader: fix possible garbled output with bsdtar -O (#1745)
  mtree reader: support reading mtree files with tabs (#1783)
  various small fixes for issues found by CodeQL

Obtained from: libarchive
Libarchive commit: ba80276ccc3c941c4918ec6e2460059f0c525c43
Libarcive tag: v3.6.2

18 months agoProvide consistent prototype for swp_pager_meta_free()
Konstantin Belousov [Fri, 9 Dec 2022 15:21:16 +0000 (17:21 +0200)]
Provide consistent prototype for swp_pager_meta_free()

This should fix 32bit build breakage.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 months agokboot: Use (void) instead of () for functiosn with no args
Warner Losh [Fri, 9 Dec 2022 14:55:42 +0000 (07:55 -0700)]
kboot: Use (void) instead of () for functiosn with no args

`int foo();` means 'a function that takes any number of arguments.`
not `a function that takes no arguemnts`, that's spelled `int foo(void);`
Adopt the latter.

Sponsored by: Netflix

18 months agoheimdal: kadm5_c_get_principal() should check return code
Cy Schubert [Fri, 9 Dec 2022 14:06:04 +0000 (06:06 -0800)]
heimdal: kadm5_c_get_principal() should check return code

kadm5_c_get_principal() should check the return code from
kadm5_ret_principal_ent(). As it doesn't it assumes success when
there is none and can lead to potential vulnerability. Fix this.

Reported by: rtm@csail.mit.edu
MFC after: 3 days

18 months agoheimdal: Properly ix bus fault when zero-length request received
Cy Schubert [Thu, 8 Dec 2022 23:22:43 +0000 (15:22 -0800)]
heimdal: Properly ix bus fault when zero-length request received

Zero length client requests result in a bus fault when attempting to
free malloc()ed pointers within the requests softc. Return an error
when the request is zero length.

This properly fixes PR/268062 without regressions.

PR: 268062
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

18 months agoRevert "heimdal: Fix bus fault when zero-length request received"
Cy Schubert [Thu, 8 Dec 2022 16:08:50 +0000 (08:08 -0800)]
Revert "heimdal: Fix bus fault when zero-length request received"

This is the wrong fix for PR/268062.

MFC after: immediately

This reverts commit 6742ff42ab3b6e65239f975314060b1393e22d62.

18 months agoposixshm_test: add naive page accounting test
Konstantin Belousov [Sat, 3 Dec 2022 22:54:36 +0000 (00:54 +0200)]
posixshm_test: add naive page accounting test

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agoposixshm_test: small style fixes
Konstantin Belousov [Sat, 3 Dec 2022 22:54:13 +0000 (00:54 +0200)]
posixshm_test: small style fixes

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agoposixshmcontrol(1): for regular shmfd, report used pages number
Konstantin Belousov [Wed, 23 Nov 2022 22:01:05 +0000 (00:01 +0200)]
posixshmcontrol(1): for regular shmfd, report used pages number

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agoshmfd: account for the actually allocated pages
Konstantin Belousov [Wed, 23 Nov 2022 21:26:38 +0000 (23:26 +0200)]
shmfd: account for the actually allocated pages

Return the value as stat(2) st_blocks.

Suggested and reviewed by: markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agotmpfs: for used pages, account really allocated pages, instead of file sizes
Konstantin Belousov [Thu, 20 Oct 2022 13:17:43 +0000 (16:17 +0300)]
tmpfs: for used pages, account really allocated pages, instead of file sizes

This makes tmpfs size accounting correct for the sparce files. Also
correct report st_blocks/va_bytes. Previously the reported value did not
accounted for the swapped out pages.

PR: 223015
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agovm_pager_allocate(): override resulting object type
Konstantin Belousov [Sun, 4 Dec 2022 00:37:28 +0000 (02:37 +0200)]
vm_pager_allocate(): override resulting object type

For dynamically allocated pager type, which inherits the parent's alloc
method, type of the returned object is set to the parent's type
otherwise.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agovm_pager: add method to veto page allocation
Konstantin Belousov [Thu, 20 Oct 2022 13:15:46 +0000 (16:15 +0300)]
vm_pager: add method to veto page allocation

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agovm_pager: add methods for page insertion and removal notifications
Konstantin Belousov [Thu, 20 Oct 2022 12:55:38 +0000 (15:55 +0300)]
vm_pager: add methods for page insertion and removal notifications

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agotmpfs: make vm_object point to the tmpfs node instead of vnode
Konstantin Belousov [Thu, 20 Oct 2022 12:00:21 +0000 (15:00 +0300)]
tmpfs: make vm_object point to the tmpfs node instead of vnode

The vnode could be reclaimed and allocated again during the lifecycle of
the node, but the node cannot.  Also, referencing the node would allow
to reach it and tmpfs mount data from the object, regardless of the
state of the possibly absent vnode.

Still use swp_tmpfs for back-pointer, instead of using handle. Use of
named swap objects would incur taking the sw_alloc_sx on node allocation
and deallocation.

swp_tmpfs is renamed to swp_priv to remove the last bit of tmpfs in vm/.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agoMake swap_pager_freespace() global
Konstantin Belousov [Wed, 26 Oct 2022 22:13:27 +0000 (01:13 +0300)]
Make swap_pager_freespace() global

also make it return the count of the swap pages freed, which are not
simultaneously resident in the object.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agoAdd 'show tmpfs' ddb command
Konstantin Belousov [Thu, 20 Oct 2022 14:30:00 +0000 (17:30 +0300)]
Add 'show tmpfs' ddb command

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agotmpfs: minor style
Konstantin Belousov [Mon, 24 Oct 2022 13:30:38 +0000 (16:30 +0300)]
tmpfs: minor style

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agouiomove_object: hide diagnostic under bootverbose
Konstantin Belousov [Sun, 23 Oct 2022 11:36:17 +0000 (14:36 +0300)]
uiomove_object: hide diagnostic under bootverbose

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37097

18 months agonetlink: add interface notification on link status / flags change.
Alexander V. Chernikov [Sat, 3 Dec 2022 17:10:50 +0000 (17:10 +0000)]
netlink: add interface notification on link status / flags change.

* Add link-state change notifications by subscribing to ifnet_link_event.
 In the Linux netlink model, link state is reported in 2 places: first is
 the IFLA_OPERSTATE, which stores state per RFC2863.
 The second is an IFF_LOWER_UP interface flag. As many applications rely
 on the latter, reserve 1 bit from if_flags, named as IFF_NETLINK_1.
 This flag is mapped to IFF_LOWER_UP in the netlink headers. This is done
 to avoid making applications think this flag is actually
 supported / presented in non-netlink outputs.
* Add flag change notifications, by hooking into rt_ifmsg().
 In the netlink model, notification should include the bitmask for the
 change flags. Update rt_ifmsg() to include such bitmask.

Differential Revision: https://reviews.freebsd.org/D37597

18 months agoMFV: xz 5.2.9
Xin LI [Fri, 9 Dec 2022 07:46:09 +0000 (23:46 -0800)]
MFV: xz 5.2.9

MFC after: 2 weeks

18 months agoVendor import of xz 5.2.9 (trimmed)
Xin LI [Fri, 9 Dec 2022 07:45:12 +0000 (23:45 -0800)]
Vendor import of xz 5.2.9 (trimmed)

18 months agokboot: Allow loading fdt from different sources
Warner Losh [Fri, 9 Dec 2022 05:07:52 +0000 (22:07 -0700)]
kboot: Allow loading fdt from different sources

Linux has /sys/firmware/fdt and /proc/device-tree to publish the dtb for
the system. The former has it all in one file, while the latter breaks
it out. Prefer the former since it's the more modern interface, but
retain both since I don't have a PS3 to test to see if its kernel is new
enough for /sys/firmware or not.

In addition, do the proper fixup.

Sponsored by: Netflix

18 months agokboot: Need to find the ACPI tables
Warner Losh [Fri, 9 Dec 2022 04:56:06 +0000 (21:56 -0700)]
kboot: Need to find the ACPI tables

We need to pass the ACPI tables to the laucnhed kernel (at least for x86
and aarch64). Find it using the Linux standard way.

Sponsored by: Netflix

18 months agovfs: Add spare fileops function pointer slots
Ka Ho Ng [Fri, 9 Dec 2022 01:45:47 +0000 (20:45 -0500)]
vfs: Add spare fileops function pointer slots

This allows backporting of new fileops function pointers while
preserving KBI.

Bump __FreeBSD_version.

Sponsored by: Juniper Networks, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37636

18 months agoman9: Add MLINKS for dpcpu macros
Mark Johnston [Thu, 8 Dec 2022 20:07:53 +0000 (15:07 -0500)]
man9: Add MLINKS for dpcpu macros

MFC after: 1 week

18 months agodtrace tests: Extend the kinst regression test
Mark Johnston [Thu, 8 Dec 2022 20:07:48 +0000 (15:07 -0500)]
dtrace tests: Extend the kinst regression test

Trace a function which disables interrupts.

18 months agokinst: Add per-CPU interrupt trampolines
Mark Johnston [Thu, 8 Dec 2022 20:03:51 +0000 (15:03 -0500)]
kinst: Add per-CPU interrupt trampolines

In the common case, kinst emulates a traced instruction by copying it to
a trampoline, where it is followed by a jump back to the original code,
and pointing the interrupted thread's %rip at the trampoline.  In
particular, the trampoline is executed with the same CPU context as the
original instruction, so if interrupts are enabled at the point where
the probe fires, they will be enabled when the trampoline is
subsequently executed.

It can happen that an interrupt is raised while a thread is executing a
kinst trampoline.  In that case, it is possible that the interrupt
handler will trigger a kinst probe, so we must ensure that the thread
does not recurse and overwrite its trampoline before it is finished
executing the original contents, otherwise an attempt to trace code
called from interrupt handlers can crash the kernel.

To that end, add a per-CPU trampoline, used when the probe fired with
interrupts disabled.  Note that this is not quite complete since it does
not handle the possibility of kinst probes firing while executing an NMI
handler.

Also ensure that we do not trace instructions which set IF, since in
that case it is not clear which trampoline (the per-thread trampoline or
the per-CPU trampoline) we should use, and since such instructions are
rare.

Reported and tested by: Domagoj Stolfa
Reviewed by: christos
Fixes: f0bc4ed144fc ("kinst: Initial revision")
Differential Revision: https://reviews.freebsd.org/D37619

18 months agokinst: Make the provider ops table const
Mark Johnston [Thu, 8 Dec 2022 20:03:41 +0000 (15:03 -0500)]
kinst: Make the provider ops table const

No functional change intended.

18 months agokinst: Correct a comment
Mark Johnston [Thu, 8 Dec 2022 20:03:32 +0000 (15:03 -0500)]
kinst: Correct a comment

Fixes: f0bc4ed144fc ("kinst: Initial revision")

18 months ago[skip ci] improvements to cap_sysctl.3
Alan Somers [Thu, 1 Dec 2022 16:49:57 +0000 (09:49 -0700)]
[skip ci] improvements to cap_sysctl.3

* Correct some function prototypes which were documented with the wrong
  pointer type.
* Clarify return values and requirements for freeing the limit handle.

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D37586

18 months agopkgbase: Stop adding FreeBSD-runtime as a dep for every package
Emmanuel Vadot [Thu, 8 Dec 2022 10:55:39 +0000 (11:55 +0100)]
pkgbase: Stop adding FreeBSD-runtime as a dep for every package

shlib_required/provided is enough for the dependencies and this also
causes problems for packages like rescue which shouldn't depend on runtime
at all.

PR: 268063
Sponsored by: Beckhoff Automation GmbH & Co. KG

18 months agopci_info: update to 2022-12-04
Baptiste Daroussin [Thu, 8 Dec 2022 15:07:54 +0000 (16:07 +0100)]
pci_info: update to 2022-12-04

18 months agoimgact_binmisc: Optionally pre-open the interpreter vnode
Doug Rabson [Thu, 17 Nov 2022 10:48:20 +0000 (10:48 +0000)]
imgact_binmisc: Optionally pre-open the interpreter vnode

This allows the use of chroot and/or jail environments which depend on
interpreters registed with imgact_binmisc to use emulator binaries from
the host to emulate programs inside the chroot.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37432

18 months agoppp: improve MSS clamping
Michael Tuexen [Thu, 8 Dec 2022 08:48:29 +0000 (09:48 +0100)]
ppp: improve MSS clamping

ppp supports MSS clamping for TCP/IPv4. This patch
* improves MSS clamping for TCP/IPv4 by using the MSS as specified
  in RFC 6691.
* adds support for MSS clamping for TCP/IPv6.

Reported by: Timo Voelker
Reviewed by: thj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37624

18 months agoktls_test: Add debug option to hexdump keys, nonces, and buffers.
John Baldwin [Thu, 8 Dec 2022 00:57:28 +0000 (16:57 -0800)]
ktls_test: Add debug option to hexdump keys, nonces, and buffers.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37509

18 months agoatp: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:33:56 +0000 (12:33 -0800)]
atp: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37552

18 months agoif_rsu: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:33:41 +0000 (12:33 -0800)]
if_rsu: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37551

18 months agortwn: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:33:21 +0000 (12:33 -0800)]
rtwn: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37550

18 months agomlx5: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:32:54 +0000 (12:32 -0800)]
mlx5: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: hselasky, imp, emaste (earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37549

18 months agoipfilter: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:32:38 +0000 (12:32 -0800)]
ipfilter: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, cy, emaste
Differential Revision: https://reviews.freebsd.org/D37548

18 months agoaesni: Remove misleading array bounds for aesni_decryt_ecb.
John Baldwin [Wed, 7 Dec 2022 20:32:19 +0000 (12:32 -0800)]
aesni: Remove misleading array bounds for aesni_decryt_ecb.

All the other functions used pointers for from/to instead of
fixed-size array parameters.  More importantly, this function can
accept pointers to buffers of multiple blocks, not just a single
block.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37547

18 months agonet80211: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:53 +0000 (12:31 -0800)]
net80211: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D37546

18 months agoocs: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:33 +0000 (12:31 -0800)]
ocs: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37545

18 months agomalo: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:16 +0000 (12:31 -0800)]
malo: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37544

18 months agoiwi: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:01 +0000 (12:31 -0800)]
iwi: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37543

18 months agoath: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:30:42 +0000 (12:30 -0800)]
ath: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37542

18 months agoudp6: fix build with INET6 and without INVARIANTS
Gleb Smirnoff [Wed, 7 Dec 2022 20:27:15 +0000 (12:27 -0800)]
udp6: fix build with INET6 and without INVARIANTS

Reported by: Michael Butler <imb protected-networks.net>
Fixes: 483fe96511ec02a3f077f9a59f1a96acb3640dea

18 months agotests/netinet: mark more tests that require python
Gleb Smirnoff [Wed, 7 Dec 2022 19:51:49 +0000 (11:51 -0800)]
tests/netinet: mark more tests that require python

18 months agoudp: add protocol method declarations to udp_var.h
Gleb Smirnoff [Wed, 7 Dec 2022 19:51:49 +0000 (11:51 -0800)]
udp: add protocol method declarations to udp_var.h

They are shared between UDP over IPv4 and over IPv6.  To prevent all
possible kernel build failures wrap them in #ifdef _SYS_PROTOSW_H_.
Prompted by feedback from jhb@ and jrtc27@ on c93db4abf454.

18 months agoudp6: inline udp6_output() into udp6_send()
Gleb Smirnoff [Wed, 7 Dec 2022 19:51:48 +0000 (11:51 -0800)]
udp6: inline udp6_output() into udp6_send()

18 months agoudp: inline udp_output() into udp_send()
Gleb Smirnoff [Wed, 7 Dec 2022 19:51:48 +0000 (11:51 -0800)]
udp: inline udp_output() into udp_send()

18 months agoudp: embed inpcb into udpcb
Gleb Smirnoff [Wed, 7 Dec 2022 19:51:42 +0000 (11:51 -0800)]
udp: embed inpcb into udpcb

See similar change to TCP e68b3792440 for more context.  For UDP the
change is much simplier, though.

18 months agoRemove duplicated usr/bin/opieinfo line from ObsoleteFiles.inc
Dimitry Andric [Wed, 7 Dec 2022 19:43:54 +0000 (20:43 +0100)]
Remove duplicated usr/bin/opieinfo line from ObsoleteFiles.inc

MFC after: 3 days

18 months agoAllow site.*.mk to augment local.*.mk and src.*.mk
Simon J. Gerraty [Wed, 7 Dec 2022 19:30:35 +0000 (11:30 -0800)]
Allow site.*.mk to augment local.*.mk and src.*.mk

Add some extra customization points so that FreeBSD build
can be adapted to local requirements.
We use these to minimize changes to share/mk

Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37617

18 months agoboot: Remove stray free()
Warner Losh [Wed, 7 Dec 2022 18:30:04 +0000 (11:30 -0700)]
boot: Remove stray free()

Early versions of this code had a free, but this one doesn't need
it. Remove the forgotten free(vv); from earlier versions.

Fixes: ed56dcfc6b1f
Noticed by: Michael Butler
Sponsored by: Netflix

18 months agostand/kboot: Parse the command line args
Warner Losh [Wed, 7 Dec 2022 17:58:44 +0000 (10:58 -0700)]
stand/kboot: Parse the command line args

Do the standard command line parsing... With a small twist to deal with
the quirks of booting via linuxboot to the initrd from the command line
in shell.efi and other observed oddities.

Sponsored by: Netflix

18 months agostand/efi: remove unused local varaibles
Warner Losh [Wed, 7 Dec 2022 00:42:48 +0000 (17:42 -0700)]
stand/efi: remove unused local varaibles

Remove some unused local variables. No functional change.

Sponsored by: Netflix

18 months agoboot: pass in args as const
Warner Losh [Wed, 7 Dec 2022 00:36:29 +0000 (17:36 -0700)]
boot: pass in args as const

Copy the arg that sets a variable to maximize the reuse of this
routine. There are places we call it from that are const char * and it
might not be safe to cast that away.

Sponsored by: Netflix

18 months agostand/kboot: Remove unneeded include.
Warner Losh [Wed, 7 Dec 2022 17:53:40 +0000 (10:53 -0700)]
stand/kboot: Remove unneeded include.

endian.h isn't needed for this file, so remove it.

Sponsored by: Netflix

18 months agostand/kboot: Initialize all the devices
Warner Losh [Wed, 7 Dec 2022 17:50:35 +0000 (10:50 -0700)]
stand/kboot: Initialize all the devices

main() of the boot loader is expected to call devinit() early. We do
this at the same time we do it in the EFI loader (except we don't have a
buffer cache here, we don't need to initialize time and we don't have
special efi partition handles to enumerate). This is just after we probe
for the console.

Sponsored by: Netflix

18 months agokboot: copy EFI's bootinfo.c and adjust
Warner Losh [Tue, 6 Dec 2022 18:00:08 +0000 (11:00 -0700)]
kboot: copy EFI's bootinfo.c and adjust

Copy EFI's bootinfo.c and make minor adjustments for kboot's needs. Do
not connect this to the build just yet until other pieces are in place.

Sponsored by: Netflix

18 months agokboot: Mark the EFI specific parts of bootinfo.c
Warner Losh [Tue, 6 Dec 2022 17:55:58 +0000 (10:55 -0700)]
kboot: Mark the EFI specific parts of bootinfo.c

bootinfo.c is about to be shared with kboot since they create
substantially similar environments / metadata tagging / etc. Tag this
with #ifdef EFI for the moment until the proper abstracting out can
happen.

Sponsored by: Netflix