]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agohda: whitespace fix for realtek pin patches
Ed Maste [Thu, 24 Mar 2022 00:54:51 +0000 (20:54 -0400)]
hda: whitespace fix for realtek pin patches

2 years agosound: test PCM_REGISTERED before PCM_DETACHING
Ed Maste [Mon, 21 Mar 2022 16:15:22 +0000 (12:15 -0400)]
sound: test PCM_REGISTERED before PCM_DETACHING

PCM_REGISTERED(d) tests that d is not NULL, so perform that check first
as we may have cases where devclass_get_softc has a null entry.

PR: 262671
Reviewed by: hselasky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34648

2 years agobsdinstall(8): Usage example of tar doesn't work
Farhan Khan [Wed, 23 Mar 2022 20:54:30 +0000 (21:54 +0100)]
bsdinstall(8): Usage example of tar doesn't work

The order of arguments in the example does not work, because tar thinks
the directory is named -C, which does not exist and reports:
tar: Error opening archive: Failed to open '-C'

Approved by: rpokala@ (src) on IRC
Differential Revision: https://reviews.freebsd.org/D34649

2 years agoarm,arm64: Add a NT_ARM_TLS read-only register set.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
arm,arm64: Add a NT_ARM_TLS read-only register set.

This register set exposes the per-thread TLS register.  It matches the
layout used by Linux on arm64.  Linux does not implement this note for
32-bit arm.

Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34595

2 years agoUse a regset for NT_ARM_VFP.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
Use a regset for NT_ARM_VFP.

This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.

Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34448

2 years agoaarch64: Fix get_fpcontext32() to work on non-curthread.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
aarch64: Fix get_fpcontext32() to work on non-curthread.

Similar to fill_fpregs(), only invoke vfp_save_state() for curthread.

While here, zero the buffer if FP hasn't been started to avoid leaking
kernel stack memory.

Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34525

2 years ago<sys/reg.h>: Add ELF32_REGSET.
John Baldwin [Wed, 23 Mar 2022 20:33:06 +0000 (13:33 -0700)]
<sys/reg.h>: Add ELF32_REGSET.

This permits adding a register set for FREEBSD32 ABIs.

While here, include <sys/linker_set.h> to make this header more
self-contained in the kernel.

Reviewed by: andrew, markj
Sponsored by: The University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34536

2 years agocxgbe(4): Allow dump_cimla and dump_devlog to sleep.
Navdeep Parhar [Tue, 22 Mar 2022 20:13:56 +0000 (13:13 -0700)]
cxgbe(4): Allow dump_cimla and dump_devlog to sleep.

This has been safe since e9e7bc82505, which moved parts of error
handling from the ithread to a taskqueue.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agoLinuxKPI: 802.11: fix lkpi_lsta_dump() debugging
Bjoern A. Zeeb [Wed, 23 Mar 2022 17:14:03 +0000 (17:14 +0000)]
LinuxKPI: 802.11: fix lkpi_lsta_dump() debugging

Fix two last-minute changes of d9f59799fc3e7940c47aa674c25994e640eae45e:
(1) for consitency name the debugging function lkpi_lsta_dump()
(2) pass in the original node (ni) rather than taking it from the lsta
    to avoid problems realted to bss_update as mentioned in the above
    commit.

No functional changes for users.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC with: d9f59799fc3e7940c47aa674c25994e640eae45e

2 years agoLinuxKPI: skbuff: fix skb_queue_splice_init()
Bjoern A. Zeeb [Wed, 23 Mar 2022 17:05:43 +0000 (17:05 +0000)]
LinuxKPI: skbuff: fix skb_queue_splice_init()

In skb_queue_splice_init() we set a next value and then used that new
value to further update the remaining linking rather than the original
value.  Introduce another temporary variable 'n' to hold the original
value and use that.
While here rename q and h to from and to as otherwise it was too
confusing to read.

Also initialize skb->prev and skb->next to point to skb itself if
for nothing else at least to aid debugging.

Reported by: phk (panic in iwl_txq_reclaim)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoelf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes
Mark Johnston [Wed, 23 Mar 2022 16:52:44 +0000 (12:52 -0400)]
elf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes

elf_prstatus_t contains pad space.

Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34606

2 years agocallout: Remove the CS_EXECUTING flag
Mark Johnston [Wed, 23 Mar 2022 16:37:02 +0000 (12:37 -0400)]
callout: Remove the CS_EXECUTING flag

It is now unused.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34626

2 years agosetitimer: Fix exit race
Mark Johnston [Wed, 23 Mar 2022 16:36:12 +0000 (12:36 -0400)]
setitimer: Fix exit race

We use the p_itcallout callout, interlocked by the proc lock, to
schedule timeouts for the setitimer(2) system call.  When a process
exits, the callout must be stopped before the process struct is
recycled.

Currently we attempt to stop the callout in exit1() with the call
_callout_stop_safe(&p->p_itcallout, CS_EXECUTING).  If this call returns
0, then we sleep in order to drain the callout.  However, this happens
only if the callout is not scheduled at all.  If the callout thread is
blocked on the proc lock, then exit1() will not block and the callout
may execute after the process has fully exited, typically resulting in a
panic.

I cannot see a reason to use the CS_EXECUTING flag here.  Instead, use
the regular callout_stop()/callout_drain() dance to halt the callout.

Reported by: ler
Tested by: ler, pho
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34625

2 years agobsdinstall time: Replace dialog with bsddialog
Alfonso S. Siciliano [Wed, 23 Mar 2022 15:52:39 +0000 (16:52 +0100)]
bsdinstall time: Replace dialog with bsddialog

Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility,
'dialog --calendar' is replaced by 'bsddialog --datebox' with same
features but different User Interface.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34583

2 years agoRemove L2_BLOCK_MASK from arm64
Andrew Turner [Wed, 23 Mar 2022 15:33:05 +0000 (15:33 +0000)]
Remove L2_BLOCK_MASK from arm64

It's unneeded as it was just used to align KERNBASE to a level 2
block start address. KERNBASE was already aligned correctly.

Sponsored by: The FreeBSD Foundation

2 years agoSupport EFIRT on arm64 with a non 4k page size
Andrew Turner [Wed, 23 Mar 2022 15:18:30 +0000 (15:18 +0000)]
Support EFIRT on arm64 with a non 4k page size

When the page size the kernel is built for is not the same as
EFI_PAGE_SIZE we need to increment the page index at a faster rate.

Add this adjustment to the arm64 EFIRT support in preperation for
experimental 16k PAGE_SIZE support.

Sponsored by: The FreeBSD Foundation

2 years agoAdd an implementation of .mcount on arm64
Andrew Turner [Tue, 22 Mar 2022 15:46:15 +0000 (15:46 +0000)]
Add an implementation of .mcount on arm64

To support cc -pg on arm64 we need to implement .mcount. As clang and
gcc think it is function like it just needs to load the arguments
to _mcount and call it.

On gcc the first argument is passed in x0, however this is missing on
clang so we need to load it from the stack. As it's the caller return
address this will be at a known location.

PR: 262709
Reviewed by: emaste (earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34634

2 years agolinuxkpi: Add down_write_nest_lock
Emmanuel Vadot [Tue, 22 Mar 2022 09:28:02 +0000 (10:28 +0100)]
linuxkpi: Add down_write_nest_lock

Simply calls down_write like in Linux (when CONFIG_DEBUG_LOCK_ALLOC isn't
specified)
Needed by drm v5.10

MFC after: 1 month
Reviewed by: hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34642

2 years agolinuxkpi: Add kstrtouint_from_user
Emmanuel Vadot [Tue, 22 Mar 2022 09:22:42 +0000 (10:22 +0100)]
linuxkpi: Add kstrtouint_from_user

Like kstrtoint_from_user but for uint.
Needed by drm v5.10

MFC after: 1 month
Reviewed by: hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34642

2 years agolinuxkpi: Add cond_resched_lock
Emmanuel Vadot [Mon, 21 Mar 2022 10:14:05 +0000 (11:14 +0100)]
linuxkpi: Add cond_resched_lock

If we need to resched it takes the lock, resched, release the lock
and returns 1, otherwise simply returns 0.

Needed by drm v5.9

MFC after: 1 month
Reviewed by: hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34620

2 years agoAdd devices and quirks for some Olympus cameras.
Greg Lehey [Wed, 23 Mar 2022 01:40:28 +0000 (12:40 +1100)]
Add devices and quirks for some Olympus cameras.

Reviewed by: hps@
Fixes:     Problems attaching Olympus cameras.
MFC after: 2 weeks

2 years agobsdinstall hardening: Replace dialog with bsddialog
Alfonso S. Siciliano [Tue, 22 Mar 2022 23:52:22 +0000 (00:52 +0100)]
bsdinstall hardening: Replace dialog with bsddialog

bsdinstall/scripts/hardening: Replace (LGPL) dialog utility with
(BSD-2-CLAUSE) dialog utility.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34102

2 years agotest-includes: improve portability
Brooks Davis [Tue, 22 Mar 2022 20:23:22 +0000 (20:23 +0000)]
test-includes: improve portability

FreeBSD's shell permits [^bar] to match characters not in [bar] like
common regular expressions. This is non-portable and '!' should be
used in place of '^' for portability.

Reported by: Nathaniel Wesley Filardo
Issue: https://github.com/CTSRD-CHERI/cheribsd/issues/1321
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D34597

2 years agoCorrect a handful of typos and grammos.
Jens Schweikhardt [Tue, 22 Mar 2022 20:12:42 +0000 (21:12 +0100)]
Correct a handful of typos and grammos.

2 years agoLinuxKPI: 802.11: rework sta state machine compatibility
Bjoern A. Zeeb [Tue, 22 Mar 2022 18:34:13 +0000 (18:34 +0000)]
LinuxKPI: 802.11: rework sta state machine compatibility

Rework the state machine parts for various reasons:
(1) to add sta tracing to be able to better follow ni and lsta state
(2) factor out/implement lkpi_lsta_remove() to unlink the lsta and
    free the ni reference.
(3) avoid calling lkpi_disassoc() when you would think you should as
    changing BSS_CHANGED_ASSOC setting vif->bss_conf.assoc to false
    triggers a sta removal from firmware in iwlwifi which then triggers
    follow-up errors.  I do not understand why they use flags and state
    and ?? in parallel (too many options and ways to do things?).
(4) when "roaming" (or being disassoc/deauth) from an AP both net80211
    and apparently so mac80211 re-start with a new node/sta.  This
    results in us losing one or the other state in the compat layer
    or not updating firmware appropriately.  To resolve this make use
    of (a) the newly introduced (*iv_update_bss)() and (b) always tear
    a station down to "State 1" (INIT/SCAN/pre-AUTH) and only if needed
    re-create the new one (if we go to AUTH).
    A slightly earlier version has survived a night of wpa_supplicant
    and hostapd fighting each other over disassoc and deauth and
    re-associating/authorizing.

While there update a few comments and typos and do a few minor auxiliary
changes which are hard or not worth to extract.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: 802.11: factor out dtim/tsf updates
Bjoern A. Zeeb [Tue, 22 Mar 2022 18:16:56 +0000 (18:16 +0000)]
LinuxKPI: 802.11: factor out dtim/tsf updates

Factor out dtim/tsf setting/updates into lkpi_update_dtim_tsf()
with tracing and add an extra update call.
This avoids some code duplication and puts maintainance into a
single place.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc()
Bjoern A. Zeeb [Tue, 22 Mar 2022 15:14:31 +0000 (15:14 +0000)]
LinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc()

Split lkpi_ic_node_alloc() into two functions to make the code simpler
and to allow lkpi_lsta_alloc() to be re-used from another part of the
code related to (*iv_update_bss)().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: 802.11: implement ieee80211_beacon_loss()
Bjoern A. Zeeb [Tue, 22 Mar 2022 15:02:45 +0000 (15:02 +0000)]
LinuxKPI: 802.11: implement ieee80211_beacon_loss()

Implement ieee80211_beacon_loss() similar to
ieee80211_connection_loss() with different state handling.
While here leave a comment in connection_loss() about the state
change argument.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agonet80211: introduce (*iv_update_bss)()
Bjoern A. Zeeb [Tue, 22 Mar 2022 14:46:51 +0000 (14:46 +0000)]
net80211: introduce (*iv_update_bss)()

Introduce (*iv_update_bss)() with a default implementation to allow
drivers to overload/intercept the time when we swap iv_bss.

This helps firmware based drivers to synchronize state with firmware.
Otherwise, for some state changes, we begin with one ni (and in
LinuxKPI lsta) and try to finish with another ni (and a new lsta
in different state) and may no longer have access to the previous state.
This also saves us from constantly checking for ni changes complicating
code.

No functional changes intended.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC: move (*iv_update_bss) to spare area

2 years agonet80211: improve one debug logging
Bjoern A. Zeeb [Tue, 22 Mar 2022 14:40:12 +0000 (14:40 +0000)]
net80211: improve one debug logging

When forcing DEUATH in ieee80211_sta_join1() log the current state
we are coming from as well.  Note this isn't always the state we
are expecting as iv_state was updated already, so contrary to the
comment we usually do not see RUN there.
Leave a comment earlier with regards to this as well.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoRemove the unused arm64 kernel profiling code
Andrew Turner [Tue, 22 Mar 2022 15:48:58 +0000 (15:48 +0000)]
Remove the unused arm64 kernel profiling code

It's unused. Remove it in preperation for userspace support.

Sponsored by: The FreeBSD Foundation

2 years agoneta: split fixed and in-band link status configuration
Sebastien Bini [Tue, 22 Mar 2022 15:44:09 +0000 (16:44 +0100)]
neta: split fixed and in-band link status configuration

Fixed-link mode requires different handling than the in-band
managed connection. Update interrupt, link-up/down and
autonegotiation settings for the former.

Reviewed by: mw
MFC after: 1 week
Obtained from: Stormshield
Differential Revision: https://reviews.freebsd.org/D34394

2 years agoIPv4 multicast: fix netstat -g
Mike Karels [Mon, 21 Mar 2022 19:59:13 +0000 (14:59 -0500)]
IPv4 multicast: fix netstat -g

The vif structure includes fields at the end which are #ifdef KERNEL,
causing a mismatch between the structure sizes between kernel and
user level.  netstat -g failed with an ENOMEM on the sysctl to fetch
the vif table.  Change the vif sysctl code in ip_mroute to copy out
only the user-level-visible portion of each table entry.

Reviewed by: bz, wma
Differential Revision: https://reviews.freebsd.org/D34627

2 years agoEnter epoch when addding IPv4 multicast forwarding cache entry
Mike Karels [Mon, 21 Mar 2022 14:50:08 +0000 (09:50 -0500)]
Enter epoch when addding IPv4 multicast forwarding cache entry

The code path from the IPv4 multicast setsockopt could call ip_output()
without entering an epoch.  Specifically, the MRT_ADD_MFC setbsocopt
would call add_mfc(), which in turn called ip_mdq() to send queued
packets.  This resulted in an epoch assert failure in ip_output().
Enter an epoch in add_mfc(), and add some epoch asserts to check
for similar failures.

Reviewed by: kp, bz, wma, cy
Differential Revision: https://reviews.freebsd.org/D34624

2 years agoFix umtxq_sleep() regression caused by 56070dd2e4d.
Alexander Motin [Mon, 21 Mar 2022 23:43:39 +0000 (19:43 -0400)]
Fix umtxq_sleep() regression caused by 56070dd2e4d.

umtxq_requeue() moves the queue to a different hash chain and different
lock, so we can't rely on msleep_sbt() reacquiring the same old lock.
We have to use PDROP and update the queue chain and so lock pointer.

PR: 262587
MFC after: 2 weeks

2 years agopowerpcspe: fix PCI enumeration on ppce500
Alfredo Dal'Ava Junior [Mon, 21 Mar 2022 10:57:07 +0000 (07:57 -0300)]
powerpcspe: fix PCI enumeration on ppce500

This fixes PCI devices not being found on QEMU ppce500. This
generic board used to have its first PCI slot at 0x11, like the
mpc8544dsi and some real HW. After commit [1], it was changed to
0x1 and our driver wasn't prepared for that.

[1] https://gitlab.com/qemu-project/qemu/-/commit/3bb7e02a9725a24e5bf915b35f914f82f5b07a1f

Reviewed by: jhibbits, bdragon
MFC after: 2 days
Sponsored by: Institudo de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D34621

2 years agoRemove unused snd_ds1 file ds1-fw.h
Ed Maste [Mon, 21 Mar 2022 18:19:49 +0000 (14:19 -0400)]
Remove unused snd_ds1 file ds1-fw.h

Fixes: 92e6b4712b53 ("Retire broken snd_ds1 and ...")
Reported by: joel

2 years agoLinuxKPI: pci: implement pci_upstream_bridge()
Bjoern A. Zeeb [Wed, 16 Feb 2022 18:04:08 +0000 (18:04 +0000)]
LinuxKPI: pci: implement pci_upstream_bridge()

Allow drivers to query the "upstream PCI bridge".
Currently we point back to ourselves on pdev->bus->self rather than
to the parent PCI bridge.
We keep this as status-quo with an extra comment and only on-demand
allocate a pci_dev for the parent bridge if we are asked for in
pci_upstream_bridge().
When releasing the pci_dev we check if pdev->bus->self has changed
and call pci_dev_put() to release the reference count on the parent
bridge as well.

This code moves pci_is_root_bus() higher up in pci.h but no functional
change there.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky, (jhb some earlier)
Thanks to: wulf for handling drm-kmod
Differential Revision: https://reviews.freebsd.org/D34305

2 years agokern_tc.c/cputick2usec() (which is used to calculate cputime from
firk [Mon, 21 Mar 2022 13:33:11 +0000 (09:33 -0400)]
kern_tc.c/cputick2usec() (which is used to calculate cputime from
cpu ticks) has some imprecision and, worse, huge timestep (about
20 minutes on 4GHz CPU) near 53.4 days of elapsed time.

kern_time.c/cputick2timespec() (it is used for clock_gettime() for
querying process or thread consumed cpu time) Uses cputick2usec()
and then needlessly converting usec to nsec, obviously losing
precision even with fixed cputick2usec().

kern_time.c/kern_clock_getres() uses some weird (anyway wrong)
formula for getting cputick resolution.

PR: 262215
Reviewed by: gnn
Differential Revision: https://reviews.freebsd.org/D34558

2 years agoMake SHMMAXPGS an unsigned long
Andrew Turner [Tue, 15 Mar 2022 17:42:30 +0000 (17:42 +0000)]
Make SHMMAXPGS an unsigned long

This is used to calculate sizes that are then stored in unsigned long
fields. Make this unsigned long so the calculations use this type and
not an int that can lead to an integer overflow with a large PAGE_SIZE.

This allows building this on arm64 with PAGE_SIZE of 16k. Further work
will be needed if a 32-bit architecture tries to use a similar sized
page.

Sponsored by: The FreeBSD Foundation

2 years agoMerge libcxxrt commit f2e55091e2e878386c9f7974d4922bbdc4faed84
Dimitry Andric [Sun, 20 Mar 2022 21:21:28 +0000 (22:21 +0100)]
Merge libcxxrt commit f2e55091e2e878386c9f7974d4922bbdc4faed84

  Fix unlock in two-word version and add missing comment.

  Fixes #15
  Fixes #16

This should fix the hangs in __cxa_guard_acquire() reported on i386 (and
possibly other 32-bit platforms).

Obtained from: https://github.com/libcxxrt/libcxxrt/commit/f2e5509
Fixes: 56aaed388b0a
MFC after: 2 weeks

2 years agoReapply libcxxrt atomics cleanup commit, preparing for upstream fix
Dimitry Andric [Sun, 20 Mar 2022 21:19:27 +0000 (22:19 +0100)]
Reapply libcxxrt atomics cleanup commit, preparing for upstream fix

This reapplies upstream commit fd484be, as there is a follow-up fix for
the possible hangs in __cxa_guard_acquire() on i386:

  Atomics cleanup (#11)

  We need to test exception specifiers but they're gone in C++17 so
  compile the tests with an older version of the standard.

  Rewrite the guard logic to be more idiomatic C++ and more
  comprehensible and make sure that atomics are used where necessary.

Obtained from: https://github.com/libcxxrt/libcxxrt/commit/fd484be
Fixes: 56aaed388b0a
MFC after: 2 weeks

2 years agomixer.8: Document shorthand syntax for volume setting.
Hans Petter Selasky [Sun, 20 Mar 2022 19:15:30 +0000 (20:15 +0100)]
mixer.8: Document shorthand syntax for volume setting.

Submitted by: christos@
Differential Revision: https://reviews.freebsd.org/D34614
Sponsored by: NVIDIA Networking

2 years agomixer.4 and mixer.8: Fix mandoc -Tlint errors.
Hans Petter Selasky [Sun, 20 Mar 2022 19:13:00 +0000 (20:13 +0100)]
mixer.4 and mixer.8: Fix mandoc -Tlint errors.

Submitted by: christos@
Differential Revision: https://reviews.freebsd.org/D34603
Sponsored by: NVIDIA Networking

2 years agomixer(8): Improve shorthand volume parsing.
Hans Petter Selasky [Sun, 20 Mar 2022 19:08:13 +0000 (20:08 +0100)]
mixer(8): Improve shorthand volume parsing.

The initial patch had a bug where the full volume syntax, floating point values,
:, + and -, wasn't accepted.

While at it move some defines to enum's.

Fixes: da3d4469ef841be44ac4b346a6b51668d608ed49
Submitted by: christos@
Differential Revision: https://reviews.freebsd.org/D34617
Sponsored by: NVIDIA Networking

2 years agotslog: Add CTLFLAG_SKIP to sysctls
Colin Percival [Sun, 20 Mar 2022 17:41:58 +0000 (10:41 -0700)]
tslog: Add CTLFLAG_SKIP to sysctls

The timestamp logs are quite large (often much larger than all the
other sysctls combined) so it's unlikely anyone will want to have
them displayed by `sysctl -a`.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34616

2 years agosysctl(8): Mention CTLFLAG_SKIP
Colin Percival [Sun, 20 Mar 2022 17:41:03 +0000 (10:41 -0700)]
sysctl(8): Mention CTLFLAG_SKIP

`sysctl -a` does not print values with this flag.

Reviewed by: debdrup
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34615

2 years agomixer(8): Add shorthand syntax for setting the volume.
Hans Petter Selasky [Sun, 20 Mar 2022 16:28:08 +0000 (17:28 +0100)]
mixer(8): Add shorthand syntax for setting the volume.

dev.volume=X[.X] can now also be written as dev=X[.X] .

Requested by: hselasky@ and bsduck (FreeBSD forums)
Submitted by: christos@
Differential Revision: https://reviews.freebsd.org/D34612
Sponsored by: NVIDIA Networking

2 years agomixer(8): Remove [.volume] string from default printout.
Hans Petter Selasky [Sun, 20 Mar 2022 16:23:37 +0000 (17:23 +0100)]
mixer(8): Remove [.volume] string from default printout.

Submitted by: christos@
Differential Revision: https://reviews.freebsd.org/D34591
Sponsored by: NVIDIA Networking

2 years agocap_fileargs: silence warnings of unused variable
Mariusz Zaborski [Sun, 20 Mar 2022 10:17:31 +0000 (11:17 +0100)]
cap_fileargs: silence warnings of unused variable

We still want to fetch the variable just to verify that the interface
is right.

Reported by: pstef

2 years agoFix llvm build after 1b3bef43e3cb, due to API change
Dimitry Andric [Sat, 19 Mar 2022 23:12:58 +0000 (00:12 +0100)]
Fix llvm build after 1b3bef43e3cb, due to API change

After merging llvm commit b9ca73e1a8fd for PR 262608, it would fail to
compile with:

/usr/src/contrib/llvm-project/llvm/lib/IR/Operator.cpp:197:22: error: no member named 'isZero' in 'llvm::APInt'
   if (!IndexedSize.isZero()) {
        ~~~~~~~~~~~ ^

Upstream refactored their APInt class, and isZero() was one of the newer
methods which did not yet exist in llvm 13.0.0. Fix this by using the
older but equivalent isNullValue() method instead.

Fixes: 1b3bef43e3cb
MFC after: 3 days

2 years agoApply llvm fix for assertion compiling certain versions of Wine
Dimitry Andric [Sat, 19 Mar 2022 19:59:04 +0000 (20:59 +0100)]
Apply llvm fix for assertion compiling certain versions of Wine

Merge commit b9ca73e1a8fd from llvm git (by Stephen Tozer):

  [DebugInfo] Correctly handle arrays with 0-width elements in GEP salvaging

  Fixes an issue where GEP salvaging did not properly account for GEP
  instructions which stepped over array elements of width 0 (effectively a
  no-op). This unnecessarily produced long expressions by appending
  `... + (x * 0)` and potentially extended the number of SSA values used
  in the dbg.value. This also erroneously triggered an assert in the
  salvage function that the element width would be strictly positive.
  These issues are resolved by simply ignoring these useless operands.

  Reviewed By: aprantl

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

PR: 262608
Reported by: Damjan Jovanovic <damjan.jov@gmail.com>
MFC after: 3 days

2 years agoRevert upstream libcxxrt commit which can cause hangs on i386
Dimitry Andric [Sat, 19 Mar 2022 19:46:28 +0000 (20:46 +0100)]
Revert upstream libcxxrt commit which can cause hangs on i386

This reverts upstream commit fd484be:

  Atomics cleanup (#11)

  We need to test exception specifiers but they're gone in C++17 so
  compile the tests with an older version of the standard.

  Rewrite the guard logic to be more idiomatic C++ and more
  comprehensible and make sure that atomics are used where necessary.

It looks like there are some corner cases in the i386 and/or 32-bit
atomics handling, which can make __cxa_guard_acquire() hang in certain
situations.

Reported by: antoine
Obtained from: https://github.com/libcxxrt/libcxxrt/commit/fd484be
Fixes: 56aaed388b0a
MFC after: 2 weeks

2 years agoAdd deprecation notices to ISA sound cards
Ed Maste [Fri, 18 Mar 2022 15:50:23 +0000 (11:50 -0400)]
Add deprecation notices to ISA sound cards

ISA sound cards (and ISA itself) are long obsolete.  NYCBUG dmesgd has
no entries for any of these devices after 2005.

Add deprecation notices to device attach routines and man pages for:

snd_ad1816  Analog Devices AD1816 SoundPort
snd_ess     Ensoniq ESS
snd_gusc    Gravis UltraSound
snd_mss     Microsoft Sound System
snd_sbc     Creative Sound Blaster

Reviewed by: cy, mav
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34604

2 years agortsx: Call rtsx_init() on resume.
hlh-restart [Sat, 19 Mar 2022 16:37:24 +0000 (12:37 -0400)]
rtsx: Call rtsx_init() on resume.

MFC after: 3 days

2 years agocache: add a comment about a realpath bug
Mateusz Guzik [Sat, 19 Mar 2022 15:11:25 +0000 (15:11 +0000)]
cache: add a comment about a realpath bug

2 years agovfs: replace VFS_NOTIFY_UPPER_* macros with an enum
Mateusz Guzik [Sat, 19 Mar 2022 13:15:55 +0000 (13:15 +0000)]
vfs: replace VFS_NOTIFY_UPPER_* macros with an enum

2 years agovfs: add missing flags to db show mount
Mateusz Guzik [Sat, 19 Mar 2022 12:04:44 +0000 (12:04 +0000)]
vfs: add missing flags to db show mount

2 years agovfs: retire the no longer used MNTK_LOOKUP_EXCL_DOTDOT flag
Mateusz Guzik [Sat, 18 Sep 2021 10:46:03 +0000 (12:46 +0200)]
vfs: retire the no longer used MNTK_LOOKUP_EXCL_DOTDOT flag

Reviewed by: markj
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D34466

2 years agonullfs: hash insertion without vnode lock upgrade
Mateusz Guzik [Mon, 7 Mar 2022 11:43:43 +0000 (11:43 +0000)]
nullfs: hash insertion without vnode lock upgrade

Use the hash lock to serialize instead.

This enables shared-locked ".." lookups.

Reviewed by: markj
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D34466

2 years agovfs: add MNTK_UNLOCKED_INSMNTQUE
Mateusz Guzik [Mon, 7 Mar 2022 11:40:04 +0000 (11:40 +0000)]
vfs: add MNTK_UNLOCKED_INSMNTQUE

Can be used when the fs at hand can synchronize insmntque with other
means than the vnode lock.

Reviewed by: markj
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D34466

2 years agopsci: finish psci_present implementation
Kyle Evans [Sat, 19 Mar 2022 03:03:44 +0000 (22:03 -0500)]
psci: finish psci_present implementation

This was already declared in psci.h, but it was never defined/set.  Do
this now, so we can use it to decide if enable-method in /cpus FDT nodes
should be inspected later on.  While we're here, convert it to a
boolean.

Reviewed by: andrew (slightly earlier version)
Differential Revision: https://reviews.freebsd.org/D34553

2 years agoarm64: gic: disable the ITS if it's enabled prior to configuration
Kyle Evans [Sat, 19 Mar 2022 03:03:44 +0000 (22:03 -0500)]
arm64: gic: disable the ITS if it's enabled prior to configuration

The ITS is defined to be disabled on a warm reset, but we may be coming
in via another kernel/hypervisor type setup where the ITS has been
previously configured then relinquished to the next kernel in the chain.

If it's enabled, the later configuration of GITS_BASER will almost
certainly fail -- clear it to prevent that.

Reviewed by: andrew
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34546

2 years agoCorrect date in ObsoleteFiles.inc entry
Ed Maste [Sat, 19 Mar 2022 01:33:10 +0000 (21:33 -0400)]
Correct date in ObsoleteFiles.inc entry

Fixes: 92e6b4712b53 ("Retire broken snd_ds1 and ...")

2 years agoRetire broken snd_ds1 and snd_maestro drivers
Ed Maste [Fri, 18 Mar 2022 20:34:05 +0000 (16:34 -0400)]
Retire broken snd_ds1 and snd_maestro drivers

In 2012 joel@ reported[1] that these were not functional, and they do
not appear to have been fixed since.

[1] https://lists.freebsd.org/pipermail/freebsd-multimedia/2012-January/012751.html

Reported by: joel
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

2 years agoUpdate deprecation notice in snd_maestro, snd_ds1
Ed Maste [Fri, 18 Mar 2022 21:01:12 +0000 (17:01 -0400)]
Update deprecation notice in snd_maestro, snd_ds1

These drivers are broken and have been scheduled for removal since 2012.
They will finally be removed before FreeBSD 14.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoRemove snd_aureal driver source
Ed Maste [Fri, 18 Mar 2022 20:11:32 +0000 (16:11 -0400)]
Remove snd_aureal driver source

This driver was not finished when it was committed in 1999 and was never
connected to the build.

A version of the driver used to be available in ports as
audio/aureal-kmod, but it has been removed.  It did not build on FreeBSD
10.x or later and the binary objects it required were not available
after Google Code disappeared.

PR: 124343
Reported by: joel
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agouefi(8): Note i386 is unsupported
Warner Losh [Fri, 18 Mar 2022 20:12:39 +0000 (14:12 -0600)]
uefi(8): Note i386 is unsupported

We have no support for i386 booting at this time. Add that in the bugs section.

Sponsored by: Netflix

2 years agorc.subr.8: Format notes consistently
Mateusz Piotrowski [Fri, 18 Mar 2022 14:06:48 +0000 (15:06 +0100)]
rc.subr.8: Format notes consistently

MFC after: 3 days

2 years agonamei: Treat non-tied KLDs as if they had INVARIANTS enabled
Andrew Gallatin [Fri, 18 Mar 2022 14:14:14 +0000 (10:14 -0400)]
namei: Treat non-tied KLDs as if they had INVARIANTS enabled

When working with a vendor to debug their kernel module,
I found that a non-tied kld which uses NDINIT will panic
due to "namei: bad debugflags " on a kernel compiled with
INVARIANTS because non-tied KLDs do not pick up the
initialization that is done in NDINIT_DBG/NDREINIT_DBG().

Fix this by making this initialization happen for non-KLD_TIED
as well as INVARIANTS

Reviewed by: mjg
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34588

2 years agozfskeys: Support autoloading of keys stored on ZFS
Mateusz Piotrowski [Fri, 18 Mar 2022 12:35:16 +0000 (13:35 +0100)]
zfskeys: Support autoloading of keys stored on ZFS

The zfskeys service script starts before the zfs service script, so that
dataset decryption keys are available when `zfs mount -a` is run. One of
the potential edge cases of this design is that if a key is stored on
ZFS it won't be loaded until `zfs mount -a` is issued.

In order to address that let's try to load the additional keys and mount
related ZFS datasets after the zfs script finishes its standard mounting
procedure.

PR: 262468
Reported by: Graham Perrin <grahamperrin@gmail.com>
Reviewed by: allanjude
Approved by: allanjude (src)
Fixes: 33ff39796ffe Add zfskeys rc.d script for auto-loading encryption keys
MFC after: 3 days
Sponsored by: Modirum
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34601

2 years agomixer.3: Fix spelling
Hans Petter Selasky [Fri, 18 Mar 2022 11:08:55 +0000 (12:08 +0100)]
mixer.3: Fix spelling

Submitted by: christos@
Differential Revision: https://reviews.freebsd.org/D34378
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agouefi.8: Fix style
Mateusz Piotrowski [Fri, 18 Mar 2022 10:53:10 +0000 (11:53 +0100)]
uefi.8: Fix style

MFC after: 3 days

2 years agouefi.8: Document i386 and riscv EFI bootloader names
Mateusz Piotrowski [Fri, 18 Mar 2022 10:52:02 +0000 (11:52 +0100)]
uefi.8: Document i386 and riscv EFI bootloader names

Based on tools/boot/install-boot.sh.

MFC after: 2 weeks

2 years agogptboot.8: Fix a typo and fix lint warnings
Mateusz Piotrowski [Fri, 18 Mar 2022 09:07:18 +0000 (10:07 +0100)]
gptboot.8: Fix a typo and fix lint warnings

MFC after: 3 days

2 years agox86/tsc: fetch frequency from CPUID when running on Xen
Roger Pau Monné [Wed, 16 Mar 2022 08:56:40 +0000 (09:56 +0100)]
x86/tsc: fetch frequency from CPUID when running on Xen

Introduce a helper to fetch the TSC frequency from CPUID when running
under Xen.

Since the TSC can also be initialized early when running as a Xen
guest pull out the call to tsc_init() from the
early_clock_source_init() handlers and place it in clock_init(), as
otherwise all handlers would call tsc_init() anyway.

Reviewed by: markj
Sponsored by: Citrix Systems R&D
Differential revision: https://reviews.freebsd.org/D34581

2 years agoprocstat: remove set but not used variable
Piotr Pawel Stefaniak [Thu, 17 Mar 2022 21:53:00 +0000 (22:53 +0100)]
procstat: remove set but not used variable

In an earlier version of D26310, strcmp was strncmp.

2 years agobacklight: Remove set but not used variable
Piotr Pawel Stefaniak [Thu, 17 Mar 2022 21:37:15 +0000 (22:37 +0100)]
backlight: Remove set but not used variable

2 years agoloader.efi: Improve the manual page
Mateusz Piotrowski [Fri, 18 Mar 2022 08:54:23 +0000 (09:54 +0100)]
loader.efi: Improve the manual page

- Add SPDX tag
- Add a files section describing different locations related to the
  loader
- Add an example explaining how to install a new loader.efi to ESP
- Reference uefi(8)

Reviewed by: tsoome
Reviewed by: Pau Amma <pauamma@gundo.com>
Reviewed by: Jose Luis Duran <jlduran@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34592

2 years agostress2: Limit console warnings
Peter Holm [Fri, 18 Mar 2022 06:34:07 +0000 (07:34 +0100)]
stress2: Limit console warnings

2 years agostress2: Remove the memory disk after the fsck, not before
Peter Holm [Fri, 18 Mar 2022 06:28:58 +0000 (07:28 +0100)]
stress2: Remove the memory disk after the fsck, not before

2 years agobhyve: sweep MAX_VMNAME
Robert Wing [Fri, 18 Mar 2022 05:55:52 +0000 (21:55 -0800)]
bhyve: sweep MAX_VMNAME

MAX_VMNAME is no longer used.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D34292

2 years agobhyve/snapshot: limit snapshot filename to NAME_MAX
Robert Wing [Fri, 18 Mar 2022 05:51:31 +0000 (21:51 -0800)]
bhyve/snapshot: limit snapshot filename to NAME_MAX

NAME_MAX is a better fit since strcat_extension() constructs the
filename of the snapshot file.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34291

2 years agolibvmm: constify vm_get_name()
Robert Wing [Fri, 18 Mar 2022 05:26:54 +0000 (21:26 -0800)]
libvmm: constify vm_get_name()

Allows callers of vm_get_name() to retrieve the vm name without having
to allocate a buffer.

While in the vicinity, do minor cleanup in vm_snapshot_basic_metadata().

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D34290

2 years agobhyvectl: drop vm_get_name()
Robert Wing [Fri, 18 Mar 2022 05:22:43 +0000 (21:22 -0800)]
bhyvectl: drop vm_get_name()

Grab the vm name from bhyvectl's --vm flag instead.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D34399

2 years agosnd_hda.4: correct typos
Ed Maste [Fri, 18 Mar 2022 00:11:26 +0000 (20:11 -0400)]
snd_hda.4: correct typos

MFC after: 1 week

2 years agohda: add patch for Framework laptop headphone jack
Ed Maste [Thu, 17 Mar 2022 19:47:55 +0000 (15:47 -0400)]
hda: add patch for Framework laptop headphone jack

For Framework laptops built after Oct 2021 (like mine) that have a Tempo
Semiconductor 92HD95B codec rather than Realtek ALC295 (see
https://frame.work/ca/en/blog/solving-for-silicon-shortages).

As we do for many other laptops, put the headphone jack and speakers in
the same association by default so that the generic sound device
automatically switches between them.  Also specify the jack colour and
location.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34596

2 years agonetinet tests: only log critical errors from scapy
Kristof Provost [Thu, 17 Mar 2022 22:32:23 +0000 (23:32 +0100)]
netinet tests: only log critical errors from scapy

See also a26e895f3d.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agomount.8: mention that the snapshot option is exclusive
Robert Wing [Thu, 17 Mar 2022 22:31:16 +0000 (14:31 -0800)]
mount.8: mention that the snapshot option is exclusive

When using the snapshot option, all other options are ignored. This
update reflects changes made in ab2dbd9b871d.

Reviewed by: 0mp, mckusick
Differential Revision: https://reviews.freebsd.org/D34584

2 years agofusefs: Initialize a pad word in the mknod message
Mark Johnston [Thu, 17 Mar 2022 22:11:26 +0000 (18:11 -0400)]
fusefs: Initialize a pad word in the mknod message

Reported by: Jenkins (KMSAN job)
Reviewed by: asomers
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34593

2 years agopf tests: Test retrieving nested nat-anchors
Kristof Provost [Thu, 17 Mar 2022 17:33:50 +0000 (18:33 +0100)]
pf tests: Test retrieving nested nat-anchors

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopfctl: fix retrieving nested nat-anchors
Kristof Provost [Thu, 17 Mar 2022 17:31:37 +0000 (18:31 +0100)]
pfctl: fix retrieving nested nat-anchors

When retrieving nat rules in anchors we need to set the path just like
we do for regular rules.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf tests: Test setting and retrieving nested anchors
Kristof Provost [Thu, 17 Mar 2022 18:49:09 +0000 (19:49 +0100)]
pf tests: Test setting and retrieving nested anchors

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopfctl: fix retrieving nested anchors
Matteo Riondato [Thu, 17 Mar 2022 18:48:28 +0000 (19:48 +0100)]
pfctl: fix retrieving nested anchors

PR: 262622
MFC after: 1 week
Reviewed by: kp

2 years agohdac: Handle interrupts racing with device suspend
Mark Johnston [Wed, 16 Mar 2022 16:09:17 +0000 (12:09 -0400)]
hdac: Handle interrupts racing with device suspend

- Avoid looping forever if a concurrent reset causes a read of the
  interrupt status register to return all ones.
- Lock the softc before reading the interrupt status, so as to avoid a
  similar infinite loop in hdac_one_intr().

This fixes suspend-to-S3 on some laptops.

PR: 261207
Reviewed by: mav, imp
Tested by: uqs
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34117

2 years agoclock_gettime: Fix CLOCK_THREAD_CPUTIME_ID race
firk [Tue, 15 Mar 2022 22:22:21 +0000 (18:22 -0400)]
clock_gettime: Fix CLOCK_THREAD_CPUTIME_ID race

Use a spinlock section instead of a critical section to synchronize with
statclock().  Otherwise the CLOCK_THREAD_CPUTIME_ID clock can appear to
go backwards.

PR: 262273
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34568

2 years agofile: Move FILEDESC_FOREACH macros to kern_descrip.c
Mark Johnston [Thu, 17 Mar 2022 16:58:56 +0000 (12:58 -0400)]
file: Move FILEDESC_FOREACH macros to kern_descrip.c

They are only used in kern_descrip.c, so make them private.  No
functional change intended.

Discussed with: mjg
Sponsored by: The FreeBSD Foundation

2 years agofile: Avoid a read-after-free of fd tables in sysctl handlers
Mark Johnston [Thu, 17 Mar 2022 16:54:37 +0000 (12:54 -0400)]
file: Avoid a read-after-free of fd tables in sysctl handlers

Some loops access the fd table of a different process, and drop the
filedesc lock while iterating, so they check the table's refcount.
However, we access the table before the first iteration, in order to get
the number of table entries, and this access can be a use-after-free.

Fix the problem by checking the refcount before we start iterating.

Reported by: pho
Reviewed by: mjg
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34575

2 years agorc.d: Chmod +x all the scripts for consistency
Mateusz Piotrowski [Thu, 17 Mar 2022 16:20:57 +0000 (17:20 +0100)]
rc.d: Chmod +x all the scripts for consistency

Reviewed by: lwhsu
Approved by: lwhsu (src)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34589

2 years agoWITHOUT_BOOT build option appears to include stand, failing on libsa
Toomas Soome [Thu, 17 Mar 2022 17:42:05 +0000 (19:42 +0200)]
WITHOUT_BOOT build option appears to include stand, failing on libsa

building libsa needs to use -I${LDRSRC} for some files.

PR: 260083
Submitted by: Ivan Rozhuk
MFC: 1 day