]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
18 months agozpool: install vdevprops(7) man page
Yuri [Fri, 24 Feb 2023 20:15:20 +0000 (21:15 +0100)]
zpool: install vdevprops(7) man page

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/666

18 months agoXref rc.conf in my previous addition.
Poul-Henning Kamp [Sat, 25 Feb 2023 16:08:06 +0000 (16:08 +0000)]
Xref rc.conf in my previous addition.

Prodded by: karels

18 months agock_queue: add CK_*_FOREACH_FROM
Mark Johnston [Sat, 25 Feb 2023 15:21:19 +0000 (10:21 -0500)]
ck_queue: add CK_*_FOREACH_FROM

This is a variant of CK_*_FOREACH from FreeBSD queue.h which starts
iteration at the specified item.  If the item pointer is NULL, iteration
starts from the beginning of the list.

Upstream commit 74366be35a6f4635f248a3c62d2d23245a4eb0f4.

MFC after: 2 weeks
Sponsored by: Klara, Inc.

18 months agosys/conf/NOTES: clean up whitespace
Mike Karels [Sat, 25 Feb 2023 14:04:00 +0000 (08:04 -0600)]
sys/conf/NOTES: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

I missed this file on the last pass.

18 months agoinet6_opt_init.3: Some enhancements
Gordon Bergling [Sat, 25 Feb 2023 13:11:27 +0000 (14:11 +0100)]
inet6_opt_init.3: Some enhancements

- Be consistent with RFC references, so add a space after 'RFC'
- Add a LIBRARY section
- Use standard integer types in the SYNOPSIS section

Obtained from: DragonflyBSD
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D27548

18 months agoUPDATING
Michael Paepcke [Tue, 21 Feb 2023 05:36:24 +0000 (05:36 +0000)]
UPDATING

Add notice to kernel options KBD_DELAY1 and KBD_DELAY2

Reviewed by: imp (tweaked whitespace too)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

18 months agosys/conf/NOTES add new KBD_DELAY kernel options
Michael Paepcke [Tue, 21 Feb 2023 06:17:00 +0000 (06:17 +0000)]
sys/conf/NOTES add new KBD_DELAY kernel options

add section for new kernel keyboard options

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

18 months agokbd: ukbd.4 and atkbdc.4 add section about new kernel options
Michael Paepcke [Tue, 21 Feb 2023 05:41:18 +0000 (05:41 +0000)]
kbd: ukbd.4 and atkbdc.4 add section about new kernel options

add section about  new kernel options KBD_DELAY1 and KBD_DELAY2

Reviewed by: imp (small tweaks to man page)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

18 months agokbd: add KBD_DELAY1 and KBD_DELAY2
Michael Paepcke [Sat, 18 Feb 2023 09:11:37 +0000 (09:11 +0000)]
kbd: add KBD_DELAY1 and KBD_DELAY2

Allow to configure KBD_DELAY* via KERNCONF for user-land less embedded
and security appliances

Reviewed by: imp (folded)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

18 months agolockstat: Use gelf.h instead of playing games with the preprocessor
Mark Johnston [Sat, 25 Feb 2023 01:15:21 +0000 (20:15 -0500)]
lockstat: Use gelf.h instead of playing games with the preprocessor

This reverts a portion of 1477dd823ee ("Merge OpenZFS support in to
HEAD.").  No functional change intended.

MFC after: 1 week

18 months agolockstat: Use the correct type for a symbol size
Mark Johnston [Sat, 25 Feb 2023 01:11:08 +0000 (20:11 -0500)]
lockstat: Use the correct type for a symbol size

No functional change intended.

MFC after: 1 week

18 months agogh-bc: don't disable LTO on powerpc64
Piotr Kubaj [Fri, 24 Feb 2023 13:26:31 +0000 (14:26 +0100)]
gh-bc: don't disable LTO on powerpc64

Summary:
The LTO issue has been fixed. While -flto for some reason is commented out,
since it wasn't completely removed, it may be expected to be reenabled.

Reviewers: se
Approved by: se
MFC after: 3 days
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D38755

18 months agousr.bin/gh-bc: clean-up Makefile
Stefan Eßer [Fri, 24 Feb 2023 23:07:25 +0000 (00:07 +0100)]
usr.bin/gh-bc: clean-up Makefile

Remove commented out debug options and re-enable LTO for most
architectures.

18 months agovendor/bc: import version 6.3.1
Stefan Eßer [Fri, 24 Feb 2023 22:14:58 +0000 (23:14 +0100)]
vendor/bc: import version 6.3.1

This version adds a command to dc to query whether extended registers
are enabled or not.

(cherry picked from commit 61e1a12bb6c3bfdb0a4e499c88e8eaa2b548e427)

18 months agomake cross build from arm64 work..
John-Mark Gurney [Fri, 24 Feb 2023 05:47:03 +0000 (05:47 +0000)]
make cross build from arm64 work..

Reviewed by: dim, imp, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38762

18 months agoAdd gnn@ as my mentor.
Joseph Koshy [Sun, 19 Feb 2023 09:25:22 +0000 (09:25 +0000)]
Add gnn@ as my mentor.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D38673

18 months agovfs: s/ppsratecheck/eventratecheck
Mateusz Guzik [Fri, 24 Feb 2023 19:30:49 +0000 (19:30 +0000)]
vfs: s/ppsratecheck/eventratecheck

nfc

18 months agotime: s/ppsratecheck/eventratecheck
Mateusz Guzik [Thu, 23 Feb 2023 12:49:11 +0000 (12:49 +0000)]
time: s/ppsratecheck/eventratecheck

The routine is used as a general event-limiting routine in places which
have nothing to do with packets.

Provide a define to keep everything happy.

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

18 months agoconfig: drop reference to removed System_spec
Kyle Evans [Fri, 24 Feb 2023 19:14:50 +0000 (13:14 -0600)]
config: drop reference to removed System_spec

Fixes the following warning:

yacc: w - the symbol System_spec is undefined
yacc: 3 rules never reduced

Reported by: otis
Fixes: 6a836ea741c7 ("config(8): Remove obsolete 'config' directive.")

18 months agoscmi: Suppress a couple of -Wunused-function warnings
Mark Johnston [Fri, 24 Feb 2023 18:40:58 +0000 (13:40 -0500)]
scmi: Suppress a couple of -Wunused-function warnings

No functional change intended.

Sponsored by: Klara, Inc.

18 months agolibc: handle zero alignment in memalign()
Paul Floyd [Fri, 24 Feb 2023 16:29:01 +0000 (11:29 -0500)]
libc: handle zero alignment in memalign()

For compatibility with glibc. The previous code would trigger a division
by zero in roundup() and terminate.  Instead, just pass through to
malloc() for align == 0.

PR: 269688
Reviewed by: imp, mjg
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/655

18 months agobcm_dma: don't dereference NULL softc
Mitchell Horne [Fri, 24 Feb 2023 17:19:54 +0000 (13:19 -0400)]
bcm_dma: don't dereference NULL softc

This file defines a small API to be used by other drivers. If any of
these functions are called before the bcm_dma device has attached we
should handle the error gracefully. Fix a formatting quirk while here.

Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38756

18 months agobcm_dma: attach at an earlier bus pass
Mark Millard [Fri, 17 Feb 2023 20:30:35 +0000 (16:30 -0400)]
bcm_dma: attach at an earlier bus pass

The sdhci_bcm driver attach routine relies on bcm_dma already being
attached, in order to allocate a DMA channel. However, both drivers
attached at the default pass so this is not guaranteed. Newer RPI
firmware exposes this assumption, and the result is a NULL-dereference
in bcm_dma_allocate().

To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma.

PR: 268835
Reviewed by: mhorne
MFC after: 1 week

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

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

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

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

Tested by: markj
Reviewed by: markj
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D38750

18 months agoping: Fix unsigned integer underflow resuling in a ping -R segfault
Cy Schubert [Thu, 23 Feb 2023 05:43:17 +0000 (21:43 -0800)]
ping: Fix unsigned integer underflow resuling in a ping -R segfault

ping -R (F_RROUTE) will loop at ping.c:1381 until it segfaults or
the unsigned int hlen happens to be less than the size of an IP header:

slippy$ ping -R 192.168.0.101
PING 192.168.0.101 (192.168.0.101): 56 data bytes
64 bytes from 192.168.0.101: icmp_seq=0 ttl=63 time=1.081 ms
RR:  192.168.0.1
192.168.0.101
192.168.0.101
10.1.1.254
10.1.1.91
unknown option bb
unknown option 32
unknown option 6
...
unknown option 96
unknown option 2d
Segmentation fault

The reason for this is while looping through loose source routing (LSRR)
and strict source routing (SSRR), hlen will become smaller than the IP
header. It may even become negative. This should terminate the loop.
However, when hlen is unsigned, an integer underflow occurs becoming a
large number causing the loop to continue virtually forever until hlen
is either by chance smaller than the lenghth of an IP header or it
segfaults.

Reviewed by: asomers
Fixes: 46d7b45a267b
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38744

18 months agoriscv kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:45:08 +0000 (11:45 -0600)]
riscv kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

18 months agopowerpc kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:44:18 +0000 (11:44 -0600)]
powerpc kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

18 months agoi386 kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:42:59 +0000 (11:42 -0600)]
i386 kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

18 months agoarm64 kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:41:31 +0000 (11:41 -0600)]
arm64 kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

18 months agoarm kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:38:26 +0000 (11:38 -0600)]
arm kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

18 months agoamd64 kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:09:39 +0000 (11:09 -0600)]
amd64 kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

18 months agoUpdate leap-seconds to latest leap-seconds.3676924800 (expires 2023-12-28)
Dimitry Andric [Fri, 24 Feb 2023 12:17:16 +0000 (13:17 +0100)]
Update leap-seconds to latest leap-seconds.3676924800 (expires 2023-12-28)

Obtained from: ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
MFC after: 3 days

18 months agonetlink: fix NOINET6 build.
Alexander V. Chernikov [Fri, 24 Feb 2023 10:19:12 +0000 (10:19 +0000)]
netlink: fix NOINET6 build.

Reported by: Michael Paepcke <bugs.fbsd@paepcke.de>
PR: 269787
MFC after: 3 days

18 months agobuf: Make bufspace_daemon_shutdown() a no-op after a panic
Mark Johnston [Fri, 24 Feb 2023 02:56:36 +0000 (21:56 -0500)]
buf: Make bufspace_daemon_shutdown() a no-op after a panic

This function doesn't need to do anything in that context, and calling
wakeup() can lead to recursive panics.

Discussed with: mhorne
MFC after: 1 week

18 months agoconfig: Include errno.h in mkmakefile.cc
Mark Johnston [Fri, 24 Feb 2023 02:45:01 +0000 (21:45 -0500)]
config: Include errno.h in mkmakefile.cc

Commit da8884202940 ("config: error out on malformed env/hint lines")
added a reference to EINVAL.  In some configurations the bootstrap tools
build fails for lack of errno definitions.

Fixes: da8884202940 ("config: error out on malformed env/hint lines")
Reported by: syzbot+b1a5d112a737d9a2be9b@syzkaller.appspotmail.com

18 months agoiconvlist(3): fix count argument type
Kyle Evans [Thu, 23 Feb 2023 21:22:12 +0000 (15:22 -0600)]
iconvlist(3): fix count argument type

count is just an unsigned int, not a pointer.

Sponsored by: Klara, Inc.

18 months agotools/git: fix typos in documentation
Mina Galić [Thu, 23 Feb 2023 21:05:33 +0000 (21:05 +0000)]
tools/git: fix typos in documentation

and change mention of svn to git.

Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/659

18 months agonet80211: ieee80211_swscan_bg_scan() track return variable under lock
Bjoern A. Zeeb [Sat, 18 Feb 2023 01:15:21 +0000 (01:15 +0000)]
net80211: ieee80211_swscan_bg_scan() track return variable under lock

As the comment says it probably does not matter but use a local
variable to track state under lock so we can return the last known
good state of what we thought we were operating under after unlocking.

Likely no functional changes.

Sponsored by: The FreeBSD Foundation
MFC atfer: 3 days
Reviewed by: enweiwu, adrian
Differential Revision: https://reviews.freebsd.org/D38660

18 months agoefibootmgr: add missing break for 'u' case
Ed Maste [Thu, 23 Feb 2023 14:52:14 +0000 (09:52 -0500)]
efibootmgr: add missing break for 'u' case

Reviewed by: imp, zlei
Reported by: Coverity
CID: 1505695
Fixes: 9a7915299484 ("efibootmgr: Add --efidev (-u) to dis...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38747

18 months agoDelete obsolete Solaris compat header file stdlib.h
Zhenlei Huang [Thu, 23 Feb 2023 18:00:09 +0000 (02:00 +0800)]
Delete obsolete Solaris compat header file stdlib.h

This drops function `getexecname()` redirection.

Historically `getexecname()` is a compatibility definition. Since
openzfs has its own implementation of function `getexecname()` in libspl
and has been merged into base, the compat header file stdlib.h is
no longer needed and should not be used.

Also without this fix libspl will end up an incompatible version of
`getprogname()` with libc. In particular, if zfs is enabled, programs
such as pgrep in /rescue can be wrongly statically linked with libspl
and will not function properly.

PR: 269738
Reviewed by: markj
Fixes: 9e5787d2284e Merge OpenZFS support in to HEAD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38733

18 months agonetlink: fix addition of blackhole/reject routes.
Alexander V. Chernikov [Thu, 23 Feb 2023 17:38:18 +0000 (17:38 +0000)]
netlink: fix addition of blackhole/reject routes.

* Make nhop_set_blackhole() set all necessary properties for the
 nexthop
* Make nexthops blackhole/reject based on the rtm_type netlink
 property instead of using rtflags.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days

18 months agoarm: Fix initialization of VFP context
Kornel Dulęba [Mon, 20 Feb 2023 14:48:40 +0000 (14:48 +0000)]
arm: Fix initialization of VFP context

Make sure that pcb_vfpsaved is always initialized.
Create a vfp_new_thread helper that is heavily based on the arm64 logic.
While here remove un unnecessary assigment and add an assertion
to make sure that it's been properly initialized before we return
from a VFP exception.

Reported by: Mark Millard <marklmi@yahoo.com>
Tested by: Mark Millard <marklmi@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D38698

18 months agoarm: Unbreak debugging programs that use FP instructions
Kornel Dulęba [Mon, 20 Feb 2023 14:44:36 +0000 (14:44 +0000)]
arm: Unbreak debugging programs that use FP instructions

Contrary to arm64, on armv7 get_vfpcontext/set_vfpcontext can be called
from cpu_ptrace. This can be triggered when gdb hits a breakpoint
in a userspace program.
Relax td == currthread assertion to account for that situation.
While here update an outdated comment in vfp_discard.

Reported by: Mark Millard <marklmi@yahoo.com>
Tested by: Mark Millard <marklmi@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D38696

18 months agox86: whack kernel gcov vestige
Mateusz Guzik [Thu, 23 Feb 2023 16:40:40 +0000 (16:40 +0000)]
x86: whack kernel gcov vestige

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

18 months agoctfdump: Use getprogname()
Zhenlei Huang [Thu, 23 Feb 2023 16:28:35 +0000 (00:28 +0800)]
ctfdump: Use getprogname()

Also remove no longer used function `getpname()`.

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38740

18 months agomroute: partially sanitize the file
Mateusz Guzik [Fri, 17 Feb 2023 11:23:35 +0000 (12:23 +0100)]
mroute: partially sanitize the file

There is rampant inconsistent formatting all around, make it mostly
style(9)-conformant.

While here:
- drop malloc casts
- rename a rw lock from mroute_mtx to mroute_lock
- replace NOTREACHED comment with __assert_unreachable

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

18 months agotmpfs: support the nosymfollow mount option
Konstantin Belousov [Thu, 23 Feb 2023 13:15:17 +0000 (15:15 +0200)]
tmpfs: support the nosymfollow mount option

PR: 269772
Reported by: firk@cantconnect.ru
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

18 months agoveriexec(4): Fix a compiler error
Mina Galić [Thu, 23 Feb 2023 11:14:41 +0000 (12:14 +0100)]
veriexec(4): Fix a compiler error

When building WITH_BEARSSL=1 veriexec(4) failes to compile.
So update the function prototype so that veriexec(4)
compiles again.

Reported by: gbe
Reviewed by: mjg, gbe
Approved by: mjg
Pull Request: https://github.com/freebsd/freebsd-src/pull/657

18 months agolinux(4): Fixup the interface name translation in netlink
Dmitry Chagin [Thu, 23 Feb 2023 08:01:18 +0000 (11:01 +0300)]
linux(4): Fixup the interface name translation in netlink

Netlink should translate a FreeBSD interface name to a Linux
interface name.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38715
MFC after: 3 days

18 months agolinux(4): Consolidate a FreeBSD interface names translation code
Dmitry Chagin [Thu, 23 Feb 2023 08:00:29 +0000 (11:00 +0300)]
linux(4): Consolidate a FreeBSD interface names translation code

We have some amount of interface names translation functions which are
differs by bugs implementation. Consolidates it in a one place.

Fixup loopback interface names translation and use ifnet methods and
accessors, where possible.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38714
MFC after: 3 days
X-MFC with: 32fdc75fe7

18 months agolinux(4): Use predefined constant instead of hardcoded value
Dmitry Chagin [Thu, 23 Feb 2023 07:59:34 +0000 (10:59 +0300)]
linux(4): Use predefined constant instead of hardcoded value

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38713
MFC after: 3 days

18 months agoif_ovpn: ovpn_find_peer_by_ip() is unused without INET
Kristof Provost [Thu, 23 Feb 2023 02:58:14 +0000 (03:58 +0100)]
if_ovpn: ovpn_find_peer_by_ip() is unused without INET

Don't define ovpn_find_peer_by_ip() if INET is not set, and do the same
for ovpn_find_peer_by_ip6() and INET6.

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

18 months agounix/dgram tests: match the kernel behavior
Gleb Smirnoff [Thu, 23 Feb 2023 04:44:46 +0000 (20:44 -0800)]
unix/dgram tests: match the kernel behavior

In CURRENT for some time an overflowed unix/dgram socket would
return EAGAIN if it has O_NONBLOCK set.  This proved to be
undesired.  See 71e70c25c00 for details.  Update tests to match
the "new" behavior, which actually is the historical behavior.

18 months agoFix Coverity issue in the NVDIMM driver
Robert Herndon [Thu, 13 Oct 2022 17:02:28 +0000 (12:02 -0500)]
Fix Coverity issue in the NVDIMM driver

Summary:
Coverity reports a potential memory leak in the nvdimm
driver. Examination shows it's real; fix it.

Sponsored by: Dell Technologies
MFC after: 1w

Test Plan: Changes in use at $WORK

Reviewers: robert.herndon_dell.com, vangyzen, bret_ketchum_dell.com

Subscribers: imp, badger

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

18 months agotcp: ensure the tcpcb is not NULL when logging an event
Michael Tuexen [Thu, 23 Feb 2023 01:01:53 +0000 (02:01 +0100)]
tcp: ensure the tcpcb is not NULL when logging an event

When calling tcp_bblog_pru() on some error paths, tp is NULL,
therefore handle it.

Sponsored by: Netflix, Inc.

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

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

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

MFC after: 3 months

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

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

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

MFC after: 3 months

18 months agobyacc: Adjust expected test output to match our patches.
Dag-Erling Smørgrav [Wed, 22 Feb 2023 19:04:06 +0000 (20:04 +0100)]
byacc: Adjust expected test output to match our patches.

Sponsored by: Klara, Inc.

18 months agofusefs: add some more test cases for bad fuse servers
Alan Somers [Tue, 21 Feb 2023 23:26:37 +0000 (16:26 -0700)]
fusefs: add some more test cases for bad fuse servers

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

18 months agofusefs: fix a buffer overflow in the tests
Alan Somers [Wed, 22 Feb 2023 00:13:56 +0000 (17:13 -0700)]
fusefs: fix a buffer overflow in the tests

The actual overflow occured in the ReadAhead.readahead test.
Surprisingly it has never segfaulted or resulted in any bad behavior.

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

18 months agoinclude: Fix typos
Elyes Haouas [Wed, 22 Feb 2023 08:33:35 +0000 (09:33 +0100)]
include: Fix typos

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
18 months agolockmgr: upgrade panic return checks
Mitchell Horne [Wed, 22 Feb 2023 15:11:15 +0000 (11:11 -0400)]
lockmgr: upgrade panic return checks

We short-circuit lockmgr functions in the face of a kernel panic. Other
lock implementations do this with a SCHEDULER_STOPPED() check, which
covers the additional case where the debugger is active but the system
has not panicked. Update this code to match that behaviour.

Reviewed by: mjg, kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38655

18 months agotcp: remove unused function prototype
Michael Tuexen [Wed, 22 Feb 2023 12:28:17 +0000 (13:28 +0100)]
tcp: remove unused function prototype

tcp_trace was implemented in tcp_debug.c, which was removed recently.

Reviewed by: rscheff@, zlei@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D38712

18 months agoarm ti: Fix a typo in a kernel message
Gordon Bergling [Wed, 22 Feb 2023 08:43:49 +0000 (09:43 +0100)]
arm ti: Fix a typo in a kernel message

- s/adress/address/

MFC after: 5 days

18 months agoSupport SMBIOS v3 for 64-bit entry systems
John-Mark Gurney [Wed, 22 Feb 2023 02:27:37 +0000 (02:27 +0000)]
Support SMBIOS v3 for 64-bit entry systems

Summary:
Under QEMU on arm64 systems, the smbios table is above 4GB
requiring a 64-bit address to access.

Reviewers: manu

Subscribers: imp, bcran, dab

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

18 months agoRevert "linprocfs: Migrate to IfAPI"
Justin Hibbits [Tue, 21 Feb 2023 23:13:00 +0000 (18:13 -0500)]
Revert "linprocfs: Migrate to IfAPI"

This reverts commit 5243598927a95e77b3bb9804b049539b87353a5b.

Requested by: dchagin

18 months agoFix per-jail zfs.mount_snapshot setting
Allan Jude [Sat, 18 Feb 2023 01:44:34 +0000 (01:44 +0000)]
Fix per-jail zfs.mount_snapshot setting

When jail.conf set the nopersist flag during startup, it was
incorrectly destroying the per-jail ZFS settings.

PR: 260160
Reported by: imp (previous version), mm (upstream), freqlabs (upstream)
MFC after: immediately
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38662

18 months agobblog: improve timeout event handling
Michael Tuexen [Tue, 21 Feb 2023 21:38:18 +0000 (22:38 +0100)]
bblog: improve timeout event handling

Extend the BBLog RTO event to deal with all timers of the base
stack. Also provide information about starting, stopping, and
running off. The expiration of the retransmission timer is
reported as it was done before.

Reviewed by: rscheff@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D38710

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

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

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

Reviewed by: markj
Discussed with: jamie
Differential Revision: https://reviews.freebsd.org/D38371
MFC after: 3 months

18 months agotcp: rearrange enum and remove unused variable
Michael Tuexen [Tue, 21 Feb 2023 17:26:49 +0000 (18:26 +0100)]
tcp: rearrange enum and remove unused variable

Rearrange the enum tt_which such that TT_REXMIT is 0. This allows
an extension of the BBLog event RTO in a backwards compatible way.
Remove tcptimers, which was only used in trpt, a utility removed
from the source tree recently.

Reviewed by: glebius@, guest-ccui@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D38547

18 months agoRevert "Port Linuxulator to IfAPI"
Justin Hibbits [Tue, 21 Feb 2023 17:18:36 +0000 (12:18 -0500)]
Revert "Port Linuxulator to IfAPI"

Revert pending netlink fixes, and further fixes to this.

This reverts commit 52d984831d82d97dc132d0d57fca6ee89572799b.

Requested by: dchagin

18 months agobblog: unbreak build
Michael Tuexen [Tue, 21 Feb 2023 17:13:23 +0000 (18:13 +0100)]
bblog: unbreak build

Ensure that tp is always declared and set.

Reported by: Michael Butler
Sponsored by: Netflix, Inc.

18 months agoRevert "unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set"
Gleb Smirnoff [Tue, 21 Feb 2023 16:50:07 +0000 (08:50 -0800)]
Revert "unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set"

This API change led to unexpected consequences with Go runtime. The
Go runtime emulates blocking sockets over non-blocking sockets and
for that uses available event dispatcher on the target OS, which is
kevent(2) if availabe, with OS independent layer on top.  It expects
that if whatever O_NONBLOCK socket returned ever EAGAIN, then it is
supposed to be reported as writable by the event dispatcher. kevent(2)
would never report a unix/dgram socket, since they never change their
state, they always are writeable.  The expectations of Go are not
literally specified by SUS, however they are in its spirit.  The SUS
specifies EAGAIN for send(2) as "The socket's file descriptor is marked
O_NONBLOCK and the requested operation would block" [1].  This doesn't
apply to FreeBSD unix/dgram socket, it never blocks on send(2).

Thus, changing API trying to mimic Linux was a mistake.  But what about
the problem we tried to fix? Discussed that with Max Dounin of nginx,
and we agreed that the log bomb described shall be fixed on nginx side,
and it actually isn't specific to FreeBSD, may happen with nginx on any
non-Linux system with a certain configuration.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html

This reverts commit 65572cade35a93add2168a7a012f808ac499218b.

18 months agovnet: Make vnet_sys[un]init() static
Zhenlei Huang [Tue, 21 Feb 2023 16:22:23 +0000 (00:22 +0800)]
vnet: Make vnet_sys[un]init() static

These two functions are intended to be used only when allocating or
destroying vnet instances.

No functional change intended.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37955

18 months agojail: Fix redoing ip restricting
Zhenlei Huang [Tue, 21 Feb 2023 15:43:25 +0000 (23:43 +0800)]
jail: Fix redoing ip restricting

`prison_ip_restrict()` is called in loop FOREACH_PRISON_DESCENDANT_LOCKED.
While under low memory, it is still possible that in subsequent rounds
`prison_ip_restrict()` succeed and `redo_ip[46]` flip over from true to
false, thus leave some prisons's IPv[46] addresses unrestricted.

Reviewed by: jamie
Fixes: 8bce8d28abe6 jail: Avoid multipurpose return value of function prison_ip_restrict()
Differential Revision: https://reviews.freebsd.org/D38697

18 months agoi386: whack LINT-NO* kernels
Mateusz Guzik [Tue, 21 Feb 2023 08:35:19 +0000 (08:35 +0000)]
i386: whack LINT-NO* kernels

there is nothing i386-specific about them and equivalent configs already
build for amd64.

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

18 months agokern/sysv_ipc.c: use ANSI C function definition
Konstantin Belousov [Tue, 21 Feb 2023 14:00:22 +0000 (16:00 +0200)]
kern/sysv_ipc.c: use ANSI C function definition

Also remove pointless return's.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

18 months agosx: whack set-but-not-used warn in _sx_slock_hard
Mateusz Guzik [Tue, 21 Feb 2023 13:49:14 +0000 (13:49 +0000)]
sx: whack set-but-not-used warn in _sx_slock_hard

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

18 months agovfs cache: whack set-but-not-used warn in cache_purgevfs
Mateusz Guzik [Tue, 21 Feb 2023 13:48:35 +0000 (13:48 +0000)]
vfs cache: whack set-but-not-used warn in cache_purgevfs

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

18 months agosdt: add __sdt_used
Mateusz Guzik [Tue, 21 Feb 2023 13:43:00 +0000 (13:43 +0000)]
sdt: add __sdt_used

To pacify set-but-not-used warns when compiling without sdt probes.

Reviewed by:
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision:

18 months agonetlink: clear IPv6 embedded scope when dumping route gateways.
Alexander V. Chernikov [Tue, 21 Feb 2023 12:25:58 +0000 (12:25 +0000)]
netlink: clear IPv6 embedded scope when dumping route gateways.

Reported by: zarychtam@plan-b.pwste.edu.pl
MFC after: 3 days

18 months agobblog: add logging of protocol user requests
Michael Tuexen [Tue, 21 Feb 2023 11:07:35 +0000 (12:07 +0100)]
bblog: add logging of protocol user requests

This information was available in trpt and is useful. So provide
a way to get this information via TCP BBLog.

Reviewed by: rscheff@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D38701

18 months agotruss: Add preadv(2) and pwritev(2).
Thomas Munro [Tue, 21 Feb 2023 09:40:14 +0000 (22:40 +1300)]
truss: Add preadv(2) and pwritev(2).

We already knew how to decode readv(2)/writev(2).  Add the versions with
an offset.

Reviewed by:            asomers
Differential Revision:  https://reviews.freebsd.org/D27531
MFC after:              2 weeks

18 months agoMerge commit 'd84e570b54961e8874bbd8de25635eb96be0977e'
Simon J. Gerraty [Tue, 21 Feb 2023 06:13:27 +0000 (22:13 -0800)]
Merge commit 'd84e570b54961e8874bbd8de25635eb96be0977e'

18 months agoVendor import BearSSL hash 79c060e
Simon J. Gerraty [Tue, 21 Feb 2023 06:06:34 +0000 (22:06 -0800)]
Vendor import BearSSL hash 79c060e

18 months agokern: physmem: fix the format string again, i is a size_t
Kyle Evans [Tue, 21 Feb 2023 05:34:33 +0000 (23:34 -0600)]
kern: physmem: fix the format string again, i is a size_t

Fixes the riscv LINT build.

Fixes: 7b5cb32fca26 ("kern: physmem: properly cast %jx [...]")

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

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

MFC after: 3 months

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

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

Reported by: freebsd@walstatt-de.de
MFC after: 3 months

18 months agobyacc: Update to 20230201.
Dag-Erling Smørgrav [Mon, 20 Feb 2023 22:35:32 +0000 (23:35 +0100)]
byacc: Update to 20230201.

Note that this enables the backtracking extension, which we had previously left disabled.

PR: 244149, 269425
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38421

18 months agobblog: sync tcp_log_events with Netflix tree
Michael Tuexen [Mon, 20 Feb 2023 20:42:57 +0000 (21:42 +0100)]
bblog: sync tcp_log_events with Netflix tree

This allows the addition of entries to tcp_log_events without
causing conflicts in the Netflix tree.
rrs@ will upstream the related functional changes eventually.

Reviewed by: guest-ccui@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D38646

18 months agokern: physmem: properly cast %jx arguments to uintmax_t
Kyle Evans [Mon, 20 Feb 2023 22:11:44 +0000 (16:11 -0600)]
kern: physmem: properly cast %jx arguments to uintmax_t

While we're here, slap prfunc with a __printflike to get compiler
checking on args to catch silly mistakes like this.

Reported by: jrtc27

18 months agotarfs: Really prevent descending into a non-directory.
Dag-Erling Smørgrav [Mon, 20 Feb 2023 21:28:53 +0000 (21:28 +0000)]
tarfs: Really prevent descending into a non-directory.

The previous fix was incorrect: we need to verify that the current node, if it exists, is not a directory, but we were checking the parent node instead.  Address this, add more tests, and fix the test cleanup routines.

PR: 269519, 269561
Fixes: ae6cff89738b
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38645

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

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

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

Discussed with: bz, jamie
MFC after: 3 months

18 months agokern: physmem: don't truncate addresses in DEBUG output
Kyle Evans [Mon, 20 Feb 2023 18:54:00 +0000 (12:54 -0600)]
kern: physmem: don't truncate addresses in DEBUG output

Make it consistent with the above region printing, otherwise it appears
to be somewhat confusing.

18 months agonetlink: fix IPv6 route addition with link-local gateway
Alexander V. Chernikov [Mon, 20 Feb 2023 14:24:01 +0000 (14:24 +0000)]
netlink: fix IPv6 route addition with link-local gateway

Currently kernel assumes that IPv6 gateway address is in "embedded"
 form - that is, for the link-local IPv6 addresses, interface index
 is embedded in bytes 2 and 3 of the address.
Fix address embedding in netlink by wrapping nhop_set_gw() in the
 netlink-specific nl_set_nexthop_gw(), which does such embedding
 automatically.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days

18 months agoman9: Add an smr(9) manual page
Mark Johnston [Mon, 20 Feb 2023 13:58:19 +0000 (08:58 -0500)]
man9: Add an smr(9) manual page

Also update the UMA manual page to mention its SMR-enabled
functionality, and update locking.9 to mention both epoch and SMR.
Details of its usage are provided in the SMR manual page.

Reviewed by: Olivier Certner, mhorne, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38108

18 months agoWhen saving a context on arm call the vfp handler
Andrew Turner [Mon, 20 Feb 2023 12:22:11 +0000 (12:22 +0000)]
When saving a context on arm call the vfp handler

When adding kernel VFP support on arm a comparison instruction was
removed, however the branch to vfp_save_state was still conditional.
Remove the conditional check and always call into vfp_save_state as
it could cause unexpected results otherwise.

Sponsored by: Arm Ltd

18 months agoAdd myself to the github code owners file
Andrew Turner [Mon, 6 Feb 2023 09:30:34 +0000 (09:30 +0000)]
Add myself to the github code owners file

18 months agozless(1): handle uncompressed files
Fernando Apesteguía [Sun, 19 Feb 2023 16:31:11 +0000 (17:31 +0100)]
zless(1): handle uncompressed files

In the manual page for zmore(1) and zless(1) it is said that zless(1) is
equivalent to zmore(1) except that it uses less(1) as a pager. However
zmore(1) is able to handle uncompressed files transparently while zless(1)
is not.

Add another case to the switch in lesspipe.sh to handle non-compressed files.

PR: 196437
Reported by: marquis@roble.com
Approved by: mjg@
Differential Revision: https://reviews.freebsd.org/D38674

18 months agostress2: Added a fsck check to the scenario
Peter Holm [Mon, 20 Feb 2023 11:04:24 +0000 (12:04 +0100)]
stress2: Added a fsck check to the scenario