]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
16 months agolinprocfs(4): Fixup process size in the /proc/pid/stat file
Dmitry Chagin [Sun, 26 Feb 2023 13:42:22 +0000 (16:42 +0300)]
linprocfs(4): Fixup process size in the /proc/pid/stat file

According to the Linux sources the kernel exposes a proces virtual
memory size via proc filesystem into the three files - stat, status
and statm. This is the struct mm->total_vm value adjusted to the
corresponding units - bytes, kilobytes and pages.

The fix is based on a fernape@ analysis.

PR: 265937
Reported by: Ray Bellis
MFC after: 3 days

16 months agoroute.8: Fix mandoc warnings
Gordon Bergling [Sun, 26 Feb 2023 13:33:58 +0000 (14:33 +0100)]
route.8: Fix mandoc warnings

- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D38783

16 months agoroute.8: Add information about ROUTE_MPATH and FIB_ALGO
Gordon Bergling [Sun, 26 Feb 2023 13:15:34 +0000 (14:15 +0100)]
route.8: Add information about ROUTE_MPATH and FIB_ALGO

Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by: pauamma, Jose Luis Duran <jlduran at gmail dot com>
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D38783

16 months agoctf: Remove unused function prototype for getpname()
Zhenlei Huang [Sun, 26 Feb 2023 04:18:25 +0000 (12:18 +0800)]
ctf: Remove unused function prototype for getpname()

This function prototype should have been removed along with the
implementation.

Fixes: 3dd552426409 ctfdump: Use getprogname()
MFC after: 1 day

16 months agopowerpc: fix warning: a function declaration without a prototype is deprecated in...
Piotr Kubaj [Sat, 25 Feb 2023 23:34:27 +0000 (00:34 +0100)]
powerpc: fix warning: a function declaration without a prototype is deprecated in all versions of C

Reviewers: #powerpc
Approved by: alfredo

Subscribers: imp, jhibbits

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

16 months agoRevert "powerpc64*: port mlx5, OFED, KTLS and krping"
Piotr Kubaj [Sat, 25 Feb 2023 23:57:41 +0000 (00:57 +0100)]
Revert "powerpc64*: port mlx5, OFED, KTLS and krping"

Wrong push, another commit was supposed to be pushed.

This reverts commit 83d6d8877ef7dad4f4e8f409a01c9f28139cd026.

16 months agopowerpc64*: port mlx5, OFED, KTLS and krping
Piotr Kubaj [Sat, 25 Feb 2023 21:09:41 +0000 (22:09 +0100)]
powerpc64*: port mlx5, OFED, KTLS and krping

Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

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

16 months agokern: Remove gcc2_compiled stripping
Warner Losh [Sat, 25 Feb 2023 18:33:22 +0000 (11:33 -0700)]
kern: Remove gcc2_compiled stripping

Bruce added stripping of gcc2_compiled and other symbols when he made
the boot loader load the symbols for the kernel in 1995 (b5d89ca8ade3)
before the FreeBSD 2.1 release.  This was copied around a bit and
tweaked over the years, but these symbols aren't produced by clang, nor
gcc12. The were to support dbx for a.out stabs format. gcc removed them
with stabs support last year. gcc 2.95.4 in FreeBSD 4.x continued to
emit these symbols unconditionally (it was missing a test for aout vs
elf it would appaer). They disappeared entirely with gcc 3.2.4 in 5.x
for all non a.out builds, and entirely in FreeBSD 6.x which had gcc
3.2.6.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D38764

16 months agostand: fix buffer overflow in getrootmount()
Robert Wing [Sat, 25 Feb 2023 09:37:32 +0000 (09:37 +0000)]
stand: fix buffer overflow in getrootmount()

Reviewed by: imp, allanjude
Sponsored By:   Beckhoff Automation GmbH & Co. KG
Sponsored By:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38734

16 months agokldxref: skip .pkgsave files
Mina Galić [Sat, 25 Feb 2023 17:31:58 +0000 (10:31 -0700)]
kldxref: skip .pkgsave files

This should help people transitioning from traditional setups to pkgbase
experience a lot less friction.

We do this by skipping all files containing two dots.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/661
Differential Revision: https://reviews.freebsd.org/D27959

16 months agouniq(1): use strtonum to parse options
Daniel Tameling [Sat, 25 Feb 2023 17:25:51 +0000 (10:25 -0700)]
uniq(1): use strtonum to parse options

Previously strtol was used and the result was directly cast to an int
without checking for an overflow. Use strtonum instead since it is
safer and tells us what went wrong.

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

16 months agostand: fix build userboot without zfs
Michael Paepcke [Fri, 24 Feb 2023 19:27:40 +0000 (19:27 +0000)]
stand: fix build userboot without zfs

Fix regression in building userboot -DWITHOUT_LOADER_ZFS

Fixes: e307eb94ae520
MFC After: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/665

16 months agoChange hw_tls to a bool
Alfonso [Tue, 20 Jul 2021 20:17:28 +0000 (16:17 -0400)]
Change hw_tls to a bool

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

16 months agoapic: prevent divide by zero in CPU frequency init
Mina Galić [Fri, 24 Feb 2023 11:07:42 +0000 (11:07 +0000)]
apic: prevent divide by zero in CPU frequency init

If a CPU for some reason returns 0 as CPU frequency, we currently panic
on the resulting divide by zero when trying to initialize the CPU(s) via
APIC. When this happens, we'll fallback to measuring the frequency
instead.

PR: 269767
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/664

16 months agopowerd.8: Provide a whole path to power_profile for clarity
Mateusz Piotrowski [Sat, 25 Feb 2023 16:28:49 +0000 (17:28 +0100)]
powerd.8: Provide a whole path to power_profile for clarity

MFC after: 3 weeks

16 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

16 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

16 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.

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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)

16 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

16 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

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

nfc

16 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

16 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.")

16 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.

16 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

16 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

16 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

16 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

16 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

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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")

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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")

16 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.

16 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

16 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.

16 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

16 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

16 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.

16 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

16 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

16 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>
16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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.

16 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

16 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

16 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

16 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

16 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")

16 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")

16 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:

16 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

16 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

16 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

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

16 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