]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
22 months agoFFS: truncate write if it would exceed the fs max file size or RLIMIT_FSIZE
Konstantin Belousov [Sun, 18 Sep 2022 11:48:40 +0000 (14:48 +0300)]
FFS: truncate write if it would exceed the fs max file size or RLIMIT_FSIZE

PR: 164793

(cherry picked from commit 87525ef94007c792c6745db7938251a663ca5706)

22 months agoAdd vn_rlimit_fsizex() and vn_rlimit_fsizex_res()
Konstantin Belousov [Sun, 18 Sep 2022 11:46:19 +0000 (14:46 +0300)]
Add vn_rlimit_fsizex() and vn_rlimit_fsizex_res()

PR: 164793

(cherry picked from commit 1b4b75171ee3f2213b7671878a910fd5ddb3306e)

22 months agotmpfs: disallow truncation to set file size past RLIMIT_FSIZE
Konstantin Belousov [Sun, 18 Sep 2022 13:28:11 +0000 (16:28 +0300)]
tmpfs: disallow truncation to set file size past RLIMIT_FSIZE

PR: 164793

(cherry picked from commit b5b16659c5aceb9caa0a9b76c7746e1d12a505ce)

22 months agomsdosfs: disallow truncation to set file size past RLIMIT_FSIZE
Konstantin Belousov [Sun, 18 Sep 2022 11:51:03 +0000 (14:51 +0300)]
msdosfs: disallow truncation to set file size past RLIMIT_FSIZE

PR: 164793

(cherry picked from commit 701b73858e3afa15d8ca2ea4aa480173ccc5960e)

22 months agoUFS: disallow truncation to set file size past RLIMIT_FSIZE
Konstantin Belousov [Sun, 18 Sep 2022 11:49:57 +0000 (14:49 +0300)]
UFS: disallow truncation to set file size past RLIMIT_FSIZE

PR: 164793

(cherry picked from commit 70385088cafaab3365c5243f22b8fc9c712c1fde)

22 months agoAdd vn_rlimit_trunc()
Konstantin Belousov [Sun, 18 Sep 2022 19:52:13 +0000 (22:52 +0300)]
Add vn_rlimit_trunc()

(cherry picked from commit 2ac083f60f8c9ce361c3daf691c60486459d87ae)

22 months agofilesystems: return error from vn_rlimit_fsize() instead of EFBIG
Konstantin Belousov [Sun, 18 Sep 2022 14:44:49 +0000 (17:44 +0300)]
filesystems: return error from vn_rlimit_fsize() instead of EFBIG

(cherry picked from commit cc65a412ae226136e6207bdc8db4722dab99982f)

22 months agotmpfs_subr.c: some style
Konstantin Belousov [Sun, 18 Sep 2022 13:20:24 +0000 (16:20 +0300)]
tmpfs_subr.c: some style

(cherry picked from commit 0f01fb01c2de3e2c9ce8719750aea379c402ece6)

22 months agolibc: Fix size range check in setvbuf
Ed Maste [Mon, 3 Oct 2022 18:24:42 +0000 (14:24 -0400)]
libc: Fix size range check in setvbuf

From enh at google.com via openbsd-tech mailing list via pfg@:

The existing test is wrong for LP64, where size_t has twice as many
relevant bits as int, not just one. (Found by inspection by
rprichard.)

(cherry picked from commit 9515313b26beb005a521aff2e6edd4d75cd010da)

23 months agovmstat: remove processor counting from getcpuinfo()
Elliott Mitchell [Thu, 29 Sep 2022 16:27:24 +0000 (09:27 -0700)]
vmstat: remove processor counting from getcpuinfo()

(cherry picked from commit 42dc8696df5e3004ea65fd315aba500d269dbcbf)

23 months agosshd: update the libwrap patch to drop connections early
Gleb Smirnoff [Mon, 3 Jan 2022 02:32:30 +0000 (18:32 -0800)]
sshd: update the libwrap patch to drop connections early

OpenSSH has dropped libwrap support in OpenSSH 6.7p in 2014
(f2719b7c in github.com/openssh/openssh-portable) and we
maintain the patch ourselves since 2016 (a0ee8cc636cd).

Over the years, the libwrap support has deteriotated and probably
that was reason for removal upstream.  Original idea of libwrap was
to drop illegitimate connection as soon as possible, but over the
years the code was pushed further down and down and ended in the
forked client connection handler.

The negative effects of late dropping is increasing attack surface
for hosts that are to be dropped anyway.  Apart from hypothetical
future vulnerabilities in connection handling, today a malicious
host listed in /etc/hosts.allow still can trigger sshd to enter
connection throttling mode, which is enabled by default (see
MaxStartups in sshd_config(5)), effectively casting DoS attack.
Note that on OpenBSD this attack isn't possible, since they enable
MaxStartups together with UseBlacklist.

A only negative effect from early drop, that I can imagine, is that
now main listener parses file in /etc, and if our root filesystems
goes bad, it would get stuck.  But unlikely you'd be able to login
in that case anyway.

Implementation details:

- For brevity we reuse the same struct request_info.  This isn't
  a documented feature of libwrap, but code review, viewing data
  in a debugger and real life testing shows that if we clear
  RQ_CLIENT_NAME and RQ_CLIENT_ADDR every time, it works as intended.
- We set SO_LINGER on the socket to force immediate connection reset.
- We log message exactly as libwrap's refuse() would do.

Differential revision: https://reviews.freebsd.org/D33044

(cherry picked from commit ca573c9a1779bdeeea6d0a6e948676555977737e)

23 months agossh-keysign: fix double free in error path
Ed Maste [Tue, 4 Oct 2022 20:34:15 +0000 (16:34 -0400)]
ssh-keysign: fix double free in error path

From OpenSSH-portable commit 141535b904b6, OpenBSD commit 3d21aa127b1f.

MFC after: 3 days

(cherry picked from commit 963c7b084b8bf2397deced4f568b976a42611910)

23 months agossh-keygen: fix double free in error path
Ed Maste [Tue, 4 Oct 2022 20:31:39 +0000 (16:31 -0400)]
ssh-keygen: fix double free in error path

From OpenSSH-portable commit 5062ad48814b, OpenBSD commit 39f35e16ba87.

MFC after: 3 days

(cherry picked from commit 666605ad2df3f5c1fb973dbd719ffbe3f3935c1d)

23 months agossh-keyscan: Strictly enforce the maximum allowed SSH2 banner size
Ed Maste [Tue, 4 Oct 2022 20:28:13 +0000 (16:28 -0400)]
ssh-keyscan: Strictly enforce the maximum allowed SSH2 banner size

From OpenSSH-portable commit ff89b1bed807, OpenBSD commit 6ae664f9f4db.

MFC after: 3 days

(cherry picked from commit 5e5ebbee81bfd1c034caffa00d58d4e06e1b26ee)

23 months agossh: drop $FreeBSD$ from crypto/openssh
Ed Maste [Fri, 22 Apr 2022 23:05:44 +0000 (19:05 -0400)]
ssh: drop $FreeBSD$ from crypto/openssh

After we moved to git $FreeBSD$ is no longer expanded and serves no
purpose.  Remove them from OpenSSH to reduce diffs against upstream.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 835ee05f3c754d905099a3500f421dc01fab028f)

23 months agossh: update to OpenSSH v9.0p1
Ed Maste [Fri, 15 Apr 2022 14:41:08 +0000 (10:41 -0400)]
ssh: update to OpenSSH v9.0p1

Release notes are available at https://www.openssh.com/txt/release-9.0

Some highlights:

 * ssh(1), sshd(8): use the hybrid Streamlined NTRU Prime + x25519 key
   exchange method by default ("sntrup761x25519-sha512@openssh.com").
   The NTRU algorithm is believed to resist attacks enabled by future
   quantum computers and is paired with the X25519 ECDH key exchange
   (the previous default) as a backstop against any weaknesses in
   NTRU Prime that may be discovered in the future. The combination
   ensures that the hybrid exchange offers at least as good security
   as the status quo.

 * sftp-server(8): support the "copy-data" extension to allow server-
   side copying of files/data, following the design in
   draft-ietf-secsh-filexfer-extensions-00. bz2948

 * sftp(1): add a "cp" command to allow the sftp client to perform
   server-side file copies.

This commit excludes the scp(1) change to use the SFTP protocol by
default; that change will immediately follow.

MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 87c1498d1a7473ff983e5c0456f30608f3f1e601)
(cherry picked from commit 9fce8d4140370ca8bc03d6a5668fb64a040c00fc)
(cherry picked from commit e2cec5ba2c4385eec0b76d07469ec11d3ce3d6e2)

23 months agossh: update to OpenSSH v8.9p1
Ed Maste [Wed, 13 Apr 2022 20:00:56 +0000 (16:00 -0400)]
ssh: update to OpenSSH v8.9p1

Release notes are available at https://www.openssh.com/txt/release-8.9

Some highlights:

 * ssh(1), sshd(8), ssh-add(1), ssh-agent(1): add a system for
   restricting forwarding and use of keys added to ssh-agent(1)

 * ssh(1), sshd(8): add the sntrup761x25519-sha512@openssh.com hybrid
   ECDH/x25519 + Streamlined NTRU Prime post-quantum KEX to the
   default KEXAlgorithms list (after the ECDH methods but before the
   prime-group DH ones). The next release of OpenSSH is likely to
   make this key exchange the default method.

 * sshd(8), portable OpenSSH only: this release removes in-built
   support for MD5-hashed passwords. If you require these on your
   system then we recommend linking against libxcrypt or similar.

Future deprecation notice
=========================

A near-future release of OpenSSH will switch scp(1) from using the
legacy scp/rcp protocol to using SFTP by default.

Legacy scp/rcp performs wildcard expansion of remote filenames (e.g.
"scp host:* .") through the remote shell. This has the side effect of
requiring double quoting of shell meta-characters in file names
included on scp(1) command-lines, otherwise they could be interpreted
as shell commands on the remote side.

MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1323ec571215a77ddd21294f0871979d5ad6b992)
(cherry picked from commit 58def461e256e3a05c3ff15a87ed702fe0c3662c)

23 months agonfscl: Fix parameter order in the calls to MGET().
Zhenlei Huang [Fri, 23 Sep 2022 21:04:36 +0000 (15:04 -0600)]
nfscl: Fix parameter order in the calls to MGET().

(cherry picked from commit 8b43388c745ebb42414496f2925f47acac662c2f)

23 months agoipfilter/libipf: printpool_live() consumer ignores return code
Cy Schubert [Thu, 22 Sep 2022 18:26:23 +0000 (11:26 -0700)]
ipfilter/libipf: printpool_live() consumer ignores return code

The single consumer of printpool_live() ignores the return code.
Avoid wasting resources on this.

(cherry picked from commit 00d8a28f19b21ce2955c0cf24a040824ec506da5)

23 months agoipfilter/ippool: Return error code when listing a pool fails
Cy Schubert [Thu, 22 Sep 2022 13:00:09 +0000 (06:00 -0700)]
ipfilter/ippool: Return error code when listing a pool fails

When an internal or other error occurs during the listing of a pool,
return an error code when extiting ippool(8). Printing an error to
stderr without returning an error code is useless in shell scripts.

(cherry picked from commit 5568c8b2c58a65a07b42af0e09c3fc619f13316c)

23 months agoipfilter/ippool: Dump a copy of ippool in ippool.conf format
Cy Schubert [Wed, 21 Sep 2022 15:33:11 +0000 (08:33 -0700)]
ipfilter/ippool: Dump a copy of ippool in ippool.conf format

Add an ippool(8) option to dump a copy of the inm-memory ippool tables
in an ippool(5) format so that it can be reloaded using ippool -f.

(cherry picked from commit 7531c434a593b2f369d69c85551e7ad1ebb7499a)

23 months agopowerpc: slb_alloc_user_cache: fix missing uma_zalloc wait flag
Alfredo Dal'Ava Junior [Mon, 3 Oct 2022 23:22:14 +0000 (20:22 -0300)]
powerpc: slb_alloc_user_cache: fix missing uma_zalloc wait flag

Flags should be M_WAITOK | M_ZERO instead of just M_ZERO

Reviewed by: markj
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D36865

(cherry picked from commit ff80ab1cebd61d08598fd248fb6e70782ba72e4a)

23 months agopowerpc: cpuset: add local functions for copyin/copyout
Alfredo Dal'Ava Junior [Mon, 3 Oct 2022 14:51:05 +0000 (11:51 -0300)]
powerpc: cpuset: add local functions for copyin/copyout

Add local functions to workaround an instruction segment trap (panic)
when the indirect functions copyin and copyout are called by an external
loadable kernel module (i.e. pfsync, zfs and linuxulator). The crash
was triggered by change 47a57144af25a7bd768b29272d50a36fdf2874ba, but
kernel binary linked with LLD 9 works fine. LLVM bisect points that LLD
behavior chaged after dc06b0bc9ad055d06535462d91bfc2a744b2f589.

This is know to affect powerpc targets only and the final fix is still
being discussed with the LLVM community.

PR: 266730
Reviewed by: luporl, jhibbits (on IRC, previous version)
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D36234

(cherry picked from commit db79bf75ac9eb1b5678ccbaebb45fb88c0e0e1e3)

23 months agopowerpcspe: make GEOM_LABEL kernel built-in
Alfredo Dal'Ava Junior [Tue, 2 Aug 2022 21:11:11 +0000 (18:11 -0300)]
powerpcspe: make GEOM_LABEL kernel built-in

Make powerpspe kernel config in sync with other targets making
GEOM_LABEL built-in to allow use of labels when mounting partitions.

MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

(cherry picked from commit 8b57548e9a38ffbb122947043bafabb92b037fb3)

23 months agonfs: skip bootpc when vfs.root.mountfrom is other than nfs
Alfredo Dal'Ava Junior [Tue, 31 May 2022 19:03:43 +0000 (16:03 -0300)]
nfs: skip bootpc when vfs.root.mountfrom is other than nfs

If "vfs.root.mountfrom" is set and the value is something other
than "nfs:*", it means the user doesn't want to mount root via nfs,
there's no reason to continue with bootpc

This fixes the powerpcspe kernel (MPC85XXSPE) that's compiled with
BOOTP_NFSROOT by default and gets stuck on bootpc/dhcp request loop
when no DHCP server is available on the network, even when user
specifies a local disk via "vfs.root.mountfrom" kernel parameter.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D35098

(cherry picked from commit 3cb9f1976c260821e43e6eae9d46e4ec97a8d4f1)

23 months agostand: Unbreak FAT32 in loader
Michael Gmelin [Wed, 7 Sep 2022 16:56:49 +0000 (18:56 +0200)]
stand: Unbreak FAT32 in loader

This corrects an issue introduced in b4cb3fe0e39a3, where a freshly
allocated `DOS_FS` structure would not be initialized properly before
use in `dos_open`.

In case of FAT32 file systems, this would leave `fs->dirents`
uninitialized and - depending on its content and due to checks in
`parsebs` - prevent mounting the file system successfully.

This particularily impacted the EFI loader, as it was sometimes not
able to read files from a FAT32-formatted EFI partition, including
LoaderEnv (`/efi/freebsd/loader.env`).

Accepted by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36482

(cherry picked from commit 0eb736c0f673d2804a0c8c14fa1e4eae228ab6d2)

23 months agostand: Parse all arguments passed by UEFI
Michael Gmelin [Mon, 5 Sep 2022 15:56:11 +0000 (17:56 +0200)]
stand: Parse all arguments passed by UEFI

Approved by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36457

(cherry picked from commit 2b3543dbb1b3fa7c2280d71c017e3e0304e77d54)

23 months agofile: fix test case for gpkg by removing the extra \n.
Xin LI [Sat, 1 Oct 2022 05:45:32 +0000 (22:45 -0700)]
file: fix test case for gpkg by removing the extra \n.

(cherry picked from commit c5e957ad4fe63c90fccc7051ba2a4cb1fe140a75)

23 months agoscandir(3): Rename alphasort_thunk to scandir_thunk_cmp to
Xin LI [Mon, 26 Sep 2022 02:01:46 +0000 (19:01 -0700)]
scandir(3): Rename alphasort_thunk to scandir_thunk_cmp to
reflect that it is not alphasort-specific.

Reported by: emaste
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D36708

(cherry picked from commit 45ff071ddccac0a158cfeb53285e6bb2df6bc835)

23 months agoamd64: Initialize IPI scoreboard earlier
Konstantin Belousov [Fri, 17 Dec 2021 04:28:11 +0000 (06:28 +0200)]
amd64: Initialize IPI scoreboard earlier

(cherry picked from commit 648fa3558c161a1d8564626d21047710c3fbfdf6)

23 months agounbound: Adjust version string
Cy Schubert [Sat, 1 Oct 2022 13:48:37 +0000 (06:48 -0700)]
unbound: Adjust version string

Sync version string with contrib.

Reported by: "Herbert J. Skuhra" <herbert@gojira.at>
Fixes: 4f5c8956cff4

(cherry picked from commit 35d60ac2e5bdb63ea8c6e08caca699dede8674e6)

23 months agopowerpc64: tell kernel when radix is not available
Leandro Lupori [Fri, 22 Oct 2021 16:44:21 +0000 (13:44 -0300)]
powerpc64: tell kernel when radix is not available

If CAS detects that radix is not supported, set radix_mmu to 0
to avoid the kernel trying to use it and panic.

Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

(cherry picked from commit a23e18ea545675aca7551ef2395f6df40a3acb29)

23 months agopowerpc64: make radix with superpages default
Leandro Lupori [Thu, 14 Oct 2021 16:13:27 +0000 (13:13 -0300)]
powerpc64: make radix with superpages default

As Radix MMU with superpages enabled is now stable, make it the
default choice on supported hardware (POWER9 and above), since its
performance is greater than that of HPT MMU.

Reviewed by: alfredo, jhibbits
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D30797

(cherry picked from commit 8ecf9a8bab608c26cb100f393b24e883a706ff03)

23 months agopowerpc64: fix radix on pseries TLB invalidation
Leandro Lupori [Wed, 8 Sep 2021 11:37:11 +0000 (08:37 -0300)]
powerpc64: fix radix on pseries TLB invalidation

When running in a virtualized environment, TLB invalidations can only
be performed on process scope, as only the hypervisor is allowed to
invalidate a global scope, or else a Program Interrupt is triggered.

Since we are here, also make sure that the register process table
hypercall returns success.

Reviewed by: jhibbits
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D31775

(cherry picked from commit 4f7c436548ea1cc935c4f4b237693fbe8ed7939a)

23 months agopowerpc/pseries: Allow radix pmap in pseries for ISA 3.0
Justin Hibbits [Thu, 12 Aug 2021 00:03:27 +0000 (19:03 -0500)]
powerpc/pseries: Allow radix pmap in pseries for ISA 3.0

ISA 3.0 allows for nested radix translations with minimal to no
involvement of the hypervisor.  This should make pseries signficantly
faster on POWER9 pseries instances, as fewer hypercalls are needed to
manage pmap now.

Relnotes: yes

(cherry picked from commit 5ae48eb998ad5d41118d2df62cf28b92d6864e24)

23 months agopowerpc64le: fix boot when using QEMU PowerNV
Leandro Lupori [Thu, 25 Nov 2021 19:41:46 +0000 (16:41 -0300)]
powerpc64le: fix boot when using QEMU PowerNV

When using QEMU PowerNV with latest op-build release (v2.7), its
kexec transfers control to FreeBSD kernel in BE mode, causing an
instant exception on LE kernels. Make kboot able to detect and
swap endian to fix this.

Reviewed by: imp
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33104

(cherry picked from commit e141b62d208867fc5bdb5803d05f5496260722ac)

23 months agozfs: merge openzfs/zfs@6a6bd4939 (zfs-2.1-release) into stable/13
Martin Matuska [Tue, 4 Oct 2022 15:52:09 +0000 (17:52 +0200)]
zfs: merge openzfs/zfs@6a6bd4939 (zfs-2.1-release) into stable/13

OpenZFS release 2.1.6

Notable upstream pull requeset merges:
  #11733 ICP: Add missing stack frame info to SHA asm files
  #12274 Optimize txg_kick() process
  #12284 Add Module Parameter Regarding Log Size Limit
  #12285 Introduce a tunable to exclude special class buffers from L2ARC
  #12287 Remove refcount from spa_config_*()
  #12425 Avoid small buffer copying on write
  #12516 Fix NFS and large reads on older kernels
  #12678 spa.c: Replace VERIFY(nvlist_*(...) == 0) with fnvlist_*
  #12789 Improve log spacemap load time
  #13022 Add more control/visibility and speedup spa_load_verify()
  #13106 add physical device size to SIZE column in 'zpool list -v'
  #13388 Improve mg_aliquot math
  #13405 Revert "Reduce dbuf_find() lock contention"
  #13452 More speculative prefetcher improvements
  #13476 Refactor Log Size Limit
  #13540 AVL: Remove obsolete branching optimizations
  #13553 Reduce ZIO io_lock contention on sorted scrub
  #13555 Scrub mirror children without BPs
  #13563 FreeBSD: Improve crypto_dispatch() handling
  #13576 Several sorted scrub optimizations
  #13579 Fix and disable blocks statistics during scrub
  #13582 Several B-tree optimizations
  #13591 Avoid two 64-bit divisions per scanned block
  #13606 Avoid memory copies during mirror scrub
  #13613 Avoid memory copy when verifying raidz/draid parity
  #13643 Fix scrub resume from newly created hole
  #13756 FreeBSD: Mark ZFS_MODULE_PARAM_CALL as MPSAFE
  #13767 arcstat: fix -p option
  #13781 Importing from cachefile can trip assertion
  #13794 Apply arc_shrink_shift to ARC above arc_c_min
  #13798 Improve too large physical ashift handling
  #13811 Fix column width in 'zpool iostat -v' and 'zpool list -v'
  #13842 make DMU_OT_IS_METADATA and DMU_OT_IS_ENCRYPTED return B_TRUE
         or B_FALSE
  #13855 zfs recv hangs if max recordsize is less than received
         recordsize
  #13861 Fix use-after-free in btree code
  #13865 vdev_draid_lookup_map() should not iterate outside draid_maps
  #13878 Delay ZFS_PROP_SHARESMB property to handle it for encrypted
         raw receive
  #13882 FreeBSD: Fix integer conversion for vnlru_free{,_vfsops}()
  #13885 Fix incorrect size given to bqueue_enqueue() call in dmu_redact.c
  #13908 FreeBSD: stop passing LK_INTERLOCK to VOP_LOCK
  #13930 zpool: Don't print "repairing" on force faulted drives
  #13954 Fix bad free in skein code

Obtained from: OpenZFS
OpenZFS tag: zfs-2.1.6
OpenZFS commit: 6a6bd493988c75331deab06e5352a9bed035a87d
Relnotes: yes

23 months agocheck/delete-old: Fix /bin/rmail removal condition
Dmitry Chagin [Thu, 21 Jul 2022 22:20:25 +0000 (01:20 +0300)]
check/delete-old: Fix /bin/rmail removal condition

When WITHOUT_SENDMAIL is enabled and WITHOUT_MAILWRAPPER is disabled
we install /bin/rmail as a link to the /usr/sbin/mailwrapper.
Ensure make delete-old does not unlink /bin/rmail in that case.

PR: 266604
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D35874
MFC after: 2 weeks

(cherry picked from commit 55736146389f997fe3e2453f1d48d96ff1ad5b7a)

23 months agoLinuxKPI: Use SYSCTL_FOREACH()
Hans Petter Selasky [Wed, 28 Sep 2022 11:42:32 +0000 (13:42 +0200)]
LinuxKPI: Use SYSCTL_FOREACH()

Differential Revision:  https://reviews.freebsd.org/D36748
Sponsored by: NVIDIA Networking

(cherry picked from commit dd6bb9abf075fd3a14956f61559a7e90bb2f26d9)

23 months agosysctl(3): Implement SYSCTL_FOREACH() to iterate all OIDs in a sysctl list.
Hans Petter Selasky [Tue, 27 Sep 2022 13:48:16 +0000 (15:48 +0200)]
sysctl(3): Implement SYSCTL_FOREACH() to iterate all OIDs in a sysctl list.

To avoid using the sysctl list macros directly in external kernel modules.

Reviewed by: asomers, manu and asiciliano
Differential Revision: https://reviews.freebsd.org/D36748
Sponsored by: NVIDIA Networking

(cherry picked from commit c075ea46bca6d48ce9f639e4575077d06d392427)

23 months agosnd_uaudio(4): Add some examples accessing USB MIDI devices.
Goran Mekic [Tue, 27 Sep 2022 17:28:27 +0000 (19:28 +0200)]
snd_uaudio(4): Add some examples accessing USB MIDI devices.

Differential Revision: https://reviews.freebsd.org/D36195
Sponsored by: NVIDIA Networking

(cherry picked from commit f092c21bf630543dc899a444fa7885d0bbbaedfd)

23 months agovt(4): Make sure vt_switch_timer() has a sleepable context.
Hans Petter Selasky [Mon, 26 Sep 2022 15:10:50 +0000 (17:10 +0200)]
vt(4): Make sure vt_switch_timer() has a sleepable context.

Fixes the following panic backtrace:

panic()
usbhid_sync_xfer()
usbhid_set_report()
hid_set_report()
hidbus_write()
hid_write()
hkbd_set_leds()
hkbd_ioctl_locked()
hkbd_ioctl_locked()
hkbd_ioctl()
kbdmux_ioctl()
vt_window_switch()
vt_switch_timer()

Differential Revision: https://reviews.freebsd.org/D36715
Sponsored by: NVIDIA Networking

(cherry picked from commit 2cce9aa0785c438fa8b66bd230824f7460df14ac)

23 months agonfsclient: access v_mount only after the vnode is locked
Konstantin Belousov [Mon, 26 Sep 2022 18:10:47 +0000 (21:10 +0300)]
nfsclient: access v_mount only after the vnode is locked

(cherry picked from commit ab17854f974b5671b09139079d98e2068802064b)

23 months agobusdma: Fix powerpc DMA alignment check
Justin Hibbits [Tue, 4 Jan 2022 15:22:04 +0000 (09:22 -0600)]
busdma: Fix powerpc DMA alignment check

The original logic was to check if there's no filter and the address is
misaligned relative to the requirements.  The refactoring in
c606ab59e7f9423f7027320e9a4514c7db39658d missed this, and instead caused
it to return failure if the address *is* properly aligned.

(cherry picked from commit 3a9688f8bc488b16bf5676057fa86263554312b0)

23 months agobsdbox: remove previously broken telnet(d) support
Brooks Davis [Thu, 29 Sep 2022 16:54:32 +0000 (17:54 +0100)]
bsdbox: remove previously broken telnet(d) support

Support for telnet(d) was commented out some time ago.  Remove because
telnetd is gone in main and this is unlikely to be fixed.

Reviewed by: imp, delphij, emaste
Differential Revision: https://reviews.freebsd.org/D36782

(cherry picked from commit c0f94ccbb241f530c9f89d5259efb695e4f6de95)

23 months agoman9: Add MLINKs for bus_space_{peek,poke}
Mark Johnston [Mon, 26 Sep 2022 13:28:57 +0000 (09:28 -0400)]
man9: Add MLINKs for bus_space_{peek,poke}

(cherry picked from commit b3ab58bd4384b245404ebb10c5aa88e73e7370c8)

23 months agoposixshm tests: Map the large pages in the madvise test
Mark Johnston [Mon, 26 Sep 2022 12:58:10 +0000 (08:58 -0400)]
posixshm tests: Map the large pages in the madvise test

This improves test coverage and was unintentionally omitted when the
tests were written.

(cherry picked from commit e4eedf8c31a2693f07628d3b0433c6d398fdb6cd)

23 months agoarm64: Handle 1GB mappings in pmap_enter_quick_locked()
Mark Johnston [Mon, 26 Sep 2022 12:54:35 +0000 (08:54 -0400)]
arm64: Handle 1GB mappings in pmap_enter_quick_locked()

Reviewed by: alc, kib

(cherry picked from commit 7533062ae133a0e6e8f5b9913565bb99eabacb5f)

23 months agosvc_vc_rendezvous_stat: eliminiate write only variable stat
Warner Losh [Fri, 8 Jul 2022 17:53:35 +0000 (11:53 -0600)]
svc_vc_rendezvous_stat: eliminiate write only variable stat

Sponsored by: Netflix

(cherry picked from commit 6e671ec1e64ccd11c81eabe5abef5b20745914a2)

23 months agoclnt_vc_destroy: eliminiate write only variable stat
Warner Losh [Fri, 8 Jul 2022 17:53:35 +0000 (11:53 -0600)]
clnt_vc_destroy: eliminiate write only variable stat

Sponsored by: Netflix

(cherry picked from commit 77bc5890adf4aad832e1ed35f15dad8f5220a91b)

23 months agokrpc_call: eliminiate write only variable nam
Warner Losh [Fri, 8 Jul 2022 17:53:35 +0000 (11:53 -0600)]
krpc_call: eliminiate write only variable nam

Sponsored by: Netflix

(cherry picked from commit 5c2aad7e890d9f90b0281bb68bf07e764e0d62bd)

23 months agobootpc_decode_reply: eliminiate write only variable ip
Warner Losh [Fri, 8 Jul 2022 17:53:35 +0000 (11:53 -0600)]
bootpc_decode_reply: eliminiate write only variable ip

Sponsored by: Netflix

(cherry picked from commit b64a484592b2c053f7131edd949edb0a76eef083)

23 months agosmb_smb_treedisconnect: eliminate write only variable mbp
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
smb_smb_treedisconnect: eliminate write only variable mbp

Sponsored by: Netflix

(cherry picked from commit d6f698549474982394b0d347ae72c72425cc1f32)

23 months agosmb_iod_main: eliminate write only variable error
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
smb_iod_main: eliminate write only variable error

Sponsored by: Netflix

(cherry picked from commit 65ee334d112e1d19425bb59628500d0ba91ab48c)

23 months agopim6_input: eliminate write only variable rc
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
pim6_input: eliminate write only variable rc

Sponsored by: Netflix

(cherry picked from commit c7761ca93e9f6be51db2a8632d6697253e93f6c3)

23 months agosysctl_dumpentry: move error to inner scope
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
sysctl_dumpentry: move error to inner scope

Sponsored by: Netflix

(cherry picked from commit e606e5d1572684b978ca0572da776a597ffe0d94)

23 months agoroute_ctl: eliminate write only variables ifa and nh
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
route_ctl: eliminate write only variables ifa and nh

Sponsored by: Netflix

(cherry picked from commit 5de5b5a34db93a2a646e88d39a8e7718f925636f)

23 months agoget_nhop: eliminate write only variable gateway
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
get_nhop: eliminate write only variable gateway

Sponsored by: Netflix

(cherry picked from commit 7f9c3339a4ff5fecab3f408ba86afd3c5b778bd3)

23 months agoxl_attach: eliminate write only variable unit
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
xl_attach: eliminate write only variable unit

Sponsored by: Netflix

(cherry picked from commit c972f2c065bdb7031e7935aac406365e4810df19)

23 months agovtpci_legacy_register_msix: eliminate write only variable dev
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
vtpci_legacy_register_msix: eliminate write only variable dev

Sponsored by: Netflix

(cherry picked from commit 76e96756633e5d33f334bb48bedf981557272ead)

23 months agoustorage_fs_verify: eliminate write only variables file_offset and file_offset
Warner Losh [Fri, 8 Jul 2022 17:53:34 +0000 (11:53 -0600)]
ustorage_fs_verify: eliminate write only variables file_offset and file_offset

Sponsored by: Netflix

(cherry picked from commit 7a1bef40f1e9bb4d3d56331e743dec79c49a8fc4)

23 months agocp2112iic_intr_write_callback: eliminate write only variable psc
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
cp2112iic_intr_write_callback: eliminate write only variable psc

Sponsored by: Netflix

(cherry picked from commit 11110685fcd52aa19500f029365a8093218747c6)

23 months agowsp_intr_callback: eliminate write only variable h
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
wsp_intr_callback: eliminate write only variable h

Sponsored by: Netflix

(cherry picked from commit 53c1f1fc609190733adc2136c98c16086266f03e)

23 months agouss820dci: eliminate unused variables sc, ep_no
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
uss820dci: eliminate unused variables sc, ep_no

Sponsored by: Netflix

(cherry picked from commit 12312f75838e49635909f5ad4ba9e9688a3073b7)

23 months agouhci_xfer_setup: eliminate write only variable sc
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
uhci_xfer_setup: eliminate write only variable sc

Sponsored by: Netflix

(cherry picked from commit 6ccdcae1b9a693ffddf724cf850424e3b291bca1)

23 months agomusb: eliminate write only variable sc
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
musb: eliminate write only variable sc

Sponsored by: Netflix

(cherry picked from commit ab59cd6a0b3bb00ef8101180eae54982090317a2)

23 months agoatmegadci: eliminate unused variables sc, ep_no
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
atmegadci: eliminate unused variables sc, ep_no

Sponsored by: Netflix

(cherry picked from commit e73b02f66b7cf2f385457232de3ee908d695a170)

23 months agohdspe_dmapsetmap: eliminate write only variable sc
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
hdspe_dmapsetmap: eliminate write only variable sc

Sponsored by: Netflix

(cherry picked from commit ad1b7fd71429468430e379fa0a4152f23b0af90a)

23 months agoquicc_bus_setsig: eliminate write only variable bas
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
quicc_bus_setsig: eliminate write only variable bas

Sponsored by: Netflix

(cherry picked from commit c8fe3923d8d969efea24b7107a825de02b8a4b0d)

23 months agohdaa_eld_dump: eliminate write only variable len
Warner Losh [Fri, 8 Jul 2022 17:53:33 +0000 (11:53 -0600)]
hdaa_eld_dump: eliminate write only variable len

Sponsored by: Netflix

(cherry picked from commit 557627dda9b015728a478e31348808356eb75c73)

23 months agoemu10kx: eliminate write only variables val, r and move i to loop
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
emu10kx: eliminate write only variables val, r and move i to loop

Sponsored by: Netflix

(cherry picked from commit 8717135d3750b3d0c80c8783c547ffffe255c04f)

23 months agoemu10kx-pci: eliminate write only variable r
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
emu10kx-pci: eliminate write only variable r

Sponsored by: Netflix

(cherry picked from commit 451f54707a614757e2a0093876e30b68247a41da)

23 months agoemu_midi_probe: eliminate write only variable r
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
emu_midi_probe: eliminate write only variable r

Sponsored by: Netflix

(cherry picked from commit 7387abd342a181bcf278949e22f09ebc25ed00ae)

23 months agopcmcsa_attach: eliminate write only variable unit
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
pcmcsa_attach: eliminate write only variable unit

Sponsored by: Netflix

(cherry picked from commit 33985865b2d8eafc9fc1d065dc06344c9c95c56c)

23 months agomidicsa_attach: eliminate write only variable func
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
midicsa_attach: eliminate write only variable func

Sponsored by: Netflix

(cherry picked from commit 3e423419cf02c9e314b66b51c1fb0f987839de5e)

23 months agocs4281: eliminate write only variable codecno
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
cs4281: eliminate write only variable codecno

Sponsored by: Netflix

(cherry picked from commit 0c64fe00681816ce593e58617a7b285683154dfb)

23 months agosb_probe: eliminate write only variable r
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
sb_probe: eliminate write only variable r

Sponsored by: Netflix

(cherry picked from commit 635a4068d2c5a711cf6cf35d6c9be8e550b5a5d9)

23 months agosb16_probe: eliminate write only variable r
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
sb16_probe: eliminate write only variable r

Sponsored by: Netflix

(cherry picked from commit 668986eae9b5d7da35a27445c1f306604caa0429)

23 months agoess_probe: eliminate write only variable r
Warner Losh [Fri, 8 Jul 2022 17:53:32 +0000 (11:53 -0600)]
ess_probe: eliminate write only variable r

Sponsored by: Netflix

(cherry picked from commit 3a7365acc813173c02c4346044615a18e29b71ac)

23 months agosis_attach: Move waittime definition into for loop
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
sis_attach: Move waittime definition into for loop

Sponsored by: Netflix

(cherry picked from commit c9439e23cefb918ad71f568a35f2a468ef3365c8)

23 months agoppc_detect_fifo: eliminate write only variable cc
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
ppc_detect_fifo: eliminate write only variable cc

Sponsored by: Netflix

(cherry picked from commit 94885fbd042b61eec97f20ea06a9e96fb05f5492)

23 months agoppi_probe: eliminate unused variable ppi
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
ppi_probe: eliminate unused variable ppi

Sponsored by: Netflix

(cherry picked from commit de80fb0ace15528ae86a97c97dd7b7cf7949ee83)

23 months agoMark cfg as __unused to avoid ifdef soup
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
Mark cfg as __unused to avoid ifdef soup

Sponsored by: Netflix

(cherry picked from commit 09b966ee7c6389db635f793377cc50cb2fcb4962)

23 months agomxge_rss_ethp_z8e_fw_modevent: eliminate write only variable parent
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
mxge_rss_ethp_z8e_fw_modevent: eliminate write only variable parent

Sponsored by: Netflix

(cherry picked from commit 273676a44ca9ea311492fcf258c347deccfad71f)

23 months agomxge_rss_eth_z8e_fw_modevent: eliminate write only variable parent
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
mxge_rss_eth_z8e_fw_modevent: eliminate write only variable parent

Sponsored by: Netflix

(cherry picked from commit 5f136a4c01496cd05e01b39c3a19e9877d2ec8ee)

23 months agomxge_ethp_z8e_fw_modevent: eliminate write only variable parent
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
mxge_ethp_z8e_fw_modevent: eliminate write only variable parent

Sponsored by: Netflix

(cherry picked from commit 886bc93da861ab06f341fb2d36d9592ddfaaadb6)

23 months agomxge_eth_z8e_fw_modevent: eliminate write only variable parent
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
mxge_eth_z8e_fw_modevent: eliminate write only variable parent

Sponsored by: Netflix

(cherry picked from commit 498276b4b430184e7d6c578f45fe80eb774cde24)

23 months agomge: eliminate write only variables ifp, sc and error
Warner Losh [Fri, 8 Jul 2022 17:53:31 +0000 (11:53 -0600)]
mge: eliminate write only variables ifp, sc and error

Sponsored by: Netflix

(cherry picked from commit f8967810f5b5806c59fb6c8dbcc123dbc9256bb3)

23 months agorx8803_settime: remove write only variable bus
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
rx8803_settime: remove write only variable bus

Sponsored by: Netflix

(cherry picked from commit 875145ffd48e1cad1e3aa2ee6c134d45523558b0)

23 months agotca6416: remove write only sc
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
tca6416: remove write only sc

Sponsored by: Netflix

(cherry picked from commit 22127c7c1b9c0f8feb73f13a829b8b757f2274eb)

23 months agopmc_save_user_callchain: eliminate write only td variable
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
pmc_save_user_callchain: eliminate write only td variable

Sponsored by: Netflix

(cherry picked from commit 6ca6b8ea523daa6f17e010711458800f30d2e1ee)

23 months agohpen_battery_strenght_cb: eliminate write only data variable
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
hpen_battery_strenght_cb: eliminate write only data variable

Sponsored by: Netflix

(cherry picked from commit 92ec9782ac9739df8967acaaee114a68e134d8ee)

23 months agomx25l_task: eliminate dev write only variable
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
mx25l_task: eliminate dev write only variable

Sponsored by: Netflix

(cherry picked from commit edcced8ab790ee677130166fa060d96c4eb31550)

23 months agofd_probe: only define unit on x86, other platforms don't use this code
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
fd_probe: only define unit on x86, other platforms don't use this code

Sponsored by: Netflix

(cherry picked from commit 05d3c5fd182eeb33075ee14e2802c94882dc2c41)

23 months agoe6000sw_set_atustat: eliminate write only ret variable
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
e6000sw_set_atustat: eliminate write only ret variable

Sponsored by: Netflix

(cherry picked from commit 9a2e6ca6ef82128ed2b7b9c7e8e3a9a6c459fb45)

23 months agocyapa_raw_input: elimmminate write only k variable
Warner Losh [Fri, 8 Jul 2022 17:53:30 +0000 (11:53 -0600)]
cyapa_raw_input: elimmminate write only k variable

Sponsored by: Netflix

(cherry picked from commit 3ca3bb576b48667a694b1eab229870697586bb5d)

23 months agobwn_lo_measure_gain_values: eliminate write only trsw_rx variable
Warner Losh [Fri, 8 Jul 2022 17:53:29 +0000 (11:53 -0600)]
bwn_lo_measure_gain_values: eliminate write only trsw_rx variable

Sponsored by: Netflix

(cherry picked from commit a9e022d3d75e33f27c3e6bbdc2445bf7c8800994)

23 months agobhnd_nvram_store_export_child: eliminate num_props write only variable
Warner Losh [Fri, 8 Jul 2022 17:53:29 +0000 (11:53 -0600)]
bhnd_nvram_store_export_child: eliminate num_props write only variable

Sponsored by: Netflix

(cherry picked from commit 87a4328651b4e5f9114a7485cf67a3a300f668f3)

23 months agobhnd_pmu_sdiod_drive_strength_init: eliminate write only intr_val variable
Warner Losh [Fri, 8 Jul 2022 17:53:29 +0000 (11:53 -0600)]
bhnd_pmu_sdiod_drive_strength_init: eliminate write only intr_val variable

Sponsored by: Netflix

(cherry picked from commit 5466363900d28e473fa9d240ba15f2d5888fd045)

23 months agobhnd_pwrctl_attach: eliminate write only bus variable
Warner Losh [Fri, 8 Jul 2022 17:53:29 +0000 (11:53 -0600)]
bhnd_pwrctl_attach: eliminate write only bus variable

Sponsored by: Netflix

(cherry picked from commit 9af048a0b154685b280f21f948f693dc2971c860)