]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 months agontp: Update version string
Cy Schubert [Thu, 1 Jun 2023 21:40:00 +0000 (14:40 -0700)]
ntp: Update version string

Chase a466cc55373f, updating the version string in the local config.h.

Reported by:  Trond Endrestol <Trond.Endrestol@ximalas.info>
Fixes: a466cc55373f

(cherry picked from commit 4d780613774c28a1efe4dc6272ae5fbc09d999f4)

13 months agoApply clang fixes for crashes compiling ARM/AArch64 CRC intrinsics
Dimitry Andric [Mon, 29 May 2023 14:27:58 +0000 (16:27 +0200)]
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

(cherry picked from commit 8792c03886d9e6df10fbac825819603dc059c7ea)

13 months agoApply libc++ fix for compiling <type_traits> with clang 16
Dimitry Andric [Sat, 27 May 2023 16:19:37 +0000 (18:19 +0200)]
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

(cherry picked from commit 1f571f8767e6e48e7175cdaa27ed11d0c473d4c2)

13 months agontp: import ntp-4.2.8p16
Cy Schubert [Thu, 1 Jun 2023 14:04:37 +0000 (07:04 -0700)]
ntp: import ntp-4.2.8p16

Security:       NtpBUg3767, NtpBug3808, NtpBug3807 (CVE-2023-26555)

(cherry picked from commit a466cc55373fc3cf86837f09da729535b57e69a1)

13 months agoOpenSSL: Regen manual pages for OpenSSL 1.1.1u
Jung-uk Kim [Tue, 30 May 2023 15:03:10 +0000 (11:03 -0400)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1u

(cherry picked from commit 5b1268252c56d96d3858969108a8cd6add9d5776)

13 months agoOpenSSL: Merge OpenSSL 1.1.1u
Jung-uk Kim [Tue, 30 May 2023 15:14:28 +0000 (11:14 -0400)]
OpenSSL: Merge OpenSSL 1.1.1u

(cherry picked from commit 84ffbd7782d2e98e440782b453f4e64cd1026d33)

13 months agoOpenSSL: Merge OpenSSL 1.1.1u
Jung-uk Kim [Tue, 30 May 2023 14:24:15 +0000 (10:24 -0400)]
OpenSSL: Merge OpenSSL 1.1.1u

(cherry picked from commit 8ecb489345f08012fdc92a202a40119891cac330)
(cherry picked from commit 8f1ef87a6b93af292e68f8e33087e2df6325e9bb)

13 months agolisten(2): fix wrong MFC
Eugene Grosbein [Tue, 30 May 2023 09:27:25 +0000 (16:27 +0700)]
listen(2): fix wrong MFC

Direct commit: fix wrong conflict resolution in previous
MFC: listen(2): improve administrator control over logging

Fixes: 773c91ccc8922c047d3632ae5849cd824992c313

13 months agoMFC: listen(2): improve administrator control over logging
Eugene Grosbein [Sun, 30 Apr 2023 20:14:30 +0000 (03:14 +0700)]
MFC: listen(2): improve administrator control over logging

As documented in listen.2 manual page, the kernel emits a LOG_DEBUG
syslog message if a socket listen queue overflows. For some appliances,
it may be desirable to change the priority to some higher value
like LOG_INFO while keeping other debugging suppressed.

OTOH there are cases when such overflows are normal and expected.
Then it may be desirable to suppress overflow logging altogether,
so that dmesg buffer is not flooded over long run.

In addition to existing sysctl kern.ipc.sooverinterval,
introduce new sysctl kern.ipc.sooverprio that defaults to 7 (LOG_DEBUG)
to preserve current behavior. It may be changed to any value
in a range of 0..7 for corresponding priority or to -1 to suppress logging.
Document it in the listen.2 manual page.

(cherry picked from commit 4824d788725987bccff53dec8c103cbac455b3ed)

13 months agogeli: fix typo
Mariusz Zaborski [Mon, 15 May 2023 08:44:17 +0000 (10:44 +0200)]
geli: fix typo

PR: 271396
Reported by: Tim Chase <freebsd@tim.thechases.com>
MFC after: 1 week

(cherry picked from commit 06db6a9dce81ceb696ee9c542637a4d80e0316a7)

13 months agofusefs: Remove an unused pbuf zone
Mark Johnston [Mon, 22 May 2023 13:33:57 +0000 (09:33 -0400)]
fusefs: Remove an unused pbuf zone

The zone has been dead ever since commit
b9e20197551d ("fusefs: rewrite vop_getpages and vop_putpages")

No functional change intended.

Reviewed by: asomers
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40143

(cherry picked from commit e3f7081b1c54fae55cb443a39c2ad44ac3ed4a75)

13 months agoloader.efi: Fix some arm64 PE metadata
Mark Johnston [Tue, 18 Apr 2023 18:32:04 +0000 (14:32 -0400)]
loader.efi: Fix some arm64 PE metadata

- Mark the file as an executable in the COFF header.
- Provide separate .text and .data sections.
- Provide sane file and section alignment values.  These values are the
  defaults defined in the PE specification.
- Set appropriate characteristics for each of .text and .data.

This is required for the MS devkit to load our UEFI image.

Obtained from: OpenBSD via allanjude
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D37765

(cherry picked from commit 21d56b796634bda628b149c717461bf88c23677d)

13 months agolibthr rtld locks: do not leak URWLOCK_READ_WAITERS into child
Konstantin Belousov [Sat, 20 May 2023 08:11:54 +0000 (11:11 +0300)]
libthr rtld locks: do not leak URWLOCK_READ_WAITERS into child

PR: 271490

(cherry picked from commit 6f49eafb056cfa0703dfc97a731cabe4ed2596b8)

13 months agonvmecontrol: Fix power subcommand output.
Alexander Motin [Mon, 15 May 2023 20:48:50 +0000 (16:48 -0400)]
nvmecontrol: Fix power subcommand output.

The returned value consists of two fields.  Report them separately.

MFC after: 2 weeks

(cherry picked from commit f409f11bc556e6da4c4cdb9f20a2ba3b0977fb32)

13 months agoLinuxKPI: Use modern function declarations for kernel_fpu_begin/end.
John Baldwin [Sat, 27 May 2023 19:32:41 +0000 (12:32 -0700)]
LinuxKPI: Use modern function declarations for kernel_fpu_begin/end.

This fixes a -Wstrict-prototype error from GCC 12.

This is a direct commit to stable/13 as it was fixed differently in
main.

13 months agoRevert "LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag."
John Baldwin [Sat, 27 May 2023 19:23:20 +0000 (12:23 -0700)]
Revert "LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag."

This broke part of the KBI used by drm-kmod.

This reverts commit 8ca78eb03fd4b3c9f514ea6c075fc44dc9c02d27.

Reported by: manu

13 months agoroute.8: mention DXR in FIB_ALGO section
Marko Zec [Sat, 27 May 2023 08:31:42 +0000 (10:31 +0200)]
route.8: mention DXR in FIB_ALGO section

While here, add a sentence describing DPDK DIR24-8 principle of
operation.

MFC after: 7 days

13 months agoRELNOTES: Add an entry for the NFS "syskrb5" mount option
Rick Macklem [Fri, 26 May 2023 23:05:00 +0000 (16:05 -0700)]
RELNOTES: Add an entry for the NFS "syskrb5" mount option

13 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Fri, 26 May 2023 21:37:23 +0000 (14:37 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Reinstall MFC commit 4660b60a00c as it has should now work correctly
with fix for CGSIZE macro in MFC 4a3834e31fd.

13 months agoFix size differences between architectures of the UFS/FFS CGSIZE macro value.
Kirk McKusick [Mon, 15 May 2023 19:56:27 +0000 (12:56 -0700)]
Fix size differences between architectures of the UFS/FFS CGSIZE macro value.

Reported-by: Tijl Coosemans
Tested-by: Tijl Coosemans and Peter Holm
Sponsored-by: The FreeBSD Foundation
(cherry picked from commit 0a6e34e950cd5889122a199c34519b67569be9cc)

13 months agoFix typo in sys/conf/kern.mk's InitAll warning message
Dimitry Andric [Tue, 23 May 2023 17:56:41 +0000 (19:56 +0200)]
Fix typo in sys/conf/kern.mk's InitAll warning message

I missed this one in commit 3006f6df025f.

Fixes: 3006f6df025f
MFC after: 3 days

(cherry picked from commit 3741ffdb14ae6915abfa55307f3e964492b272c3)

13 months agoEnable -ftrivial-auto-var-init flags for gcc >= 12
Dimitry Andric [Tue, 23 May 2023 17:43:12 +0000 (19:43 +0200)]
Enable -ftrivial-auto-var-init flags for gcc >= 12

Now that gcc >= 12 supports -ftrivial-auto-var-init, add it to
bsd.compiler.mk's "init-all" feature.

PR: 271047
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40208

(cherry picked from commit c32736222cdd92e1497d1154d81c9005757fb308)

13 months agoUpdate -ftrivial-auto-var-init flags for clang >= 16
Dimitry Andric [Tue, 23 May 2023 17:40:36 +0000 (19:40 +0200)]
Update -ftrivial-auto-var-init flags for clang >= 16

As of clang 16, the -ftrivial-auto-var-init=zero option no longer needs
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
to enable the option. Only add it for older clang versions.

PR: 271047
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40208

(cherry picked from commit 3006f6df025f3afd0fb3cca1b820cdac1f1ed4c9)

13 months agobsd.compiler.mk: Add a c++20 compiler feature.
John Baldwin [Sat, 19 Nov 2022 04:11:59 +0000 (20:11 -0800)]
bsd.compiler.mk: Add a c++20 compiler feature.

This is enabled for clang versions 10+ and GCC versions 10+.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36892

(cherry picked from commit 063b380f54b04eaab8ee26e39d6e8128523d16ad)

13 months agomount_nfs.8: Update man page for the "syskrb5" option
Rick Macklem [Tue, 11 Apr 2023 19:17:09 +0000 (12:17 -0700)]
mount_nfs.8: Update man page for the "syskrb5" option

Commit 896516e54a8c added a new NFS mount option
used for Kerberized NFSv4.1/4.2 mounts. It specifies that
AUTH_SYS be used for state maintenance (also called system)
operations. This allows the mount to be done without the
"gssname" option or a valid Kerberos TGT being held by the
user doing the mount (so it can be specified in fstab(5) for
example).

This is a content change.

(cherry picked from commit 61330e494f63ab60a515e3273668a03a7e8b4fee)

13 months agonfscl: Make coverity happy
Rick Macklem [Wed, 29 Mar 2023 00:08:45 +0000 (17:08 -0700)]
nfscl: Make coverity happy

Coverity does not like code that checks a function's
return value sometimes.  Add "(void)" in front of the
function when the return value does not matter to try
and make it happy.

A recent commit deleted "(void)"s in front of nfsm_fhtom().
This commit puts them back in.

(cherry picked from commit 695d87bae1ec826fcf796f99b9de9cdd8c37fb8c)

13 months agonfscl: Add a new NFSv4.1/4.2 mount option for Kerberized mounts
Rick Macklem [Thu, 16 Mar 2023 22:55:36 +0000 (15:55 -0700)]
nfscl: Add a new NFSv4.1/4.2 mount option for Kerberized mounts

Without this patch, a Kerberized NFSv4.1/4.2 mount must provide
a Kerberos credential for the client at mount time.  This credential
is typically referred to as a "machine credential".  It can be
created one of two ways:
- The user (usually root) has a valid TGT at the time the mount
  is done and this becomes the machine credential.
  There are two problems with this.
  1 - The user doing the mount must have a valid TGT for a user
      principal at mount time.  As such, the mount cannot be put
      in fstab(5) or similar.
  2 - When the TGT expires, the mount breaks.
- The client machine has a service principal in its default keytab
  file and this service principal (typically called a host-based
  initiator credential) is used as the machine credential.
  There are problems with this approach as well:
  1 - There is a certain amount of administrative overhead creating
      the service principal for the NFS client, creating a keytab
      entry for this principal and then copying the keytab entry
      into the client's default keytab file via some secure means.
  2 - The NFS client must have a fixed, well known, DNS name, since
      that FQDN is in the service principal name as the instance.

This patch uses a feature of NFSv4.1/4.2 called SP4_NONE, which
allows the state maintenance operations to be performed by any
authentication mechanism, to do these operations via AUTH_SYS
instead of RPCSEC_GSS (Kerberos).  As such, neither of the above
mechanisms is needed.

It is hoped that this option will encourage adoption of Kerberized
NFS mounts using TLS, to provide a more secure NFS mount.

This new NFSv4.1/4.2 mount option, called "syskrb5" must be used
with "sec=krb5[ip]" to avoid the need for either of the above
Kerberos setups to be done by the client.

Note that all file access/modification operations still require
users on the NFS client to have a valid TGT recognized by the
NFSv4.1/4.2 server.  As such, this option allows, at most, a
malicious client to do some sort of DOS attack.

Although not required, use of "tls" with this new option is
encouraged, since it provides on-the-wire encryption plus,
optionally, client identity verification via a X.509
certificate provided to the server during TLS handshake.
Alternately, "sec=krb5p" does provide on-the-wire
encryption of file data.

A mount_nfs(8) man page update will be done in a separate commit.

(cherry picked from commit 896516e54a8c39c1c8be3ad918f38fbf196b57ed)

13 months agopfsync tests: check for the correct IP address
Kristof Provost [Thu, 18 May 2023 19:37:48 +0000 (21:37 +0200)]
pfsync tests: check for the correct IP address

When checking if the state synced over we should look for
198.51.100.254, not 198.51.100.2. The test worked because the incorrect
address is a substring of the correct one, but we should fix it anyway.

Reported by: Naman Sood <naman@freebsdfoundation.org>
MFC after: 1 week

(cherry picked from commit 0d574d8ba8b244f40c1484123c5042f49ac642b8)

13 months agonfsd.c: Log a more meaningful failure message
Rick Macklem [Wed, 22 Feb 2023 22:09:15 +0000 (14:09 -0800)]
nfsd.c: Log a more meaningful failure message

For the cases where the nfsd(8) daemon is already running or
has failed to start within a prison due to an incorrect prison
configuration, the failure message logged is:
  Can't read stable storage file: operation not permitted

This patch replaces the above with more meaningful messages.
It depends on commit 10dff9da9748 to differentiate between the
above two cases, however even without this commit, the messages
should be an improvement.

(cherry picked from commit fe5c211ba87315b098769a7e6d50b41f00f6fed4)

13 months agonfsd: Return ENXIO instead of EPERM when nfsd(8) already running
Rick Macklem [Wed, 22 Feb 2023 21:19:07 +0000 (13:19 -0800)]
nfsd: Return ENXIO instead of EPERM when nfsd(8) already running

The nfsd(8) daemon generates an error message that does not
indicate that the nfsd daemon is already running when the nfssvc(2)
syscall fails for the NFSSVC_STABLERESTART.  Also, the check for
running nfsd(8) in a vnet prison will return EPERM when it fails.

This patch replaces EPERM with ENXIO so that the nfsd(8) daemon
can generate more reasonable failure messages.  The nfsd(8) daemon
will be patched in a future commit.

(cherry picked from commit 10dff9da9748b0eadd2d02dded3afd2321d15537)

13 months agonfsd: Fix NFSv3 Readdir/ReaddirPlus reply for large i-node numbers
Rick Macklem [Fri, 5 May 2023 22:43:55 +0000 (15:43 -0700)]
nfsd: Fix NFSv3 Readdir/ReaddirPlus reply for large i-node numbers

If the i-node number (d_fileno) for a file on the server did
not fit in 32bits, it would be truncated to the low order 32bits
for the NFSv3 Readdir and ReaddirPlus RPC replies.
This is no longer correct, given that ino_t is now 64bits.

This patch fixes this by sending the full 64bits of d_fileno
on the wire in the NFSv3 Readdir/ReaddirPlus RPC reply.

PR: 271174

(cherry picked from commit 648a208ef3a171585f3446464646832f0e0ed3dc)

13 months agoRELNOTES: Add an entry for nfsd running in a vnet jail
Rick Macklem [Mon, 22 May 2023 18:42:39 +0000 (11:42 -0700)]
RELNOTES: Add an entry for nfsd running in a vnet jail

13 months agomountd.8: Update for mountd running in jails
Rick Macklem [Mon, 20 Mar 2023 22:16:03 +0000 (15:16 -0700)]
mountd.8: Update for mountd running in jails

Mountd can now be run in an appropriately
configured vnet jail.

This man page update adds some information
for this case.

This is a content change.

(cherry picked from commit 9432e798fc6daaad341a496e9abcf9e3b760a63b)

13 months agonfsd.8: Update for nfsd running in jails
Rick Macklem [Wed, 29 Mar 2023 21:58:47 +0000 (14:58 -0700)]
nfsd.8: Update for nfsd running in jails

Nfsd can now be run in an appropriately
configured vnet jail.

This man page update adds some information
for this case.

This is a content change.

(cherry picked from commit a1254dcaa869bba20e46d966c53c7473bb24d02b)

13 months agojail.8: Update the allow.nfsd section
Rick Macklem [Tue, 14 Mar 2023 22:28:02 +0000 (15:28 -0700)]
jail.8: Update the allow.nfsd section

This patch updates the information for "allow.nfsd"
and adds configuration information.

This is a content change.

(cherry picked from commit c0f94fee0bdddcc07f216f9723544f78ace5155a)

13 months agojail.8: Update the man page for allow.nfsd
Rick Macklem [Sat, 17 Dec 2022 21:54:33 +0000 (13:54 -0800)]
jail.8: Update the man page for allow.nfsd

Commit bba7a2e89602 added "allow.nfsd" to optionally allow
mountd/nfsd to be run inside a vnet prison when the kernel
is built with "options VNET_NFSD".

This patch updates the man page for this change.

This is a content change.

(cherry picked from commit d4b4f3b9c356938de6140ccea20d502d207b18a7)

13 months agorc.d: Fix NFS server startup scripts to enable vnet prison use
Rick Macklem [Sun, 12 Mar 2023 21:34:25 +0000 (14:34 -0700)]
rc.d: Fix NFS server startup scripts to enable vnet prison use

Now that commit cbbb22031f9b is in main,
it is possible to run nfsd(8), nfsuserd(8), mountd(8),
gssd(8) and rpc.tlsservd(8) in an appropriately configured vnet
prison if the "allow.nfsd" option is specified in jail.conf.

This patch fixes the rc scripts for this.
Mostly just replaces the "nojail" KEYWORD with "nojailvnet",
but also avoids setting vfs.nfsd.srvmaxio in a prison, since it
must be set outside of the prisons and applies to all
nfsd(8) instances.

(cherry picked from commit 0bb08f21cc5c62d0e2dfcea500521fa801058dd3)

14 months agokern_jail.c: Remove #ifdefs for VNET_NFSD
Rick Macklem [Thu, 2 Mar 2023 21:13:24 +0000 (13:13 -0800)]
kern_jail.c: Remove #ifdefs for VNET_NFSD

The consensus was that VNET_NFSD was not needed.
This patch removes it from kern_jail.c.

With this patch, support for the "allow.nfsd"
jail parameter is enabled in the kernel for
kernels built with "options VIMAGE".

(cherry picked from commit cbbb22031f9b957967c03dc8e685392f7d7e7fb8)

14 months agovfs_mount.c: Allow mountd(8) to do exports in a vnet prison
Rick Macklem [Thu, 2 Mar 2023 21:09:01 +0000 (13:09 -0800)]
vfs_mount.c: Allow mountd(8) to do exports in a vnet prison

To run mountd in a vnet prison, three checks in vfs_domount()
and vfs_domount_update() related to doing exports needed
to be changed, so that a file system visible within the
prison but mounted outside the prison can be exported.

I did all three in a minimal way, only changing the checks for
the specific case of a process (typically mountd) doing exports
within a vnet prison and not updating the mount point in other
ways.  The changes are:
- Ignore the error return from vfs_suser(), since the file
  system being mounted outside the prison will cause it to fail.
- Use the priv_check(PRIV_NFS_DAEMON) for this specific case
  within a prison.
- Skip the call to VFS_MOUNT(), since it will return an error,
  due to the "from" argument not being set correctly.  VFS_MOUNT()
  does not appear to do anything for the case of doing exports only.

(cherry picked from commit 4bbbd5875d32f3cbe76235d90243f713eff9b9d0)

14 months agovfs_export: Add mnt_exjail to control exports done in prisons
Rick Macklem [Tue, 21 Feb 2023 21:00:42 +0000 (13:00 -0800)]
vfs_export: Add mnt_exjail to control exports done in prisons

If there are multiple instances of mountd(8) (in different
prisons), there will be confusion if they manipulate the
exports of the same file system.  This patch adds mnt_exjail
to "struct mount" so that the credentials (and, therefore,
the prison) that did the exports for that file system can
be recorded.  If another prison has already exported the
file system, vfs_export() will fail with an error.
If mnt_exjail == NULL, the file system has not been exported.
mnt_exjail is checked by the NFS server, so that exports done
from within a different prison will not be used.

The patch also implements vfs_exjail_destroy(), which is
called from prison_cleanup() to release all the mnt_exjail
credential references, so that the prison can be removed.
Mainly to avoid doing a scan of the mountlist for the case
where there were no exports done from within the prison,
a count of how many file systems have been exported from
within the prison is kept in pr_exportcnt.

Changing the new argument for vfs_export() to "int" and
moving the prototype for vfs_exjail_delete() to jail.h
were both necessary to allow libprocstat to build.

(cherry picked from commit 88175af8b75ea8850757cc9dca68b6d336b82675)

14 months agoFix off-by-one error in fsck_ffs(8) chkrange() block-number check.
Kirk McKusick [Tue, 9 May 2023 20:08:10 +0000 (13:08 -0700)]
Fix off-by-one error in fsck_ffs(8) chkrange() block-number check.

PR:           271289

(cherry picked from commit b3fe5d932264445cbf9a1c4eab01afb6179b499b)

14 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sat, 29 Apr 2023 18:52:27 +0000 (11:52 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

(cherry picked from commit a2d1957bbcc87b499526df8d99ec7e1ddd2193c0)

14 months agonewfs: fix up 32-bit compile
Mateusz Guzik [Sun, 30 Apr 2023 18:00:20 +0000 (18:00 +0000)]
newfs: fix up 32-bit compile

(cherry picked from commit a50ef47c0a22ca87cdbe669acbcbf999c72b8439)

14 months agoAdditional validity checking in newfs(8).
Kirk McKusick [Sat, 29 Apr 2023 19:49:50 +0000 (12:49 -0700)]
Additional validity checking in newfs(8).

(cherry picked from commit 62dc21b10731bdba26dafeb51640c2048a3344a0)

14 months agoYet another try to fix printf format conflict.
Kirk McKusick [Sun, 30 Apr 2023 06:59:45 +0000 (23:59 -0700)]
Yet another try to fix printf format conflict.

(cherry picked from commit 2e7797cd9bba4fa82391b53a7dd7aac074baf716)

14 months agoFix printf format conflict
Kirk McKusick [Sun, 30 Apr 2023 00:55:15 +0000 (17:55 -0700)]
Fix printf format conflict

(cherry picked from commit 6995e6b3237e9be9ae6f68af13edd3db4b668ab8)

14 months agoAdditional output from dumpfs(8).
Kirk McKusick [Sat, 29 Apr 2023 18:41:23 +0000 (11:41 -0700)]
Additional output from dumpfs(8).

(cherry picked from commit 04997e19e27b240f9fd253f3eb1053708ca99c51)

14 months agoRevert "vfs_export: Add mnt_exjail to control exports done in prisons"
Rick Macklem [Fri, 19 May 2023 21:38:20 +0000 (14:38 -0700)]
Revert "vfs_export: Add mnt_exjail to control exports done in prisons"

Revert this commit until I can figure out build issue.

This reverts commit 202d52261b92abdfb1ec39564ee1be3812bcdf92.

14 months agoRevert "vfs_mount.c: Allow mountd(8) to do exports in a vnet prison"
Rick Macklem [Fri, 19 May 2023 21:36:52 +0000 (14:36 -0700)]
Revert "vfs_mount.c: Allow mountd(8) to do exports in a vnet prison"

Revert this commit until I can figure out build issue.

This reverts commit 527e6b02d65db8d6294b1e66f7bd063899a4de02.

14 months agoRevert "kern_jail.c: Remove #ifdefs for VNET_NFSD"
Rick Macklem [Fri, 19 May 2023 21:34:58 +0000 (14:34 -0700)]
Revert "kern_jail.c: Remove #ifdefs for VNET_NFSD"

Revert this commit until I can figure out build issue.

This reverts commit eb6588af1585f4c2d7a1a4df6bae164bd6a063a6.

14 months agokern_jail.c: Remove #ifdefs for VNET_NFSD
Rick Macklem [Thu, 2 Mar 2023 21:13:24 +0000 (13:13 -0800)]
kern_jail.c: Remove #ifdefs for VNET_NFSD

The consensus was that VNET_NFSD was not needed.
This patch removes it from kern_jail.c.

With this patch, support for the "allow.nfsd"
jail parameter is enabled in the kernel for
kernels built with "options VIMAGE".

(cherry picked from commit cbbb22031f9b957967c03dc8e685392f7d7e7fb8)

14 months agovfs_mount.c: Allow mountd(8) to do exports in a vnet prison
Rick Macklem [Thu, 2 Mar 2023 21:09:01 +0000 (13:09 -0800)]
vfs_mount.c: Allow mountd(8) to do exports in a vnet prison

To run mountd in a vnet prison, three checks in vfs_domount()
and vfs_domount_update() related to doing exports needed
to be changed, so that a file system visible within the
prison but mounted outside the prison can be exported.

I did all three in a minimal way, only changing the checks for
the specific case of a process (typically mountd) doing exports
within a vnet prison and not updating the mount point in other
ways.  The changes are:
- Ignore the error return from vfs_suser(), since the file
  system being mounted outside the prison will cause it to fail.
- Use the priv_check(PRIV_NFS_DAEMON) for this specific case
  within a prison.
- Skip the call to VFS_MOUNT(), since it will return an error,
  due to the "from" argument not being set correctly.  VFS_MOUNT()
  does not appear to do anything for the case of doing exports only.

(cherry picked from commit 4bbbd5875d32f3cbe76235d90243f713eff9b9d0)

14 months agovfs_export: Add mnt_exjail to control exports done in prisons
Rick Macklem [Tue, 21 Feb 2023 21:00:42 +0000 (13:00 -0800)]
vfs_export: Add mnt_exjail to control exports done in prisons

If there are multiple instances of mountd(8) (in different
prisons), there will be confusion if they manipulate the
exports of the same file system.  This patch adds mnt_exjail
to "struct mount" so that the credentials (and, therefore,
the prison) that did the exports for that file system can
be recorded.  If another prison has already exported the
file system, vfs_export() will fail with an error.
If mnt_exjail == NULL, the file system has not been exported.
mnt_exjail is checked by the NFS server, so that exports done
from within a different prison will not be used.

The patch also implements vfs_exjail_destroy(), which is
called from prison_cleanup() to release all the mnt_exjail
credential references, so that the prison can be removed.
Mainly to avoid doing a scan of the mountlist for the case
where there were no exports done from within the prison,
a count of how many file systems have been exported from
within the prison is kept in pr_exportcnt.

mnt_exjail replaces mnt_pad0 and should not change the size
of "struct mount" nor change the offsets of the other fields
in "struct mount".  As such, it should be safe to MFC.

(cherry picked from commit 88175af8b75ea8850757cc9dca68b6d336b82675)

14 months agoix(4): correct max MTU
Piotr Kubaj [Wed, 17 May 2023 10:16:22 +0000 (12:16 +0200)]
ix(4): correct max MTU

The max MTU for the ix(4) is 9710.

Differential revision: https://reviews.freebsd.org/D40003
Approved by: erj, bcr

(cherry picked from commit 2e57f7bf209281e176f16ca3c5716807479873f8)

14 months agopkg(7): now that we do use libmd, use it completly
Baptiste Daroussin [Thu, 9 Mar 2023 20:29:15 +0000 (21:29 +0100)]
pkg(7): now that we do use libmd, use it completly

Use SHA256_Fd and SHA256_Data instead of home made equivalent.
wrap those functions into hash.c to avoid header collition between
openssl and libmd

Suggested by: kevans

(cherry picked from commit e5dd5bfa55dc82686870330f547932486ba48db2)

14 months agopkg(7): use libmd for sha256 instead of openssl
Baptiste Daroussin [Thu, 9 Mar 2023 16:38:30 +0000 (17:38 +0100)]
pkg(7): use libmd for sha256 instead of openssl

OpenSSL 3.0 has deprecated the sha256 api, let's use libmd which has the
same API instead.

In order to avoid the collision in definitions (sha256.h cannot be
included in the same file as a file where openssl headers has been
included) let's move the sha256 related code in its own file

PR: 270023
Reported by: ngie

(cherry picked from commit b2654064c2d11a1ee36667b3ff8b0f4d2536af74)

14 months agopci_vendors: update to 2023-05-15
Baptiste Daroussin [Wed, 25 Jan 2023 08:58:39 +0000 (09:58 +0100)]
pci_vendors: update to 2023-05-15

(cherry picked from commit bc4346e0aead0b934773aac5e9a81def46f266ad)
(cherry picked from commit f02879f199253125adfa9de6c651bbe30c04bfa5)
(cherry picked from commit c7fdf87b0985de602827cfb2a8ccb3aebaf42318)

14 months agopasswd.5: Update man page after e0155c6989049da43c5499f7129002aa17d1ca79
Jose Luis Duran [Tue, 16 May 2023 11:17:16 +0000 (11:17 +0000)]
passwd.5: Update man page after e0155c6989049da43c5499f7129002aa17d1ca79

MFC After: 3 days

(cherry picked from commit 6e068d6bea4d8282704b4e157da3da584dc67a2d)

14 months agopasswd.5: Remove .Tn (Trade Name) macros
Jose Luis Duran [Tue, 16 May 2023 11:18:53 +0000 (11:18 +0000)]
passwd.5: Remove .Tn (Trade Name) macros

To appease mandoc -T lint, remove .Tn macros.

MFC After: 3 days

(cherry picked from commit d047a4e486a44ca5ada29bf3461903867424c414)

14 months agopw: The pw_checkname function has added ';' checking.
pbuff [Tue, 16 May 2023 03:05:30 +0000 (11:05 +0800)]
pw: The pw_checkname function has added ';' checking.

The pw_checkname function forgot to include a ';'
when checking usernames, causing shell commands
to be executed when a username with a ';' is deleted.

PR: 271427
MFC After: 3 days

(cherry picked from commit e0155c6989049da43c5499f7129002aa17d1ca79)

14 months agoperiodic: Use locale-agnostic (ISO 8601) timestamp format
Michael Osipov [Thu, 4 May 2023 12:35:59 +0000 (14:35 +0200)]
periodic: Use locale-agnostic (ISO 8601) timestamp format

Instead of reyling on locale-sensitive output which can be mangled when e-mailed
use consistently ISO 8601 format which contains the same information as '-T'.

PR: 271240
MFC After: 3 days

(cherry picked from commit d2b4753f06dcabc090080b8c8c91bda00fc8dac3)

14 months agodma: install a simple example for the auth.conf file
Peter Wright [Mon, 15 May 2023 07:18:40 +0000 (09:18 +0200)]
dma: install a simple example for the auth.conf file

PR: 270088
MFC After: 3 days

(cherry picked from commit d904b43ba3ffe2201f2c5aabcdc1af7709601d9a)

14 months agopw: do not call system()
Baptiste Daroussin [Mon, 15 May 2023 06:55:08 +0000 (08:55 +0200)]
pw: do not call system()

Calling system makes pw(8) spawn a shell, which can then be abused.

MFC After: 3 days

(cherry picked from commit ef7d0eb9489f39169a1ae83c576fe74e40d126ad)

14 months agosh(1): fix history file write checking
Daniel Kolesa [Mon, 20 Mar 2023 16:42:59 +0000 (17:42 +0100)]
sh(1): fix history file write checking

We cannot just compare histsizeval() against 0, since that returns
a string pointer, which is always non-zero (non-null). The logic
in sethistsize() initializes the history size to 100 with values
that are non-number, and an empty string counts as that. Therefore,
the only time we want to not write into history with HISTSIZE val
set is when it's explicitly 0.

MFC after: 2 weeks

(cherry picked from commit 3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1)

14 months agosvc_rpcsec_gss.c: Separate out the non-vnet initialization
Rick Macklem [Wed, 1 Mar 2023 23:29:25 +0000 (15:29 -0800)]
svc_rpcsec_gss.c: Separate out the non-vnet initialization

Without this patch, a single initialization function was
used to initialize both the vnet'd and non-vnet'd data.
This patch separates out the non-vnet'd initializations
into a separate function invoked by SYSINIT().
This avoids use of IS_DEFAULT_VNET() in the initialization
functions and also configures the non-vnet'd initialization
function to be called first, although ordering is not
currently needed.

(cherry picked from commit 57ff348804f98d956f2e203b665de5a8989dbf8c)

14 months agonfsd: Fix a use after free when vnet prisons are deleted
Rick Macklem [Fri, 24 Feb 2023 15:36:28 +0000 (07:36 -0800)]
nfsd: Fix a use after free when vnet prisons are deleted

The Kasan tests show the nfsrvd_cleancache() results
in a modify after free. I think this occurs because the
nfsrv_cleanup() function gets executed after nfs_cleanup()
which free's the nfsstatsv1_p.

This patch makes them use the same subsystem and sets
SI_ORDER_FIRST for nfs_cleanup(), so that it will be called
after nfsrv_cleanup() via VNET_SYSUNINIT().

The patch also sets nfsstatsv1_p NULL after free'ng it,
so that a crash will result if it is used after free'ng.

(cherry picked from commit 4036fcb8053adf3ac54c8428eef0dd076dfc1718)

14 months agonfscommon: Use IS_DEFAULT_VNET() in the vnet initialization
Rick Macklem [Tue, 21 Feb 2023 03:43:37 +0000 (19:43 -0800)]
nfscommon: Use IS_DEFAULT_VNET() in the vnet initialization

Another oopsie.  The vnet initialization function in
nfs_commonport.c for initializing prison0 by testing
curthread->td_ucred->cr_prison == &prison0. This is bogus
and always true.  Replace it with IS_DEFAULT_VNET(curvnet).

(cherry picked from commit ef4e8f0cf91f7009745d5a7a90d3bdd2d9e25780)

14 months agonfsd: Add VNET_SYSUNINIT() macros for vnet cleanup
Rick Macklem [Mon, 20 Feb 2023 21:11:22 +0000 (13:11 -0800)]
nfsd: Add VNET_SYSUNINIT() macros for vnet cleanup

Commit ed03776ca7f4 enabled the vnet front end macros.
As such, for kernels built with the VIMAGE option will malloc
data and initialize locks on a per-vnet basis, typically
via a VNET_SYSINIT().

This patch adds VNET_SYSUNINIT() macros to do the frees
of the per-vnet malloc'd data and destroys of per-vnet
locks.  It also removes the mtx_lock/mtx_unlock calls
from nfsrvd_cleancache(), since they are not needed.

(cherry picked from commit ef6fcc5e2b0714c859d2e4ba23a55b1fd12f8a4e)

14 months agonfsd: Enable the NFSD_VNET vnet front end macros
Rick Macklem [Sat, 18 Feb 2023 22:59:36 +0000 (14:59 -0800)]
nfsd: Enable the NFSD_VNET vnet front end macros

Several commits have added front end macros for the vnet
macros to the NFS server, krpc and kgssapi.  These macros
are now null, but this patch changes them to front end
the vnet macros.

With this commit, many global variables in the code become
vnet'd, so that nfsd(8), nfsuserd(8), rpc.tlsservd(8) and
gssd(8) can run in a vnet prison, once enabled.
To run the NFS server in a vnet prison still requires a
couple of patches (in D37741 and D38371) that allow mountd(8)
to export file systems from within a vnet prison.  Once
these are committed to main, a small patch to kern_jail.c
allowing "allow.nfsd" without VNET_NFSD defined will allow
the NFS server to run in a vnet prison.

One area that still needs to be settled is cleanup when a
prison is removed.  Without this, everything should work
except there will be a leak of malloc'd data and mutex locks
when a vnet prison is removed.

(cherry picked from commit ed03776ca7f43de8275da80cfa89a9ecc4732f82)

14 months agoUPDATING: Update release name and handbook link
Graham Perrin [Thu, 18 May 2023 14:13:04 +0000 (08:13 -0600)]
UPDATING: Update release name and handbook link

Pull-Request: https://github.com/freebsd/freebsd-src/pull/714
Reviewed-by: imp
14 months agoMFV: less v632.
Xin LI [Tue, 2 May 2023 03:43:57 +0000 (20:43 -0700)]
MFV: less v632.

(cherry picked from commit d713e0891ff9ab8246245c3206851d486ecfdd37)

14 months agokrpc: Remove VNET_NFSD #ifdefs
Rick Macklem [Tue, 14 Feb 2023 21:53:39 +0000 (13:53 -0800)]
krpc: Remove VNET_NFSD #ifdefs

The consensus is that the VNET_NFSD kernel option is not
needed, so this commit removes its use from the kernel RPC.

(cherry picked from commit 364391a9bb5eb85af5f711a952ba40a4b1f768da)

14 months agonfscommon: Revert use of nfsstatsv1_p in nfs_commonkrpc.c
Rick Macklem [Fri, 17 Feb 2023 01:44:19 +0000 (17:44 -0800)]
nfscommon: Revert use of nfsstatsv1_p in nfs_commonkrpc.c

Commit 9d329bbc9aea converted a lot of accesses to nfsstatsv1
to use nfsstatsv1_p instead.  However, the accesses in
nfs_commonkrpc.c are for client side and should not be
converted.  This patch puts them back in the correct
pre-commit 9d329bbc9aea form.

(cherry picked from commit a63b5d488badce9298e4272da2d5344e9f83a13d)

14 months agonfscl: Add NFSD_CURVNET macros to nfsclient syscall
Rick Macklem [Tue, 21 Feb 2023 00:40:07 +0000 (16:40 -0800)]
nfscl: Add NFSD_CURVNET macros to nfsclient syscall

Although the nfsclient syscall is used for client side,
it does set up server side krpc for callbacks.  As such,
it needs to have the vnet set.  This patch does this.
Without this patch, the system would crash when the
nfscbd(8) daemon was killed.

(cherry picked from commit 357492c99597d13bc966441f30bb44f6ef659f08)

14 months agokrpc: Replace !jailed() with IS_DEFAULT_VNET()
Rick Macklem [Thu, 16 Feb 2023 22:32:50 +0000 (14:32 -0800)]
krpc: Replace !jailed() with IS_DEFAULT_VNET()

Since svcpool_create() is now called from an initialization function,
!jailed() no longer works.  Replace it with IS_DEFAULT_VNET().

(cherry picked from commit 780bae23b8e6c386e4b2f971eb27fa3bd1a6edd1)

14 months agokrpc: Allow mountd/nfsd to optionally run in a jail
Rick Macklem [Sun, 18 Dec 2022 20:40:48 +0000 (12:40 -0800)]
krpc: Allow mountd/nfsd to optionally run in a jail

This patch modifies the kernel RPC so that it will allow
mountd/nfsd to run inside of a vnet jail.  Running mountd/nfsd
inside a vnet jail will be enabled via a new kernel build
option called VNET_NFSD, which will be implemented in future
commits.

Although I suspect cr_prison can be set from the credentials
of the current thread unconditionally, I #ifdef'd the code
VNET_NFSD and only did this for the jailed case mainly to
document that it is only needed for use in a jail.

The TLS support code has not yet been modified to work in
a jail.  That is planned as future development after the
basic VNET_NFSD support is in the kernel.

This patch should not result in any semantics change until
VNET_NFSD is implemented and used in a kernel configuration.

(cherry picked from commit 6a76d35cac8e1549f74bd4cdceccc2ee52c8e556)

14 months agonfsd: Continue adding macros so nfsd can run in a vnet prison
Rick Macklem [Sun, 12 Feb 2023 21:52:13 +0000 (13:52 -0800)]
nfsd: Continue adding macros so nfsd can run in a vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more of them.

(cherry picked from commit ab0440af75ba0c2dbf263c5441ccbe4058515fff)

14 months agokgssapi: Add macros so that gssd(8) can run in vnet prison
Rick Macklem [Wed, 15 Feb 2023 23:18:46 +0000 (15:18 -0800)]
kgssapi: Add macros so that gssd(8) can run in vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds similar macros named KGSS_VNETxxx so that
the gssd(8) daemon can run in a vnet prison, once the
macros front end the vnet ones.  For now, they are null macros.

This is the last commit that adds macros.  The next step is
to change the macros to front end the vnet ones.

(cherry picked from commit 2894c8c96b9b94f35aaa27ee5ef3ac11c276fe3f)

14 months agokrpc: Add macros so that rpc.tlsservd can run in vnet prison
Rick Macklem [Wed, 15 Feb 2023 13:58:21 +0000 (05:58 -0800)]
krpc: Add macros so that rpc.tlsservd can run in vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds similar macros named KRPC_VNETxxx so that
the rpc.tlsservd(8) daemon can run in a vnet prison, once the
macros front end the vnet ones.  For now, they are null macros.

(cherry picked from commit 6444662a563ba714fed8563645764262c6f5e90f)

14 months agoprison_check_nfsd: Add check for enforce_statfs != 0
Rick Macklem [Thu, 2 Feb 2023 00:02:20 +0000 (16:02 -0800)]
prison_check_nfsd: Add check for enforce_statfs != 0

Since mountd(8) will not be able to do exports
when running in a vnet prison if enforce_statfs is
set to 0, add a check for this to prison_check_nfsd().

(cherry picked from commit 99187c3a44c2c3e168e462a30d45af075748195f)

14 months agokern_jail.c: Allow mountd/nfsd to optionally run in a jail
Rick Macklem [Sat, 17 Dec 2022 21:43:49 +0000 (13:43 -0800)]
kern_jail.c: Allow mountd/nfsd to optionally run in a jail

This patch adds "allow.nfsd" to the jail code based on a
new kernel build option VNET_NFSD.  This will not work
until future patches fix nmount(2) to allow mountd to
run in a vnet prison and the NFS server code is patched
so that global variables are in a vnet.

The jail(8) man page will be patched in a future commit.

(cherry picked from commit bba7a2e89602e6745bb2ec474f5ab714aef49f42)

14 months agomrsas: Fix a typo in a source code comment
Zhenlei Huang [Fri, 28 Apr 2023 10:01:58 +0000 (18:01 +0800)]
mrsas: Fix a typo in a source code comment

- s/feild/field/

MFC after: 3 days

(cherry picked from commit bbfb244724e25933d7c7cf68b943e0c2a7d6e381)

14 months agomps: Fix a typo in a source code comment
Zhenlei Huang [Fri, 28 Apr 2023 10:01:58 +0000 (18:01 +0800)]
mps: Fix a typo in a source code comment

- s/feild/field/

MFC after: 3 days

(cherry picked from commit 5bcbdb0b2eb4c14ef0a8671c996337acdefb7f72)

14 months agoixgbe: Fix typos in source code comments
Ian Moffett [Fri, 28 Apr 2023 10:01:58 +0000 (18:01 +0800)]
ixgbe: Fix typos in source code comments

- s/feilds/fields/

Reviewed by: zlei
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/707

(cherry picked from commit 99cb088f1a2513ad71225b9691e0aed09ba8fafe)

14 months agoelf.5: Fix conjugation of holds
Zhenlei Huang [Tue, 25 Apr 2023 10:21:52 +0000 (18:21 +0800)]
elf.5: Fix conjugation of holds

MFC after: 1 week

(cherry picked from commit 6f96b5487f4359199ceb8339d2d7063e2249f538)

14 months agoip_mroute: Delete unreachable code
Zhenlei Huang [Sun, 23 Apr 2023 04:47:57 +0000 (12:47 +0800)]
ip_mroute: Delete unreachable code

As the flag M_WAITOK is passed to ip_encap_attach(), then the function
will never return NULL, and the following code within NULL check branch
will be unreachable.

No functional change intended.

Reviewed by: kp
Fixes: 6d8fdfa9d5e7d Rework IP encapsulation handling code
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39746

(cherry picked from commit b658c0fce10a06493dc468fc9f6699120473e17b)

14 months agoif_stf: Delete unreachable code
Zhenlei Huang [Sun, 23 Apr 2023 04:47:57 +0000 (12:47 +0800)]
if_stf: Delete unreachable code

As the flag M_WAITOK is passed to ip_encap_attach(), then the function
will never return NULL, and the following code within NULL check branch
will be unreachable.

No functional change intended.

Reviewed by: kp
Fixes: 6d8fdfa9d5e7d Rework IP encapsulation handling code
MFC after: 1 week
Differential Revision:  https://reviews.freebsd.org/D39746

(cherry picked from commit c373e1d6adbc3785e8f1072cdc4a062733baa514)

14 months agonfs_fha_new: Fix nfs_fha_new so that sysctls work in prisons
Rick Macklem [Wed, 1 Mar 2023 23:25:35 +0000 (15:25 -0800)]
nfs_fha_new: Fix nfs_fha_new so that sysctls work in prisons

The sysctls were in "struct fha_params", making it impractical
to vnet them.  This patch moves the sysctls out of "struct fha_params"
and vnet's them, so that they are available in vnet prisons
running nfsd(8).  It also avoids the IS_DEFAULT_VNET() macros
in the VNET_SYSINIT() function.

(cherry picked from commit a90b47abcbdbd48c68fbf7c407546293479056de)

14 months agonfsd: Add NFSD_VNET() macros to nfs_fha_new.c
Rick Macklem [Sat, 18 Feb 2023 15:45:38 +0000 (07:45 -0800)]
nfsd: Add NFSD_VNET() macros to nfs_fha_new.c

Although it is not 100% obvious if the affinity threads
lists need to be vnet'd when nfsd runs in a prison, I
think it is necessary for the unusual case where the
same file system is exported in multiple prisons.
For this case, the affinity code might try to assign
the RPC to a svc thread that runs in a different prison.
Also, it makes sense to vnet them, since there are
separate svc threads for each prison running nfsd(8).

This patch adds the macros for vnet'ng to nfs_fha_new.c.
The macros are still null, so the only semantics change
is malloc'ng the fha_param structure.

(cherry picked from commit cd406ac94d8beae7f184adb14a3c94e058366b9a)

14 months agonfsd: Get rid of useless "pool" field in nfs_fha_new.c
Rick Macklem [Fri, 17 Feb 2023 15:34:40 +0000 (07:34 -0800)]
nfsd: Get rid of useless "pool" field in nfs_fha_new.c

Since svcpool_create() is now called from an initialization function,
the pool field of fha_params is always non-NULL, so just get
rid of it and the useless check for it being NULL.

(cherry picked from commit b99c419587db2ac75b929637f61ec3b845d7b5f6)

14 months agofreebsd-update: Fix merging already-updated files
Colin Percival [Fri, 5 May 2023 03:00:58 +0000 (20:00 -0700)]
freebsd-update: Fix merging already-updated files

When performing an "upgrade" (moving between FreeBSD releases, as
opposed to "update" which merely applies security/errata updates
to the installed release) FreeBSD Update:

1. Generates a list of "files needing to be merged", namely those
files which don't match the version installed in the "old" release
and have paths matching the MergeChanges configuration directive
(by default, /boot/device.hints and everything under /etc/).

and later on,

2. Compares the currently-installed files to the versions in the
"new" release, removing index entries for files which "don't need
to be updated because they're not changing".

Unfortunately if a file falls into both of these categories -- that
is to say, if a file in /etc/ is the same as the version in the new
release and not the same as the version in the old release -- the
resulting "merge" step saw that the file was no longer listed as
being part of the new release, resulting in the file being deleted.

For the first 18 years of FreeBSD Update's existence, this never
happened, since $FreeBSD$ tags resulted in "new release" files
always being different from any files systems would already have
installed.

This commit fixes this behaviour by only placing a file into the
"files needing to be merged" list if it does not match the version
in the old release *or* the version in the new release.

Reported by: des
Reviewed by: delphij (earlier version), des, emaste
MFC after: 7 days
X-EN-Candidate: yes
Differential Revision: https://reviews.freebsd.org/D39973

(cherry picked from commit c55b7e522629cb78adeb54bd9964304481d55eab)

14 months agonfsd: Continue adding macros so nfsd can run in a vnet prison
Rick Macklem [Tue, 14 Feb 2023 21:33:35 +0000 (13:33 -0800)]
nfsd: Continue adding macros so nfsd can run in a vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more, to allow the nfsuserd(8) daemon to
run in vnet prison, once the macros map to vnet ones.
This is the last commit for NFSD_VNET_xxx macros, but there are
still some for KRPC_VNET_xxx and KGSS_VNET_xx to allow the
rpc.tlsservd(8) and gssd(8) daemons to run in a vnet prison.

(cherry picked from commit f0db2b6022dfa15f375f5fcdd278b9df21cb88f5)

14 months agonfsd: Wrap nfsstatsv1_p in the NFSD_VNET() macro
Rick Macklem [Thu, 16 Feb 2023 01:39:07 +0000 (17:39 -0800)]
nfsd: Wrap nfsstatsv1_p in the NFSD_VNET() macro

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
The nfsstatsv1_p variable got missed.  This patch wraps all
uses of nfsstatsv1_p with the NFSD_VNET() macro.
The NFSD_VNET() macro is still a null macro.

(cherry picked from commit b039ca0776774036a9e33aa45f50296a7f6ba547)

14 months agonfsd: Continue adding macros so nfsd can run in a vnet prison
Rick Macklem [Mon, 13 Feb 2023 23:07:17 +0000 (15:07 -0800)]
nfsd: Continue adding macros so nfsd can run in a vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more of them and also a lot of uses of
nfsstatsv1_p instead of nfsstatsv1. nfsstatsv1_p points to
nfsstatsv1 for prison0, but will point to a malloc'd structure
for other prisons.

It also puts nfsstatsv1_p in nfscommon.ko instead of nfsd.ko.

(cherry picked from commit 9d329bbc9aea6b8f47df251072bc65403ac3e43e)

14 months agoacpi_ged: New driver to ACPI generic event device
Takanori Watanabe [Tue, 18 Oct 2022 05:41:53 +0000 (14:41 +0900)]
acpi_ged:  New driver to ACPI generic event device

New driver to ACPI generic event device, defined in ACPI spec.
Some ACPI power button may not work without this.

In qemu arm64 with "virt" machine, with ACPI firmware,
enable devd check devd message by
and invoke following command in qemu monitor
(qemu) system_powerdown
and make sure some power button input event appear.
(setting sysctl hw.acpi.power_button_state=S5 is not work,
because ACPI tree does not have \_S5 object.)

Reviewed by: andrew, hrs
Differential Revision: https://reviews.freebsd.org/D37032
(cherry-picked from a9880bfe1181b7a32d026339bae113f24300e5e1)

acpi_ged: fix build, as module and non INTRNG case.

Reviewed-by: cy
Differential Revision: https://reviews.freebsd.org/D37104
(cherry-picked from 9cf5db63698b3c73edd632412bf68735d3c20d37)
acpi_ged: fix build with ACPI_DEBUG
(cherry-picked from ba23f762ece54a86f64b8ef62bbfc9c73c98762c)

Make it compile for 13-stable.

14 months agosmp_topo(): correct allocation sizes for trivial topologies
Konstantin Belousov [Tue, 9 May 2023 15:08:22 +0000 (18:08 +0300)]
smp_topo(): correct allocation sizes for trivial topologies

(cherry picked from commit 361c8f75a61832d9aa3dd4c589a0220f3467466f)

14 months agosmp_topo(): make it idempotent
Konstantin Belousov [Sun, 7 May 2023 18:37:42 +0000 (21:37 +0300)]
smp_topo(): make it idempotent

(cherry picked from commit d0f67f97579f7b2febf29264b1874a95056dec06)

14 months agosmp_topo: dynamically allocate group array
Konstantin Belousov [Fri, 5 May 2023 20:24:22 +0000 (23:24 +0300)]
smp_topo: dynamically allocate group array

(cherry picked from commit 9801e7c275f6ec42a44b98a2e2e1a8ac4674a096)

14 months agoquiesce_cpus(): do not overallocate generation array
Konstantin Belousov [Fri, 5 May 2023 20:21:38 +0000 (23:21 +0300)]
quiesce_cpus(): do not overallocate generation array

(cherry picked from commit ccc6b87b3825a235991d978e43d29431e012461f)

14 months agonfsd: Fix initialization broken by 7344856e3a6d
Rick Macklem [Sun, 12 Feb 2023 17:16:56 +0000 (09:16 -0800)]
nfsd: Fix initialization broken by 7344856e3a6d

Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d did change where things are initialized
and one of the initialization functions was not being called
early enough.  This patch moves nfsrvd_init(0) to the
function called via (VNET_)SYSINIT() to fix this.

(cherry picked from commit fcfdb76e12fb3cdf584e6f06e56e7c48ec475cc6)