]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
21 months agotree.h: Fix SP/TAB white-space issues, add () for clarity.
Poul-Henning Kamp [Mon, 5 Dec 2022 14:28:56 +0000 (14:28 +0000)]
tree.h: Fix SP/TAB white-space issues, add () for clarity.

21 months agoif_ovpn: extend notifications with a reason
Kristof Provost [Thu, 1 Dec 2022 15:20:24 +0000 (16:20 +0100)]
if_ovpn: extend notifications with a reason

Extend peer deleted notifications (which are the only type right now) to
include the reason the peer was deleted. This can be either because
userspace requested it, or because the peer timed out.

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

21 months agolm75: fix typo
Wojciech Macek [Mon, 5 Dec 2022 06:30:12 +0000 (07:30 +0100)]
lm75: fix typo

s/sesnor/sensor/

21 months agorpcgen: Unindent a line not guarded by if (mtflag).
John Baldwin [Mon, 5 Dec 2022 00:32:03 +0000 (16:32 -0800)]
rpcgen: Unindent a line not guarded by if (mtflag).

mtflag is used to add pthread mutex locking around operations to make
them thread-safe.  Setting the state to _SERVED is not conditional on
locking.

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

21 months agorpcgen: Don't free() a pointer after realloc().
John Baldwin [Mon, 5 Dec 2022 00:31:35 +0000 (16:31 -0800)]
rpcgen: Don't free() a pointer after realloc().

A successful realloc() already frees the old pointer.

Reported by: GCC -Wuse-after-free
Reviewed by: brooks, imp, emaste
Differential Revision: https://reviews.freebsd.org/D37540

21 months agoposixshm_test: Fix sign mismatches in ?: results.
John Baldwin [Mon, 5 Dec 2022 00:31:05 +0000 (16:31 -0800)]
posixshm_test: Fix sign mismatches in ?: results.

GCC 12's -Wsign-compare complains if the two alternative results of
the ?: operator are differently signed.  Cast the small, sub-page
off_t values to size_t to quiet the warning.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D37539

21 months agofwcontrol: Disable -Wzero-length-bounds warnings.
John Baldwin [Mon, 5 Dec 2022 00:30:20 +0000 (16:30 -0800)]
fwcontrol: Disable -Wzero-length-bounds warnings.

firewire.h includes zero length arrays in unions that trigger this
warning.

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

21 months agobsd.sys.mk: Add NO_WZERO_LENGTH_BOUNDS helper variable.
John Baldwin [Mon, 5 Dec 2022 00:29:55 +0000 (16:29 -0800)]
bsd.sys.mk: Add NO_WZERO_LENGTH_BOUNDS helper variable.

This variable expands to -Wno-zero-length-bounds on GCC 10+.

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

21 months agonetmap tests: Reset ctx->nmctx to NULL in nmreq_parsing.
John Baldwin [Mon, 5 Dec 2022 00:29:25 +0000 (16:29 -0800)]
netmap tests: Reset ctx->nmctx to NULL in nmreq_parsing.

This avoids leaking a pointer to the on-stack test_nmctx which
triggers a -Wdangling-pointer warning from GCC.

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

21 months agoacpica: Quiet a -Wdangling-pointer warning in AcpiUtInitStackPtrTrace.
John Baldwin [Mon, 5 Dec 2022 00:28:59 +0000 (16:28 -0800)]
acpica: Quiet a -Wdangling-pointer warning in AcpiUtInitStackPtrTrace.

This function intentionally saves a pointer to an on-stack variable in
a global as a dubious way of reading the stack pointer.

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

21 months agopw: Don't return a pointer to an on-stack buffer from grp_set_passwd.
John Baldwin [Mon, 5 Dec 2022 00:28:22 +0000 (16:28 -0800)]
pw: Don't return a pointer to an on-stack buffer from grp_set_passwd.

Make 'line' static to move it to .bss instead as that pattern is used
elsewhere in pw(8) (e.g. the static buffer in pw_pwcrypt).

Reported by: GCC -Wdangling-pointer
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37534

21 months agolibsa: Disable -Wdangling-pointer for zfs.c.
John Baldwin [Mon, 5 Dec 2022 00:27:22 +0000 (16:27 -0800)]
libsa: Disable -Wdangling-pointer for zfs.c.

GCC 12 warns about a dangling pointer to 'objid' in
zfs_bootenv_initial().  However, this appears to be a false positive
as the pointer to 'objid' is only passed to zfs_lookup_dataset() but
not saved anywhere that outlives the lifetime of the
zfs_bootenv_initial() function.

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

21 months agobsd.sys.mk: Add NO_WDANGLING_POINTER helper variable.
John Baldwin [Mon, 5 Dec 2022 00:26:48 +0000 (16:26 -0800)]
bsd.sys.mk: Add NO_WDANGLING_POINTER helper variable.

This variable expands to -Wno-dangling-pointer on GCC 12+.

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

21 months agoExplicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>.
John Baldwin [Wed, 30 Nov 2022 22:56:19 +0000 (14:56 -0800)]
Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>.

GCC 12 defaults to C++17 which removes (not just deprecates)
std::auto_ptr<>.  Trying to use CXXSTD of c++03 doesn't work with
libc++ headers, but c++11 does.

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

21 months agonewbus: Change attach failure behavior
Warner Losh [Sun, 4 Dec 2022 23:22:43 +0000 (16:22 -0700)]
newbus: Change attach failure behavior

In the rare case that we succeed in probing, but fail to attach, flip
the default to be to disable the
device. hw.bus.disable_failed_devices=false is no required to restore
the old behavior. The old behavior dates form a time when dynamic
control of devices wasn't yet present (devctl didn't exist). Now that
one can retry probe/attach the device with devctl, the default doesn't
make sense: The more desirable behaivor is to have stable device numbers
when one has several instances of the same device in a system (common
for NICs or HBAs).

Reviewed by: jhb (verbal)
Sponsored by: Netflix

21 months agonewbus: Create a knob to disable devices that fail to attach.
Warner Losh [Sun, 4 Dec 2022 23:20:24 +0000 (16:20 -0700)]
newbus: Create a knob to disable devices that fail to attach.

Normally, when a device fails to attach, we tear down the newbus state
for that device so that future driver loads can try again (maybe with a
different driver, or maybe with a re-loaded and fixed kld).

Sometimes, however, it is desirable to have the device fail
permanantly. We do this by calling device_disable() on a failed
attached, as well as keeping the device in DS_ATTACHING forever. This
prevents retries on that device. This is enabled via
hw.bus.disable_failed_devices=1 in either a hint via the loader, or at
runtime with a sysctl setting. Setting from 1 -> 0 at runtime will not
affect previously disabled devices, however: they remain disabled.
They can be re-enabled manually with devctl enable, however.

Sponsored by: Netflix

Reviewed by: gallatin, hselasky, jhb
Differential Revision: https://reviews.freebsd.org/D37517

21 months agokboot: Add md_addr to metadata
Warner Losh [Sun, 4 Dec 2022 20:52:22 +0000 (13:52 -0700)]
kboot: Add md_addr to metadata

Save the address of where the metadata is loaded.

Sponsored by: Netflix

21 months agokboot: Use #define for DT_DIR
Warner Losh [Sun, 4 Dec 2022 20:25:54 +0000 (13:25 -0700)]
kboot: Use #define for DT_DIR

Sponsored by: Netflix

21 months agokboot: powerpc64 has no newfstat system call
Warner Losh [Sun, 4 Dec 2022 20:20:04 +0000 (13:20 -0700)]
kboot: powerpc64 has no newfstat system call

Powerpc doesn't have a newfstat system call. It does have a fstat call,
which we define properly if SYS_newfstat isn't defined.

Sponsored by: Netflix

21 months agokboot: Add aarch64 termios
Warner Losh [Sun, 4 Dec 2022 20:16:32 +0000 (13:16 -0700)]
kboot: Add aarch64 termios

Aarch64 has the generic termios interface, so use termios_gen.h

Sponsored by: Netflix

21 months agokboot: Add missing license to termios
Warner Losh [Sun, 4 Dec 2022 20:12:09 +0000 (13:12 -0700)]
kboot: Add missing license to termios

I neglected to include the proper license markings on these
files. Remedy that now.

Sponsored by: Netflix

21 months agolibdevdctl: update deprecated deprecation warning comment
Ed Maste [Tue, 29 Nov 2022 19:44:15 +0000 (14:44 -0500)]
libdevdctl: update deprecated deprecation warning comment

The comment indicated -Wno-deprecated-declarations was used to avoid
warnings about deprecated auto_ptr and various deprecated function
objects from <functional>.  libdevdctl (now) does not use auto_ptr,
so don't mention it in the comment.

Sponsored by: The FreeBSD Foundation

21 months agostand: aarch64 has different nlinks than amd64
Warner Losh [Sun, 4 Dec 2022 05:46:21 +0000 (22:46 -0700)]
stand: aarch64 has different nlinks than amd64

Some typedefs are system dependent, so move them into stat_arch.h where
they are used.  On amd64, nlinks is a int64_t, while on aarch64 it's an
int (or int32_t).

Sponsored by: Netflix

21 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sun, 4 Dec 2022 05:33:09 +0000 (21:33 -0800)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Minor optimization that makes semantics of check clearer.

Sponsored by: The FreeBSD Foundation

21 months agokboot: powerpc ldscript catchup
Warner Losh [Sun, 4 Dec 2022 04:41:05 +0000 (21:41 -0700)]
kboot: powerpc ldscript catchup

Catch up with the latest ldscript for powerpc. Make it match others in
the tree.

Sponsored by: Netflix

21 months agostand/efi: Break stlye rules a little for easier sharing
Warner Losh [Sun, 4 Dec 2022 00:23:25 +0000 (17:23 -0700)]
stand/efi: Break stlye rules a little for easier sharing

Break the style rules a little to allow easier sharing between efi and
kboot. This will allow the ifdefs to be fewer in number.

Sponsored by: Netflix

21 months agostand/efi: Better include order for sharing
Warner Losh [Sun, 4 Dec 2022 00:23:22 +0000 (17:23 -0700)]
stand/efi: Better include order for sharing

Have a better include order so this can more easily be shared between
EFI and kboot. Fewer ifdefs and the same (enough) include order as
before.

Sponsored by: Netflix

21 months agostand/efi: Remove redundant parenthesis
Warner Losh [Sun, 4 Dec 2022 00:23:20 +0000 (17:23 -0700)]
stand/efi: Remove redundant parenthesis

Style: Remove redundant parens.

Sponsored by: Netflix

21 months agostand/efi: Document the copy size trick
Warner Losh [Sun, 4 Dec 2022 00:23:16 +0000 (17:23 -0700)]
stand/efi: Document the copy size trick

We call bi_copymodules twice: once with 0 and once with the size of the
arena. We do this to find the size, it turns out. Document this.

Sponsored by: Netflix

21 months agokboot: Enable fewer things by default
Warner Losh [Sat, 3 Dec 2022 19:48:23 +0000 (12:48 -0700)]
kboot: Enable fewer things by default

We don't need NFS / network support by default, nor do we need gzip
support. Remove them for now.

Sponsored by: Netflix

21 months agokboot: Make dosfs support conditional
Warner Losh [Sat, 3 Dec 2022 19:48:19 +0000 (12:48 -0700)]
kboot: Make dosfs support conditional

Sponsored by: Netflix

21 months agokboot: Add readme
Warner Losh [Sat, 3 Dec 2022 19:48:16 +0000 (12:48 -0700)]
kboot: Add readme

Document how to test kboot and how to build a initrd.

Sponsored by: Netflix

21 months agokboot: Move archsw init earlier
Warner Losh [Sat, 3 Dec 2022 19:48:11 +0000 (12:48 -0700)]
kboot: Move archsw init earlier

Do archsw init first thing.

Sponsored by: Netflix

21 months agonetmap_update_config: update na->name to cope with reconfigurations
Vincenzo Maffione [Sat, 3 Dec 2022 18:12:04 +0000 (18:12 +0000)]
netmap_update_config: update na->name to cope with reconfigurations

MFC after: 1 week

21 months agoCTL: Allow userland supply tags via ioctl frontend.
Alexander Motin [Sat, 3 Dec 2022 17:05:05 +0000 (12:05 -0500)]
CTL: Allow userland supply tags via ioctl frontend.

Before this ioctl frontend always replaced tags with sequential ones.
It was done for ctladm, that can not keep track of global tag list.
But in case of virtio-scsi in bhyve we can pass provided tags as-is.
It should be on virtio-scsi initiator to provide us valid tags.  It
should allow proper task management, error reporting, etc.  In case
of several virtio-scsi devices, they should use different CTL ports
or initiator IDs to avoid conflicts, but this is expected by design.

PR: 267539

21 months agoMissed chunk of 0acc026dda9e.
Alexander Motin [Sat, 3 Dec 2022 16:26:22 +0000 (11:26 -0500)]
Missed chunk of 0acc026dda9e.

21 months agoCTL: Increase maximum SCSI tag size from 32 to 64 bits.
Alexander Motin [Sat, 3 Dec 2022 15:23:29 +0000 (10:23 -0500)]
CTL: Increase maximum SCSI tag size from 32 to 64 bits.

SAM-5 specification states maximum size of command identifier (tag),
defined by specific transports, should not be larger than 64 bits.
While most of supported transports use 32 bits or less, it was
reported that virtio-scsi uses 64 bits.  Truncation to 32 bits in
bhyve code caused false tag conflict errors reported and possibly
other issues.

This changes CTL ABI and HA protocol, so CTL_HA_VERSION is bumped.

While we make HA protocol incompatible, increase default maximum
number of ports in CTL from 256 to 1024, matching number of LUNs.
There are many reports from people who need many iSCSI targets with
only one LUN each.  Increased memory consumption should be less of
a problem these days.

PR: 267539

21 months agobhyve virtio-scsi: Fix residual reporting.
Alexander Motin [Sat, 3 Dec 2022 15:08:20 +0000 (10:08 -0500)]
bhyve virtio-scsi: Fix residual reporting.

CTL does not really use residual field and it always returned zero.
Use ext_data_filled instead.

MFC after: 2 weeks

21 months agolibpmc: remove unused auto_ptr warning suppression
Ed Maste [Tue, 29 Nov 2022 19:41:08 +0000 (14:41 -0500)]
libpmc: remove unused auto_ptr warning suppression

libpmc used -Wno-deprecated-declarations to silence warnings about usage
of deprecated std::auto_ptr, but there is (now) now use of auto_ptr in
libpmc.

Reviewed by: mhorne
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37576

21 months agonetlink: fix non-multipath build
Alexander V. Chernikov [Fri, 2 Dec 2022 22:20:42 +0000 (22:20 +0000)]
netlink: fix non-multipath build

21 months agoRetire trpt(8).
Gleb Smirnoff [Fri, 2 Dec 2022 22:10:55 +0000 (14:10 -0800)]
Retire trpt(8).

trpt(8) was utility to pull TCP debugging data from the kernel
originating back from 4.2BSD.  It is not used nowadays by TCP
developers.  We have more powerful debugging facilities, e.g.
the Dtrace probing, the TCP black box logging and siftr.

Discussed with: rscheff, tuexen, rrs, jtl and others

21 months agoinpcb: allow to provide protocol specific pcb size
Gleb Smirnoff [Fri, 2 Dec 2022 22:10:55 +0000 (14:10 -0800)]
inpcb: allow to provide protocol specific pcb size

The protocol specific structure shall start with inpcb.

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

21 months agonetlink: store user-provided rtm_protocol
Alexander V. Chernikov [Fri, 2 Dec 2022 19:26:34 +0000 (19:26 +0000)]
netlink: store user-provided rtm_protocol

Store user-supplied source protocol in the nexthops and nexthop groups.
Protocol specification help routing daemons like bird to quickly
identify self-originated routes after the crash or restart.

Example:
```
10.2.0.0/24 via 10.0.0.2 dev vtnet0 proto bird
10.3.0.0/24 proto bird
nexthop via 10.0.0.2 dev vtnet0 weight 3
nexthop via 10.0.0.3 dev vtnet0 weight 4
```

21 months agorouting: provide dedicated function for nhgrp creation and linking.
Alexander V. Chernikov [Fri, 2 Dec 2022 17:58:03 +0000 (17:58 +0000)]
routing: provide dedicated function for nhgrp creation and linking.

There is a need to store client metadata in nexthops and nexthop groups.
This metadata is immutable and participate in nhop/nhg comparison.

Nexthops KPI already supports its: nexthop creation pattern is
```
nhop_alloc()
nhop_set_...()
...
nhop_get_nhop()
```

This change provides a similar pattern for the nexthop groups.
Specifically, it adds nhgrp_alloc(), nhgrp_get_nhgrp() and
nhgrp_set_uidx().

MFC after: 2 weeks

21 months agokboot: Use unsigned long long.
Warner Losh [Fri, 2 Dec 2022 19:41:01 +0000 (12:41 -0700)]
kboot: Use unsigned long long.

For the 64-bit platforms, this is a nop. Currently kboot only supports
64-bit platforms, though. If we support 32-bit in the future, this will
become important.

Noticed by: rpokala
Sponsored by: Netflix

21 months agokboot: Enhance hostdisk
Warner Losh [Fri, 2 Dec 2022 18:28:08 +0000 (11:28 -0700)]
kboot: Enhance hostdisk

Added missing functionality to allow us to boot off of things like
/dev/nvme0n1p2 successfully. And to list all available devices and
partitions with 'lsdev'.

Sponsored by: Netflix

21 months agokboot: amd64 use /sys/firmware/memmap to find free memory
Warner Losh [Fri, 2 Dec 2022 18:10:42 +0000 (11:10 -0700)]
kboot: amd64 use /sys/firmware/memmap to find free memory

Use the system's firmware memory map to find a good place to put the
kernel that won't stomp on anything else. While this uses obstensibly MI
interfaces to get this data, arm64 doesn't have this, nor does
powerpc64, so place it here.

Sponsored by: Netflix

21 months agokboot: move to using devparse
Warner Losh [Fri, 2 Dec 2022 18:10:06 +0000 (11:10 -0700)]
kboot: move to using devparse

We can use devparse directly now. No need to invent a kboot_parsedev
that just does what devparse does now that we've refactored.

Sponsored by: Netflix

21 months agokboot: Create routines to read Linux tiny files
Warner Losh [Fri, 2 Dec 2022 18:05:58 +0000 (11:05 -0700)]
kboot: Create routines to read Linux tiny files

Most of the files in /sys/ and /proc/ are small with one value. Create
two routines to help us read the file and decode that value.

Sponsored by: Netflix

21 months agofull-test: Start of a full testing suite.
Warner Losh [Fri, 2 Dec 2022 17:47:32 +0000 (10:47 -0700)]
full-test: Start of a full testing suite.

full-test.sh aims to be a test suite generator for the boot loader. It
tries to grab artifacts from the web and then constructs minimal boot
environments from that as well as writing qemu-system-* using scripts
that facilitates testing all the ways we can boot... At least all the
ways that we an boot that qemu can emulate.

This is very much a work in progress, and likely could use a good
cleanup at some point.

Sponsored by: Netflix

21 months agoAdd test notes
Warner Losh [Fri, 2 Dec 2022 17:47:29 +0000 (10:47 -0700)]
Add test notes

Add notes on how to test things. This will likely need to be fleshed out
more in the future, but this is a good start.

Sponsored by: Netflix

21 months agodevd: Warn for deprecated 'kern' system type
Warner Losh [Fri, 2 Dec 2022 17:47:22 +0000 (10:47 -0700)]
devd: Warn for deprecated 'kern' system type

One year ago, I deprecated 'kern' in favor of 'kernel' for the system
name for some power events. I'm about to remove it from the kernel, but
realized there's been no warning generated for users. Preserve POLA by
converting on the fly here and issuing a warning for 14.x, and an fatal
error after we branch 15. Make compiling it an error on 16 to remove
the gross hack after we branch.

Sponsored by: Netflix
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D37584

21 months agonewbus: Remove deprecated "kern" system name for resume events.
Warner Losh [Fri, 2 Dec 2022 17:47:01 +0000 (10:47 -0700)]
newbus: Remove deprecated "kern" system name for resume events.

The new "kernel" system name is the one that's documented and has
been generated for a year now. Remove the old one now that 14.0
is getting close.

Sponsored by: Netflix
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D37582

21 months agoAllow any user to read the NFS stats, for example with nfsstat(1).
Alan Somers [Thu, 1 Dec 2022 21:08:01 +0000 (14:08 -0700)]
Allow any user to read the NFS stats, for example with nfsstat(1).

This was originally allowed by 3cea29603d3 (2011).  But it got broken by
693957f8861 (2016) and apparently nobody noticed.

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: rmacklem, ken
Differential Revision: https://reviews.freebsd.org/D37589

21 months agoif_ovpn: remove peer limit
Kristof Provost [Mon, 28 Nov 2022 09:16:24 +0000 (10:16 +0100)]
if_ovpn: remove peer limit

Replace the fixed-sized array by an RB_TREE. This should both speed up
lookups and remove the 128 peer limit.

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

21 months agoheimdal: Fix bus fault when zero-length request received
Cy Schubert [Thu, 1 Dec 2022 00:11:18 +0000 (16:11 -0800)]
heimdal: Fix bus fault when zero-length request received

Zero length client requests result in a bus fault when attempting to
free malloc()ed pointers within the requests softc. Return an error
when the request is zero length.

PR: 268062
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

21 months agoheimdal: Add additional checks for bad kadmind input
Cy Schubert [Wed, 30 Nov 2022 23:53:49 +0000 (15:53 -0800)]
heimdal: Add additional checks for bad kadmind input

Check return codes for bad input.

MFC after: 3 days

21 months agolinuxkpi: Introduce module_param() of type `bint`
Jean-Sébastien Pédron [Thu, 1 Dec 2022 14:03:00 +0000 (15:03 +0100)]
linuxkpi: Introduce module_param() of type `bint`

In Linux, this limits the accepted value to -1, 0 and 1.
In FreeBSD, this remains a signed integer with no specific constraints.

This change is a requirement to update our DRM drivers to Linux 5.12.

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

21 months agolinuxkpi: Add `PCIE_SPEED_{32,64}_0GT` PCI-E bus speed constants
Jean-Sébastien Pédron [Thu, 1 Dec 2022 14:00:54 +0000 (15:00 +0100)]
linuxkpi: Add `PCIE_SPEED_{32,64}_0GT` PCI-E bus speed constants

This change is a requirement to update our DRM drivers to Linux 5.12.

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

21 months agolinuxkpi: Add `cmpxchg64()` in <asm/atomic.h>
Jean-Sébastien Pédron [Thu, 1 Dec 2022 13:59:16 +0000 (14:59 +0100)]
linuxkpi: Add `cmpxchg64()` in <asm/atomic.h>

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

21 months agolinuxkpi: Add `seqcount_mutex_t` support in <linux/seqlock.h>
Jean-Sébastien Pédron [Thu, 1 Dec 2022 13:58:27 +0000 (14:58 +0100)]
linuxkpi: Add `seqcount_mutex_t` support in <linux/seqlock.h>

To achieve that, the header uses the C11 type generic selection keyboard
_Generic() because the macros are supposed to work with seqcount_t
and seqcount_mutex_t.

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

21 months agonet: add if_allocdescr() to permit updating iface description from the kernel
Alexander V. Chernikov [Wed, 30 Nov 2022 13:49:07 +0000 (13:49 +0000)]
net: add if_allocdescr() to permit updating iface description from the kernel

Reviewed by: kp,zlei
Differential Revision: https://reviews.freebsd.org/D37566
MFC after: 2 weeks

21 months agorx8803: Improve probing logic
Kornel Dulęba [Thu, 1 Dec 2022 05:41:41 +0000 (06:41 +0100)]
rx8803: Improve probing logic

Add a PNP macro in order to load this driver automatically.
While here check if the device is enabled in DT before probing it.

Reviewed by: wma
Sponsored by: Alstom
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D37579

21 months agolm75: Refactor code to fix io error
Jakub Kolodziej [Thu, 1 Dec 2022 08:02:52 +0000 (09:02 +0100)]
lm75: Refactor code to fix io error

Use correct resolution by compat table. If dtb is not defined use default 9 bit mode.
11 bit detection is called if 9 bit mode is used.
Sysctl resolution variable is added to change resolution in case.
Some sensors didn't pull ACK while reading from nonexistent registers and it caused I2C
read error and detect failure, so now detect failure does not cause driver break.

Obtained from: Semihalf
Sponsored by: Alstom
Differential revision: https://reviews.freebsd.org/D37497

21 months agokillall(1): allow sending signals to processes with control terminal on pts(4)
Daniel Dowse [Thu, 1 Dec 2022 02:42:35 +0000 (04:42 +0200)]
killall(1): allow sending signals to processes with control terminal on pts(4)

PR: 268093
Reviewed by: kib
MFC after: 1 week

21 months agopowerpc/mpc85xx: Add compat strings for P5040 PCIe
Justin Hibbits [Thu, 1 Dec 2022 00:41:26 +0000 (19:41 -0500)]
powerpc/mpc85xx: Add compat strings for P5040 PCIe

Submitted by: widelec (widelec@morphos.pl)
MFC after: 1 week

21 months agogoogletest: remove unused auto_ptr warning suppression
Ed Maste [Tue, 29 Nov 2022 19:38:41 +0000 (14:38 -0500)]
googletest: remove unused auto_ptr warning suppression

lib/googletest used -Wno-deprecated-declarations to silence warnings
about usage of deprecated std::auto_ptr, but auto_ptr is not (now) used
anywhere in googletest.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37561

21 months agoarm64/machdep: Reserve memory when we find Linux EFI reserved memory table
Warner Losh [Wed, 30 Nov 2022 23:28:51 +0000 (16:28 -0700)]
arm64/machdep: Reserve memory when we find Linux EFI reserved memory table

When Linux loads a new kernel via kexec, somtiems it must reserve memory
for devices that are still active (and typically can't be reset or
shutdown). When present, this table is a linked list of ranges that are
still in use that the OS must avoid using.

Mark these areas as reserved.

This is part of the GICv3 workaround code where we must use the PA
addresses already programmed into the GICv3 when we take over. This part
ensure we don't allocate the mmeory for anything else.

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

21 months agoarm64/machdep: Add parameter to the EFI table walking code
Warner Losh [Wed, 30 Nov 2022 23:28:01 +0000 (16:28 -0700)]
arm64/machdep: Add parameter to the EFI table walking code

It would be nice to be able to pass an arbitrary pointer to the callback
code. Add one, and pass NULL in all the places that we do that today.
As noted by andrew@, we should likely refactor this into MI code and use
it here and amd64, but for the future.

Sponsored by: Netflix
Reviewed by: rpokala
Differential Revision: https://reviews.freebsd.org/D37439

21 months agoSilence GCC warnings when using libc++ headers.
John Baldwin [Wed, 30 Nov 2022 22:50:35 +0000 (14:50 -0800)]
Silence GCC warnings when using libc++ headers.

GCC 12 raises warnings about literal operator suffixes not preceded by
'_' in libc++ headers such as <string_view> as it doesn't recognize
libc++ headers being an implementation of the standard.

GCC 12 also warns about clang-specific pragmas in <locale>.

Disabling these warnings globally for all C++ code is not ideal, but
is a better option than patching libc++ headers to ignore these
warnings.

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

21 months agoudp[6]_multi_input: Don't unlock freed inp.
John Baldwin [Wed, 30 Nov 2022 22:38:51 +0000 (14:38 -0800)]
udp[6]_multi_input: Don't unlock freed inp.

If udp[6]_append() returns non-zero, it is because the inp has gone
away (inpcbrele_rlocked returned 1 after running the tunnel function).

Reviewed by: ae
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37511

21 months agoether_demux: Defer stripping the Ethernet header.
John Baldwin [Wed, 30 Nov 2022 22:38:51 +0000 (14:38 -0800)]
ether_demux: Defer stripping the Ethernet header.

This avoids having to undo it before invoking NetGraph's orphan input
hook.

Reviewed by: ae, melifaro
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37510

21 months agostand/ofw: Refactor ofw parsedev
Warner Losh [Wed, 30 Nov 2022 22:10:23 +0000 (15:10 -0700)]
stand/ofw: Refactor ofw parsedev

Both ofw_disk and ofw_net use the same parsedev routine, except for the
string passed in to match the ofw device node's type. Create a routine
to do that and connect these two users up to that.

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

21 months agostand/ofw: Use devparse
Warner Losh [Wed, 30 Nov 2022 22:10:18 +0000 (15:10 -0700)]
stand/ofw: Use devparse

Retire the custom parsedev routine and use the standard devparse.

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

21 months agoofw/disk: Add parsedev support
Warner Losh [Wed, 30 Nov 2022 22:10:11 +0000 (15:10 -0700)]
ofw/disk: Add parsedev support

Add a parsedev support for OpenFirmware disks. We must look at
characteristics of the OFW node to know if we match this device (so
supply a match routine) or not. Add a parsing routine to allocate
devdesc for OpenFirmware disks as well.

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

21 months agostand/ofw: Subclass devnet to cope with ofw's unique needs
Warner Losh [Wed, 30 Nov 2022 22:10:05 +0000 (15:10 -0700)]
stand/ofw: Subclass devnet to cope with ofw's unique needs

We need to match devices in a slightly special way: We have to look up
the path and see if the device is a 'network' device in order to use it.

Sponsored by: Netflix
Tested by: grehan@ (with tweaks to my original patch)
Differential Revision: https://reviews.freebsd.org/D37557

21 months agostand/ofw: Add ofw_path_to_handle
Warner Losh [Wed, 30 Nov 2022 22:10:00 +0000 (15:10 -0700)]
stand/ofw: Add ofw_path_to_handle

ofw_path_to_handle converts a path string to a phandle_t. It searches
down the path for the first device whose type matches the passed-in
string.

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

21 months agostand: Implement ofw disk print routine
Warner Losh [Wed, 30 Nov 2022 22:09:56 +0000 (15:09 -0700)]
stand: Implement ofw disk print routine

Have lsdev show openfirmware devices.

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

21 months agostand: Add dv_match
Warner Losh [Wed, 30 Nov 2022 22:09:51 +0000 (15:09 -0700)]
stand: Add dv_match

On OpenFirmware, and possibly kboot, we use full path names for the
objects that are the 'device'. kboot uses a hack of knowing that all
disk device nodes start with '/dev', but this generalizes it for
OpenFirmware where both 'block' and 'network' devices live in the same
namespace and one must ask the OF node its type to know if this device
type matches.

For drivers that don't specify, the current convention of using
strncmp() is retained. This is done only in devparse(), but everything
uses it directly (or will soon).

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

21 months agostand: parsedev API change: devspec now points to start of full device name
Warner Losh [Wed, 30 Nov 2022 22:09:36 +0000 (15:09 -0700)]
stand: parsedev API change: devspec now points to start of full device name

To support more flexible device matching, we now pass in the full
devspec to the parsedev routines. For everything execpt uboot, this is
just a drop in (since everything except uboot and openfirmware always
uses disk...: and/or zfs:, but openfirmware isn't really affected).

uboot we kludge around it by subtracting 4 from where the rest of the
device name starts. This is unforunate, and can compute the address one
before the string. But we never dereference that address. uboot needs
more work, and this is an acceptable UB until that other work happens.

OFW doesn't really use the parsedev routines these days (since none of
the supported device uses this... yet). It too needs more work, but it
needs device matching support first.

Sponsored by: Netflix
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D37553

21 months agostand: create devinit
Warner Losh [Wed, 30 Nov 2022 22:09:29 +0000 (15:09 -0700)]
stand: create devinit

devinit() marches through all the devices, calling the inint routines if
any exist. Replace all the identical copies of this code.

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

21 months agostand/ofw: ofw_disk isn't really a disk
Warner Losh [Wed, 30 Nov 2022 22:09:23 +0000 (15:09 -0700)]
stand/ofw: ofw_disk isn't really a disk

The rest of the code in the tree assumes that a DEVT_DISK uses a
disk_devdesc to represent the device. However ofw_disk diesn't, so we
can't use disk_fmtdev, nor disk_parsedev. ofw needs to have a
dv_match-like routine to use devpasrse, though, since we have two
drivers (net and block) that claim the same sort of devices (eg
/path/to/ofw-dev) based on the device-type property. In the interim, we
can't use devmatch and ofw_disk's and the default net driver's parsing
is offloaded ofw_parsedev.

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

21 months agozfs: Remove devicename_stubs
Warner Losh [Wed, 30 Nov 2022 22:09:18 +0000 (15:09 -0700)]
zfs: Remove devicename_stubs

We no longer need the zfs stubs since we're no longer referencing these
functions outside of zfs.c.

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

21 months agostand: make zfs_parsedev static
Warner Losh [Wed, 30 Nov 2022 22:09:14 +0000 (15:09 -0700)]
stand: make zfs_parsedev static

It's now unreferenced outside of zfs.c.

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

21 months agostand/ofw: Access the parsing routine more directly
Warner Losh [Wed, 30 Nov 2022 22:09:09 +0000 (15:09 -0700)]
stand/ofw: Access the parsing routine more directly

We don't need to check if something is a ZFS device. Instead, if the
found device has a parse routine, call it. Otherwise, just copy the
path.

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

21 months agostand/userboot: Move to using common devparse()
Warner Losh [Wed, 30 Nov 2022 22:09:05 +0000 (15:09 -0700)]
stand/userboot: Move to using common devparse()

We no longer need to have to hand-code this for each boot loader since
devparse() handles them all with dv_parsedev().

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

21 months agostand/i386: Move to using common devparse()
Warner Losh [Wed, 30 Nov 2022 22:09:00 +0000 (15:09 -0700)]
stand/i386: Move to using common devparse()

We no longer need to have to hand-code this for each boot loader since
devparse() handles them all with dv_parsedev().

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

21 months agostand/efi: Move to using common devparse()
Warner Losh [Wed, 30 Nov 2022 22:08:55 +0000 (15:08 -0700)]
stand/efi: Move to using common devparse()

We no longer need to have to hand-code this for each boot loader since
devparse() handles them all with dv_parsedev().

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

21 months agostand: For all disk drivers, connect dv_parsedev to disk_parsedev
Warner Losh [Wed, 30 Nov 2022 22:08:51 +0000 (15:08 -0700)]
stand: For all disk drivers, connect dv_parsedev to disk_parsedev

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

21 months agostand/zfs: Connect dv_parsedev to zfs_parsedev
Warner Losh [Wed, 30 Nov 2022 22:08:47 +0000 (15:08 -0700)]
stand/zfs: Connect dv_parsedev to zfs_parsedev

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

21 months agostand: Introduce devparse to parse device / path strings
Warner Losh [Wed, 30 Nov 2022 22:08:42 +0000 (15:08 -0700)]
stand: Introduce devparse to parse device / path strings

devparse is now the preferred interface to use to parse device
strings or device:/path strings. It parses the passed in string,
mallocs the device's particular devdesc string and returns the
'remainder' of the device:/path for further processing.

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

21 months agostand: Introduce new dv_parsedev routine
Warner Losh [Wed, 30 Nov 2022 22:08:36 +0000 (15:08 -0700)]
stand: Introduce new dv_parsedev routine

Allow device classes to define a parsing routine. Most device classes
already have these routines, but there's much duplication in their
use. Define an interface for a common routine to parse an individual
device. By convetion, files have the form "[device:]/path/to/file"
where device is optional (filled in to be the value of currdev)
and it starts with the dv_name field of the device, with the rest
of the name up to the device (typically a unit number, but disks
add partition inforation, and other devices may do artibtrary
otehr things).

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

21 months agostand: Change zfs_parsedev() API
Warner Losh [Wed, 30 Nov 2022 22:08:22 +0000 (15:08 -0700)]
stand: Change zfs_parsedev() API

Change the first argument to zfs_parsedev() to be a pointer to a struct
devdesc *. This now gets filled in with a malloc'd structure that's
returned to the caller that the caller is repsonsible for freeing. Most
nplaces in the tree passed in a malloc'd pointer anyway, and this moves
knowledge of zfs_devdesc more firmly into the zfs.c code.

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

21 months agostand: Change disk_parsedev() API
Warner Losh [Wed, 30 Nov 2022 22:08:15 +0000 (15:08 -0700)]
stand: Change disk_parsedev() API

Change the first argument to disk_parsedev() to be a pointer to a struct
devdesc *. This now gets filled in with a malloc'd structure that's
returned to the caller that the caller is repsonsible for freeing. Most
places in the tree passed in a malloc'd pointer anyway, and this moves
knowledge of disk_devdesc more firmly into the disk.[ch] code.

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

21 months ago[skip ci] document first appearance of fhlink et al
Alan Somers [Wed, 30 Nov 2022 17:23:22 +0000 (10:23 -0700)]
[skip ci] document first appearance of fhlink et al

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

21 months agovmm: Remove stale comment for vm_rendezvous.
John Baldwin [Wed, 30 Nov 2022 21:06:46 +0000 (13:06 -0800)]
vmm: Remove stale comment for vm_rendezvous.

Support for rendezvous outside of a vcpu context (vcpuid of -1) was
removed in commit 949f0f47a4e7, and the vm, vcpuid argument pair was
replaced by a single struct vcpu pointer in commit d8be3d523dd5.

Reported by: andrew

21 months agoEnable -Wdate-time warning
Ed Maste [Wed, 9 Feb 2022 22:10:03 +0000 (17:10 -0500)]
Enable -Wdate-time warning

This produces an "expansion of date or time macro is not reproducible"
warning or error upon use of __DATE__ or __TIME__.

Provide NO_WDATE_TIME for ports or 3rd party software to opt out.

This is a recommit of 489d7a8528ca, which was reverted (by baf8cbcd97a6)
due to ports build failures.

PR: 267902 [exp-run]
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29580

21 months agostand/zlib: Zlib still uses K&R function definitions
Warner Losh [Wed, 30 Nov 2022 18:08:24 +0000 (11:08 -0700)]
stand/zlib: Zlib still uses K&R function definitions

So add ${NO_WDEPRECATED_NON_PROTOTYPE} to the CFLAGS of those
files. This can be removed when we import a zlib that's free of this
anachronism.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37516

21 months agoclang: Define NO_WDEPRECATED_NON_PROTOTYPE for clang 15
Warner Losh [Wed, 30 Nov 2022 18:08:16 +0000 (11:08 -0700)]
clang: Define NO_WDEPRECATED_NON_PROTOTYPE for clang 15

Clang 15 enforces function definitions using the C89 form rather than
the K&R form. While not strictly a prototype (which is only for a
declaration), use the name that mirror's clang's warning name. Much code
in contrib still uses K&R function definitions, so invent this for
compiling there.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37515

21 months agonetlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent
Alexander V. Chernikov [Wed, 30 Nov 2022 12:15:23 +0000 (12:15 +0000)]
netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent

Netlink has a confirmation/error reporting mechanism for the sent
messages. Kernel explicitly acks each messages if requested (NLM_F_ACK)
 or if message processing results in an error.
Similarly, for multipart messages - typically dumps, where each message
 represents a single object like an interface or a route - another
 message, NLMSG_DONE is used to indicate the end of dump and the
 resulting status.
As a result, successfull dump ends with both NLMSG_DONE and NLMSG_ERROR
 messages.
RFC 3549 does not say anything specific about such case.
Linux adopted an optimisation which suppresses NLMSG_ERROR message
 when NLMSG_DONE is already sent. Certain libraries/applications like
 libnl depends on such behavior.

Suppress sending NLMSG_ERROR if NLMSG_DONE is already sent, by
 setting newly-added 'suppress_ack' flag in the writer and checking
 this flag when generating ack.

This change restores libnl compatibility.

Before:
```
~ nl-link-list
Error: Unable to allocate link cache: Message sequence number mismatch
````

After:
```
~ nl-link-list
vtnet0 ether 52:54:00:14:e3:19 <broadcast,multicast,up,running>
lo0 ieee1394 <loopback,multicast,up,running>
```

Reviewed by: bapt,pauamma
Tested by: bapt
Differential Revision: https://reviews.freebsd.org/D37565