]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agostand: zfs: handle holes at the tail end correctly
Kyle Evans [Thu, 21 Apr 2022 19:57:24 +0000 (14:57 -0500)]
stand: zfs: handle holes at the tail end correctly

This mirrors dmu_read_impl(), zeroing out the tail end of the buffer and
clipping the read to what's contained by the block that exists.

This fixes an issue that arose during the 13.1 release process; in
13.1-RC1 and later, setting up GELI+ZFS will result in a failure to
boot.  The culprit is this, which causes us to fail to load geom_eli.ko
as there's a residual portion after the single datablk that should be
zeroed out.

PR: 263407
Reviewed by: tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35019

2 years agobusdma_bounce: Batch bounce page free operations when possible.
John Baldwin [Thu, 21 Apr 2022 19:01:55 +0000 (12:01 -0700)]
busdma_bounce: Batch bounce page free operations when possible.

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

2 years agobusdma_bounce: Add free_bounce_pages helper function.
John Baldwin [Thu, 21 Apr 2022 17:42:14 +0000 (10:42 -0700)]
busdma_bounce: Add free_bounce_pages helper function.

Deduplicate code to iterate over the bpages list in a bus_dmamap_t
freeing bounce pages during bus_dmamap_unload.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34967

2 years agobusdma_bounce: Make the map waiting list per-bounce-zone.
John Baldwin [Thu, 21 Apr 2022 17:41:09 +0000 (10:41 -0700)]
busdma_bounce: Make the map waiting list per-bounce-zone.

When pages are freed to a bounce zone, only maps waiting for pages for
that zone can make forward progress.  If a map for a different bounce
zone is at the head of the global list, then requests that could
otherwise make forward progress will be stalled waiting on the other
bounce zone.  If bounce zones shared bounce pages then a global list
would still make sense to prevent "later" requests from starving an
earlier request but that is not a concern with per-zone bounce page
pools.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34966

2 years agobusdma_bounce: Use a simple kproc to invoke deferred requests.
John Baldwin [Thu, 21 Apr 2022 17:40:35 +0000 (10:40 -0700)]
busdma_bounce: Use a simple kproc to invoke deferred requests.

Rather than using a software interrupt with a single handler, just
create a dedicated kernel process woken up with a simple wakeup().

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34965

2 years agoRun softclock threads at a hardware ithread priority.
John Baldwin [Thu, 21 Apr 2022 17:40:01 +0000 (10:40 -0700)]
Run softclock threads at a hardware ithread priority.

Add a new PI_SOFTCLOCK for use by softclock threads.  Currently this
maps to PI_AV which is the second-highest ithread priority.

Reviewed by: mav, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33693

2 years agoacpi_toshiba: Use device_get_softc in attach.
John Baldwin [Thu, 21 Apr 2022 17:29:15 +0000 (10:29 -0700)]
acpi_toshiba: Use device_get_softc in attach.

Rather than a detour via the devclass and hardcoding unit 0.

While here, remove a check for sc being NULL.  It will never be NULL
when attach is called.

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

2 years agovgapm: Use devclass_find to lookup the vga devclass in suspend and resume.
John Baldwin [Thu, 21 Apr 2022 17:29:15 +0000 (10:29 -0700)]
vgapm: Use devclass_find to lookup the vga devclass in suspend and resume.

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

2 years agoFB_INSTALL_CDEV: Remove this option and related code.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
FB_INSTALL_CDEV: Remove this option and related code.

This option was never enabled in GENERIC and does not appear to work
(the cdevsw is stored in a global array but never passed to make_dev
to be associated with a character device).

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

2 years agosc: Use devclass_find to lookup the sc devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
sc: Use devclass_find to lookup the sc devclass.

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

2 years agoarcmsr: Remove never-true NULL check from cdev callbacks.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
arcmsr: Remove never-true NULL check from cdev callbacks.

si_drv1 will always hold a non-NULL pointer.

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

2 years agoarcmsr: Store softc pointer in si_drv1 of cdev.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
arcmsr: Store softc pointer in si_drv1 of cdev.

Rather than fetching the softc using the controller's unit number as
an index into the devclass.

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

2 years agoccp: Use devclass_find to lookup devclass in db_show_ccp.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
ccp: Use devclass_find to lookup devclass in db_show_ccp.

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

2 years agocpufreq_curr_sysctl: Use devclass_find to lookup cpufreq devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
cpufreq_curr_sysctl: Use devclass_find to lookup cpufreq devclass.

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

2 years agohidbus: Use devclass_find to lookup the devclass for hidbus.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
hidbus: Use devclass_find to lookup the devclass for hidbus.

Reviewed by: wulf, imp
Differential Revision: https://reviews.freebsd.org/D35000

2 years agotwe: Use devclass_find in twe_report debug function.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
twe: Use devclass_find in twe_report debug function.

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

2 years agopcm: Initialize pcm_devclass in sound_modevent.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
pcm: Initialize pcm_devclass in sound_modevent.

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

2 years agopcm: Remove dead code from sound_modevent.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
pcm: Remove dead code from sound_modevent.

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

2 years agosmbios/vpd: Use devclass_find to lookup devclass in module event handler.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
smbios/vpd: Use devclass_find to lookup devclass in module event handler.

While here, use a modern function declaration for smbios_modevent and
vpd_modevent.

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

2 years agonvme: Use devclass_find to lookup the nvme devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
nvme: Use devclass_find to lookup the nvme devclass.

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

2 years agomlx: Use devclass_find to lookup the devclass for mlxd.
John Baldwin [Thu, 21 Apr 2022 17:29:14 +0000 (10:29 -0700)]
mlx: Use devclass_find to lookup the devclass for mlxd.

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

2 years agohptiop: Store softc pointer in si_drv1 of cdev.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
hptiop: Store softc pointer in si_drv1 of cdev.

Rather than fetching the softc using the controller's unit number as
an index into the devclass.

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

2 years agoacpi_tz: Lookup devclass by name when needed.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_tz: Lookup devclass by name when needed.

Cache the value in a local variable in the worker thread.

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

2 years agoacpi_isab: Check the unit in probe instead of using the devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_isab: Check the unit in probe instead of using the devclass.

This is an alternate way to only attach to isab0 for the reasons
described in commit 852989bdbf62932455d48342d9d45dfbab4e65dc.

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

2 years agoacpi_hpet: Use devclass_find to find devclass in identify.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_hpet: Use devclass_find to find devclass in identify.

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

2 years agoacpi_ec: Use device_get_devclass to find devclass in probe.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_ec: Use device_get_devclass to find devclass in probe.

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

2 years agoacpi_cpu: Use device_get_devclass to find devclass in attach.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_cpu: Use device_get_devclass to find devclass in attach.

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

2 years agoacpi_apei: Use devclass_find to find devclass in identify.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_apei: Use devclass_find to find devclass in identify.

Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D34987

2 years agoacpi_acad: Use devclass_find to find the acpi_acad devclass.
John Baldwin [Thu, 21 Apr 2022 17:29:13 +0000 (10:29 -0700)]
acpi_acad: Use devclass_find to find the acpi_acad devclass.

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

2 years agomld6: Ensure that mld_domifattach() always succeeds
Mark Johnston [Thu, 21 Apr 2022 17:22:09 +0000 (13:22 -0400)]
mld6: Ensure that mld_domifattach() always succeeds

mld_domifattach() does a memory allocation under the global MLD mutex
and so can fail, but no error handling prevents a null pointer
dereference in this case.  The mutex is only needed when updating the
global softc list; the allocation and static initialization of the softc
does not require this mutex.  So, reduce the scope of the mutex and use
M_WAITOK for the allocation.

PR: 261457
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34943

2 years agopf: counter argument to pfr_pool_get() may never be NULL
Kristof Provost [Thu, 21 Apr 2022 12:53:05 +0000 (14:53 +0200)]
pf: counter argument to pfr_pool_get() may never be NULL

Coverity points out that if counter was NULL when passed to
pfr_pool_get() we could potentially end up dereferencing it.
Happily all users of the function pass a non-NULL pointer. Enforce this
by assertion and remove the pointless NULL check.

Reported by: Coverity (CID 273309)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopfsync: NULL check before dereference
Kristof Provost [Thu, 21 Apr 2022 12:40:32 +0000 (14:40 +0200)]
pfsync: NULL check before dereference

Move the use of 'sc' to after the NULL check.
It's very unlikely that we'd actually hit this, but Coverity is correct
that it's not a good idea to dereference the pointer and only then NULL
check it.

Reported by: Coverity (CID 1398362)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: remove pointless NULL check
Kristof Provost [Thu, 21 Apr 2022 12:33:48 +0000 (14:33 +0200)]
pf: remove pointless NULL check

pfi_kkif_attach() always returns non-NULL, and we dereference the
pointer before we check it, so that's pointless.

Reported by: Coverity (CID 1007345)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoctf: Link CTF toolchain man pages to ctf.5
Mark Johnston [Thu, 21 Apr 2022 14:56:03 +0000 (10:56 -0400)]
ctf: Link CTF toolchain man pages to ctf.5

Also expand the CTF acronym to provide a bit of context.

PR: 259790
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoctfdump: Remove definitions of warn() and vwarn()
Mark Johnston [Thu, 21 Apr 2022 14:49:22 +0000 (10:49 -0400)]
ctfdump: Remove definitions of warn() and vwarn()

The presence of the latter causes a link error when building a
statically linked ctfdump(1) because libc defines the same symbol.
libc's warn() is defined as a weak symbol and so does not cause the same
problem, but let's just use libc's version.

Reported by: stephane rochoy <stephane.rochoy@stormshield.eu>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoxhci(4): Ensure the so-called data toggle gets properly reset.
Hans Petter Selasky [Thu, 21 Apr 2022 14:59:09 +0000 (16:59 +0200)]
xhci(4): Ensure the so-called data toggle gets properly reset.

Use the drop and enable endpoint context commands to force a reset of
the data toggle for USB 2.0 and USB 3.0 after:
 - clear endpoint halt command (when the driver wishes).
 - set config command (when the kernel or user-space wants).
 - set alternate setting command (only affected endpoints).

Some XHCI HW implementations may not allow the endpoint reset command when
the endpoint context is not in the halted state.

Reported by: Juniper and Gary Jennejohn
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agolocales: Update to CLDR 41.0 and Unicode 14.0
Baptiste Daroussin [Thu, 21 Apr 2022 09:36:42 +0000 (11:36 +0200)]
locales: Update to CLDR 41.0 and Unicode 14.0

Relnotes: yes

2 years agoif_bnxt: Allow bnxt interfaces to use vlans
Misho [Thu, 21 Apr 2022 08:24:04 +0000 (09:24 +0100)]
if_bnxt: Allow bnxt interfaces to use vlans

When VLAN HW filter is disabled, the NIC does not pass any vlan tagged
traffic. Setting these flags on the device allows vlan tagged traffic to
pass.

PR: 236983
Tested by: pi
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34824

2 years agopfctl tests: fix Ethernet output expectations
Kristof Provost [Thu, 21 Apr 2022 08:24:44 +0000 (10:24 +0200)]
pfctl tests: fix Ethernet output expectations

Since a16732d670 we always print the l3 src/destination for Ethernet
rules. Update the tests to account for this.

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

2 years agoFix sigtimedwait manpage.
Dmitry Chagin [Thu, 21 Apr 2022 07:52:29 +0000 (10:52 +0300)]
Fix sigtimedwait manpage.

Historically, sigtimedwait() blocks indefinitely if timeout is NULL.

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

2 years agoifconfig: Fix spelling error
Warner Losh [Wed, 20 Apr 2022 23:57:42 +0000 (17:57 -0600)]
ifconfig: Fix spelling error

s/discreet/discrete

Reported by: Diane Bruce

2 years agosyscons: silent 'set but unused' warning in some configurations
Konstantin Belousov [Wed, 20 Apr 2022 22:11:24 +0000 (01:11 +0300)]
syscons: silent 'set but unused' warning in some configurations

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agodev/iommu: Include offset in maxaddr check.
Doug Moore [Wed, 20 Apr 2022 22:24:11 +0000 (17:24 -0500)]
dev/iommu: Include offset in maxaddr check.

If iommu_gas_match_one has to adjust for a boundary crossing, its
check against maxaddr includes 'offset' in its calculation, to ensure
that the allocated memory does not exceed the max address. However, if
there's no boundary crossing adjustment, then the maxaddr check
disregards 'offset'. Fix that.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34978

2 years agoctlstat: add prometheus output
Alan Somers [Wed, 21 Apr 2021 22:56:48 +0000 (16:56 -0600)]
ctlstat: add prometheus output

When invoked by inetd, ctlstat -P will now produce output suitable for
ingestion into Prometheus.

It's a drop-in replacement for https://github.com/Gandi/ctld_exporter,
except that it doesn't report the number of initiators per target, and
it does report time and dma_time.

MFC after: 2 weeks
Sponsored by: Axcient
Relnotes: yes
Reviewed by:  bapt, bcr
Differential Revision: https://reviews.freebsd.org/D29901

2 years agobsddialog(3): fix disabled shadow
Alfonso S. Siciliano [Wed, 20 Apr 2022 15:39:43 +0000 (17:39 +0200)]
bsddialog(3): fix disabled shadow

Fix dialogs building and updating fault with disabled shadow
(conf.shadow=false and implicitly bsddialog --no-shadow).

While here delete WARNS=2: all warnings were fixed in upstream and
imported in 0.2.

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

2 years agorrenumd: remove a set-but-not-used variable
Stefan Eßer [Wed, 20 Apr 2022 15:02:24 +0000 (17:02 +0200)]
rrenumd: remove a set-but-not-used variable

2 years agolibfetch: remove a set-but-not-uswed variable
Stefan Eßer [Wed, 20 Apr 2022 14:56:57 +0000 (16:56 +0200)]
libfetch: remove a set-but-not-uswed variable

2 years agoBump Dd in getdirentries.2 after c6487446.
Dmitry Chagin [Wed, 20 Apr 2022 14:55:32 +0000 (17:55 +0300)]
Bump Dd in getdirentries.2 after c6487446.

MFC after: 1 week

2 years agoHave posixshm_test ask the kernel for the page size
Andrew Turner [Wed, 20 Apr 2022 13:44:52 +0000 (14:44 +0100)]
Have posixshm_test ask the kernel for the page size

It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

Reviewed by: markj, kib, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34961

2 years agoFill the page size array in one posix shm test
Andrew Turner [Tue, 19 Apr 2022 16:22:37 +0000 (17:22 +0100)]
Fill the page size array in one posix shm test

The largepage_config posix shared memory test was failing on arm64 as
the page size array is never filled out. Fix this by calling
getpagesizes(3), via pagesizes.

Reviewed by: markj, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34960

2 years agocallout: fix using shared rmlocks
Kristof Provost [Tue, 19 Apr 2022 15:01:25 +0000 (17:01 +0200)]
callout: fix using shared rmlocks

15b1eb142c changed the callout code to store the CALLOUT_SHAREDLOCK flag
in c_iflags (where it used to be c_flags), but failed to update the
check in softclock_call_cc(). This resulted in the callout code always
taking the write lock, even if a read lock had been requested (with
the CALLOUT_SHAREDLOCK flag in callout_init_rm()).

Reviewed by: markj
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34959

2 years agopfctl: always print 'l3' source/destination
Kristof Provost [Tue, 12 Apr 2022 11:29:56 +0000 (13:29 +0200)]
pfctl: always print 'l3' source/destination

While the kernel only performs the L3 check for
ETHERTYPE_IP/ETHERTYPE_IP6 we should always print the source and
destination addresses.

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

2 years agopf: allow the use of tables in ethernet rules
Kristof Provost [Tue, 12 Apr 2022 11:20:18 +0000 (13:20 +0200)]
pf: allow the use of tables in ethernet rules

Allow tables to be used for the l3 source/destination matching.
This requires taking the PF_RULES read lock.

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

2 years agosed(1): Fix a typo in the manual page
Gordon Bergling [Wed, 20 Apr 2022 11:00:42 +0000 (13:00 +0200)]
sed(1): Fix a typo in the manual page

- s/occurances/occurrences/

MFC after: 3 days

2 years agolibsa: Fix a typo in a panic message
Gordon Bergling [Wed, 20 Apr 2022 10:56:52 +0000 (12:56 +0200)]
libsa: Fix a typo in a panic message

- s/occured/occurred/

MFC after: 3 days

2 years agoiicbus(4): Fix two typos in kernel error messages
Gordon Bergling [Wed, 20 Apr 2022 10:55:44 +0000 (12:55 +0200)]
iicbus(4): Fix two typos in kernel error messages

- s/occured/occurred/

MFC after:3 days

2 years agooce(4): Fix a typo in a sysctl description
Gordon Bergling [Wed, 20 Apr 2022 10:51:52 +0000 (12:51 +0200)]
oce(4): Fix a typo in a sysctl description

- s/interupt/interrupt/

MFC after: 3 days

2 years agotslog(4): Fix a typo in the manual page
Gordon Bergling [Wed, 20 Apr 2022 10:33:00 +0000 (12:33 +0200)]
tslog(4): Fix a typo in the manual page

- s/schedulling/scheduling/

MFC after: 3 days

2 years agolibpfctl: grow request buffer on ENOSPC
Kristof Provost [Thu, 14 Apr 2022 12:08:53 +0000 (14:08 +0200)]
libpfctl: grow request buffer on ENOSPC

When we issue a request to pf and expect a serialised nvlist as a reply
we have to supply a suitable buffer to the kernel.
The required size for this buffer is difficult to predict, and may be
(slightly) different from request to request.
If it's insufficient the kernel will return ENOSPC. Teach libpfctl to
catch this and send the request again with a larger buffer.

MFC after: 2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34908

2 years agodmar: Disable PMR in driver attach routine
Kornel Duleba [Thu, 14 Apr 2022 10:55:53 +0000 (12:55 +0200)]
dmar: Disable PMR in driver attach routine

Previously it was disabled right before translation was enabled.
This way the disable logic is still executed even when translation
is not be activated, e.g. with hw.iommu.dma=0 tunable set.
On some platforms we need to disable PMR in order for core dump to work.
At the same time it was observed that enabling translation has
a significant impact on network performance.
With this patch PMR can be disabled, with IOMMU translation not being
turned on by appending the following to the loader.conf:

hw.dmar.enable=1
hw.dmar.pmr.disable=1
hw.dmar.dma=0

Sponsored by: Stormshield
Obtained from: Semihalf
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34907

2 years agomac_pimd: Support for privilege drop in pimd
Wojciech Macek [Tue, 19 Apr 2022 07:53:19 +0000 (09:53 +0200)]
mac_pimd: Support for privilege drop in pimd

Create new kernel module for privilege check in case
the user wants to run pimd daemon.

Sponsored by: Stormshield
Obtained from: Semihalf

2 years agocapsicum: briefly describe capabilities in man page
Ed Maste [Tue, 19 Apr 2022 19:44:46 +0000 (15:44 -0400)]
capsicum: briefly describe capabilities in man page

Provide a very brief introduction to capabilities, using a couple of
sentences from David Chisnall's mailing list response[1] to a question
about Linux capabilities and Capsicum.

Mailing list subject (in case the archive URL changes) was
Re: Linux capabilities to Capsicum

[1] https://lists.freebsd.org/archives/freebsd-hackers/2022-April/001032.html

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

2 years agosctp: cleanup
Michael Tuexen [Tue, 19 Apr 2022 19:40:22 +0000 (21:40 +0200)]
sctp: cleanup

MFC after: 3 days

2 years agosctp: improve stopping of timers
Michael Tuexen [Tue, 19 Apr 2022 19:29:41 +0000 (21:29 +0200)]
sctp: improve stopping of timers

Reported by: syzbot+c9c70062320aaad19de7@syzkaller.appspotmail.com
MFC after: 3 days

2 years agoBump Dd in manpages after removing devclass from DRIVER_MODULE.
John Baldwin [Tue, 19 Apr 2022 17:46:39 +0000 (10:46 -0700)]
Bump Dd in manpages after removing devclass from DRIVER_MODULE.

Fixes: 2a99dd30dfaa Deprecate the 'devclass' argument from *DRIVER_MODULE() macros.
MFC after: 2 weeks

2 years agocxgbe: Remove unused devclass arguments to *DRIVER_MODULE().
John Baldwin [Tue, 19 Apr 2022 17:44:08 +0000 (10:44 -0700)]
cxgbe: Remove unused devclass arguments to *DRIVER_MODULE().

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

2 years agoDeprecate the 'devclass' argument from *DRIVER_MODULE() macros.
John Baldwin [Tue, 19 Apr 2022 17:43:06 +0000 (10:43 -0700)]
Deprecate the 'devclass' argument from *DRIVER_MODULE() macros.

This argument is useless for the vast majority of drivers.  For now,
use __VA_ARGS__ wrapper macros so that that the *DRIVER_MODULE()
macros accept both the old version (with a devclass) and the new
version (which omits the argument and stores NULL in the
driver_module_data structure).  This provides an API compatiblity
shim that can be merged to older stable branches.

Once all drivers relevant to 14.0 (both in and out of tree) have been
updated, the API compat shims can be dropped.

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

2 years agodevclass_add_driver: Permit NULL to be passed in dcp.
John Baldwin [Tue, 19 Apr 2022 17:42:38 +0000 (10:42 -0700)]
devclass_add_driver: Permit NULL to be passed in dcp.

This permits a driver module structure that doesn't want to store a
pointer to the new driver's devclass.

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

2 years agoMerge libcxxrt commit 45ca8b1942090226ba9368caeeeabc0d4ee41ad6
Dimitry Andric [Tue, 19 Apr 2022 16:11:11 +0000 (18:11 +0200)]
Merge libcxxrt commit 45ca8b1942090226ba9368caeeeabc0d4ee41ad6

  Insert padding in __cxa_exception struct for compatibility

  Similar to https://github.com/llvm/llvm-project/commit/f2a436058fcb, the
  addition of __attribute__((__aligned__)) to _Unwind_Exception (in commit
  b9616964) causes implicit padding to be inserted before the unwindHeader
  field in __cxa_exception.

  Applications attempt to get at the earlier fields in __cxa_exception, so
  preserve the same negative offsets in __cxa_exception, by moving the
  padding to the beginning of the struct.

  The assumption here is that if the ABI is not aware of the padding
  before unwindHeader and put the referenceCount/primaryException in
  there, no padding should exist before unwindHeader.

This should make libreoffice's custom exception handling mechanisms work
correctly, even if it was built against an older cxxabi.h/unwind.h pair.

PR: 263370
MFC after: 3 days

2 years agodiff3: Add support for -m
Tom Jones [Tue, 19 Apr 2022 15:20:24 +0000 (16:20 +0100)]
diff3: Add support for -m

diff3 in -m mode generates a complete file with changes bracketed with
conflict markers. This adds support for diff3 to generate version
control style three way merge output.

The output format was inferred from looking at the gnu diff3 output on a
selection of test files as a specification of what diff3 -m should
output is not available. It is likely there are cases where the -m
output differs from other tools and I am happy to update diff3 to
address these.

Discussed with: pstef, kevans
Sponsored by: Klara, Inc.

2 years agovideomode: Fix a typo in an kernel message
Gordon Bergling [Tue, 19 Apr 2022 15:09:52 +0000 (17:09 +0200)]
videomode: Fix a typo in an kernel message

- s/Seperate/Separate/

Obtained from: NetBSD
MFC after: 3 days

2 years agodiff3: Add support for -A
Tom Jones [Tue, 19 Apr 2022 14:43:35 +0000 (15:43 +0100)]
diff3: Add support for -A

Diff3 in -A mode generates an ed script to show how the 3 files and
brackets changes that conflict. The ed script generated should when
applied leave familiar merge conflict markers in a patched file.

Diff3 output is not documented, this feature has been arrived at by
comparing bsd diff3 output to gnu diff3 output until they were made to
agree. There are likely to still be differences between these formats.

The gnu diff3 guide is actually quite good at explaining how diff3
output should appear, but it doesn't cover every form of output from
diff3.

https://www.gnu.org/software/diffutils/manual/diffutils.html#Comparing-Three-Files

Discussed with: pstef, kevans
Sponsored by: Klara, Inc.

2 years agoffs: plug a set-but-not-used var
Stefan Eßer [Tue, 19 Apr 2022 14:48:59 +0000 (16:48 +0200)]
ffs: plug a set-but-not-used var

2 years agoinetd(8): Fix a typo in the manual page
Gordon Bergling [Tue, 19 Apr 2022 14:48:55 +0000 (16:48 +0200)]
inetd(8): Fix a typo in the manual page

- s/similarily/similarly/

MFC after: 3 days

2 years agodiff3: seperate old and new markers from file markers
Tom Jones [Tue, 19 Apr 2022 14:38:30 +0000 (15:38 +0100)]
diff3: seperate old and new markers from file markers

With -A and -m output the conflict markers are not tied to the file
name. Seperate out these markers.

Sponsored by: Klara, Inc.

2 years agossh: remove duplicate setting of MAIL env var
Ed Maste [Mon, 18 Apr 2022 23:57:48 +0000 (19:57 -0400)]
ssh: remove duplicate setting of MAIL env var

We already set it earlier in do_setup_env().

Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agodiff3: Clean up printing of ranges for edscript output
Tom Jones [Tue, 19 Apr 2022 13:47:07 +0000 (14:47 +0100)]
diff3: Clean up printing of ranges for edscript output

Replace the edscript code that tracked and printed lines using byte
offsets with code that can work from line offsets.

This tidies up the reduces duplication in the edscript output code. It
also fixes the usage of the de struct so that it only tracks diffs as
line offsets rather than the usage changing from line offsets to byte
offsets during the lifetime of diff3.

Large files with large numbers of ranges will probably suffer in
performance here, but as we don't use diff3 yet this isn't a regression.
Include a warning for future hackers so they have a place to start
hacking from.

Reviewed by: pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34941

2 years agoprometheus_sysctl_exporter: fix metric aliasing
Alan Somers [Mon, 18 Apr 2022 21:29:37 +0000 (15:29 -0600)]
prometheus_sysctl_exporter: fix metric aliasing

When exporting sysctls to Prometheus, the exporter replaces "." with
"_".  This caused several metrics to alias, confusing the Prometheus
server.  Fix it by:

* Renaming the "tcp_log_bucket" UMA zone to "tcp_log_id_bucket".  Also,
  rename "tcp_log_node" to "tcp_log_id_node" for consistency.

* Not exporting sysctls with "(LEGACY)" in the description.  That is
  used by ZFS sysctls that have been replaced by others, many of which
  alias to the same Prometheus metric name (like "vfs.zfs.arc_max" and
  "vfs.zfs.arc.max").

PR: 259607
Reported by: delphij
MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: delphij,rew,thj
Differential Revision: https://reviews.freebsd.org/D34952

2 years agosfxge: plug set-but-not-used vars
Mateusz Guzik [Tue, 19 Apr 2022 12:44:12 +0000 (12:44 +0000)]
sfxge: plug set-but-not-used vars

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

2 years agotcp: plug set-but-not-used vars
Mateusz Guzik [Tue, 19 Apr 2022 12:36:17 +0000 (12:36 +0000)]
tcp: plug set-but-not-used vars

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

2 years agosignals: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 12:33:19 +0000 (12:33 +0000)]
signals: plug a set-but-not-used var

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

2 years agosctp: plug set-but-not-used vars
Mateusz Guzik [Tue, 19 Apr 2022 12:32:24 +0000 (12:32 +0000)]
sctp: plug set-but-not-used vars

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

2 years agolinux: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 12:29:46 +0000 (12:29 +0000)]
linux: plug a set-but-not-used var

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

2 years agoext2: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 12:28:22 +0000 (12:28 +0000)]
ext2: plug a set-but-not-used var

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

2 years agocxgbe: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 12:26:31 +0000 (12:26 +0000)]
cxgbe: plug a set-but-not-used var

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

2 years agosctp: hold the inp lock while calling ip6_output
Michael Tuexen [Tue, 19 Apr 2022 11:03:08 +0000 (13:03 +0200)]
sctp: hold the inp lock while calling ip6_output

This fixes an issue with handling IPPROTO_IPV6 level socket
options.

Reported by: syzbot+66ede232c3d1271c6226@syzkaller.appspotmail.com
MFC after: 3 days

2 years agouart: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 09:34:55 +0000 (09:34 +0000)]
uart: plug a set-but-not-used var

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

2 years agotcp/rack: plug a set-but-not-used var
Mateusz Guzik [Tue, 19 Apr 2022 09:33:35 +0000 (09:33 +0000)]
tcp/rack: plug a set-but-not-used var

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

2 years agodiff: tests: loosen up requirements for report_identical
Kyle Evans [Tue, 19 Apr 2022 04:04:13 +0000 (23:04 -0500)]
diff: tests: loosen up requirements for report_identical

This test cannot run without an unprivileged_user being specified
anyways, so just run as the unprivileged user.  Revoking read permisions
works just as well if you're guaranteed non-root.

Reviewed by: pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34950

2 years agofusefs: correctly handle servers that report too much data written
Alan Somers [Mon, 18 Apr 2022 23:03:53 +0000 (17:03 -0600)]
fusefs: correctly handle servers that report too much data written

During a FUSE_WRITE, the kernel requests the server to write a certain
amount of data, and the server responds with the amount that it actually
did write.  It is obviously an error for the server to write more than
it was provided, and we always treated it as such, but there were two
problems:

* If the server responded with a huge amount, greater than INT_MAX, it
  would trigger an integer overflow which would cause a panic.

* When extending the file, we wrongly set the file's size before
  validing the amount written.

PR: 263263
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34955

2 years agoMake -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds.
John Baldwin [Mon, 18 Apr 2022 23:06:27 +0000 (16:06 -0700)]
Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds.

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

2 years agoRe-enable set but not used warnings for kernel builds.
John Baldwin [Mon, 18 Apr 2022 23:06:14 +0000 (16:06 -0700)]
Re-enable set but not used warnings for kernel builds.

make tinderbox now passes with this warning enabled as a fatal error,
so revert the change to hide it in preparation for making it fatal.

This reverts commit e8e691983bb75e80153b802f47733f1531615fa2.

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

2 years agoif_vtnet: improve dumping a kernel
Michael Tuexen [Mon, 18 Apr 2022 22:40:31 +0000 (00:40 +0200)]
if_vtnet: improve dumping a kernel

Disable software LRO during kernel dumping, because having it enabled
requires to be in a network epoch, which might or might not be the
case depending on the code path resulting in the panic.

Reviewed by: markj
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34787

2 years agossh: apply style(9) to version_addendum
Ed Maste [Mon, 18 Apr 2022 21:20:25 +0000 (17:20 -0400)]
ssh: apply style(9) to version_addendum

Reported by: allanjude (in review D29953)
Fixes: 462c32cb8d7a ("Upgrade OpenSSH to 6.1p1.")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agopath_test: Verify that operations on unlinked files work
Mark Johnston [Mon, 18 Apr 2022 21:46:04 +0000 (17:46 -0400)]
path_test: Verify that operations on unlinked files work

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agogeli: Add a chicken switch for unmapped I/O
Mark Johnston [Mon, 18 Apr 2022 21:16:10 +0000 (17:16 -0400)]
geli: Add a chicken switch for unmapped I/O

We have a report of a panic in GELI that appears to go away when
unmapped I/O is disabled.  Add a tunable to make such investigations
easier in the future.  No functional change intended.

PR: 262894
Reviewed by: asomers
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34944

2 years agoMerge bearssl-20220418
Simon J. Gerraty [Mon, 18 Apr 2022 21:47:09 +0000 (14:47 -0700)]
Merge bearssl-20220418

Main change is a callback for checking validity period of certificates.

Merge commit 'f6acb9b9f81c96ae7c9592bee1bb89c4357cc3e5'

Add -DHAVE_BR_X509_TIME_CHECK to libsecureboot/Makefile.inc

2 years agoarm ti_mbox_attach: Write sysconfig to TI_MBOX_SYSCONFIG to request reset.
John Baldwin [Mon, 18 Apr 2022 21:09:20 +0000 (14:09 -0700)]
arm ti_mbox_attach: Write sysconfig to TI_MBOX_SYSCONFIG to request reset.

This variable was flagged as a set but unused warning as its value was
read from a register and then modified to set a bit
(TI_MBOX_SYSCONFIG_SOFTRST).  After the variable is modified, the code
then loops waiting for the SOFTRST bit to go clear in the
TI_MBOX_SYSCONFIG register.  Presumably merely reading from the
register does not request a reset as other places in the driver read
this register, so most likely the updated value of sysconfig setting
the reset bit is supposed to be written to the register to request a
reset before the polling loop that waits for the reset to finish.

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

2 years agomachine/in_cksum.h: don't include sys/cdefs.h
Brooks Davis [Mon, 18 Apr 2022 20:02:19 +0000 (21:02 +0100)]
machine/in_cksum.h: don't include sys/cdefs.h

All consumers already do it and it was required on amd64 and i386
until recently (1c1bf5bd7c1e479a7889839b941f53e689aa2569).

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

2 years agoUpdate libsecureboot
Simon J. Gerraty [Mon, 18 Apr 2022 19:53:53 +0000 (12:53 -0700)]
Update libsecureboot

Preparation for updating bearssl, pull in updates to libsecureboot.

o fix handling of some out-of-memory cases

o allow more control over reporting of Verified/Unverified files.
  this helps boot time when console output is slow

  o recheck verbose/debug level after reading any unverified file

o more debug support for vectx

o hash_string to support fake stat for tftp

o tests/tvo add -v to simply verify signatures

o vets.c allow for HAVE_BR_X509_TIME_CHECK which will greatly simplify
  verification in loader

o report date when certificate fails validity period checks

Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.