]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agoacpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.
Konstantin Belousov [Sat, 18 Mar 2023 15:45:49 +0000 (17:45 +0200)]
acpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.

Fixes: 02904a06c76be857307b78184863654b9e7b88ab
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39146

14 months agoamd64: properly recalculate mitigations knobs after resume
Konstantin Belousov [Fri, 17 Mar 2023 13:02:03 +0000 (15:02 +0200)]
amd64: properly recalculate mitigations knobs after resume

Revision r333125 AKA 986c4ca38772f72 forced clear cpu_stdext_feature3
on suspend, since at that time microcode update was not reloaded
early on resume. Then, revision 050f5a8405c63 started re-reading
cpu_stdext_feature3 again. Since modern CPUs do not require mitigations
from the Skylake era, this went unnoticed for some time.

Keep zeroing cpu_stdext_feature3 on suspend, but re-read it in more
controlled way on resume after microcode is reloaded, and recalculate
active workarounds based on actual microcode capabilities.

Reported and tested by: romain
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39146

14 months agonetstat: fix double-free in netlink error code path.
Alexander V. Chernikov [Sat, 18 Mar 2023 14:01:46 +0000 (14:01 +0000)]
netstat: fix double-free in netlink error code path.

CID: 1504382

14 months agonetstat: simplify netlink route printing code.
Alexander V. Chernikov [Sat, 18 Mar 2023 13:05:41 +0000 (13:05 +0000)]
netstat: simplify netlink route printing code.

A number of improvements has commited to snl(3) recently.
A notable one is snl(3) build-in parsers for all of the objects
 exported by the kernel.

This change updates netlink handling code to the latest available snl(3)
API.

14 months agonetlink: add public ucred accessor for nlp.
Alexander V. Chernikov [Sat, 18 Mar 2023 11:44:29 +0000 (11:44 +0000)]
netlink: add public ucred accessor for nlp.

MFC after: 2 weeks

14 months agonetlink: fix capped uncapped ack handling in snl(3).
Alexander V. Chernikov [Fri, 17 Mar 2023 14:27:08 +0000 (14:27 +0000)]
netlink: fix capped uncapped ack handling in snl(3).

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

14 months agostress2: Added two syzkaller reproducers
Peter Holm [Sat, 18 Mar 2023 09:31:31 +0000 (10:31 +0100)]
stress2: Added two syzkaller reproducers

14 months agosmbfs.5: Us .An -nosplit for the AUTHORS section
Gordon Bergling [Sat, 18 Mar 2023 09:02:59 +0000 (10:02 +0100)]
smbfs.5: Us .An -nosplit for the AUTHORS section

Use .An -nosplit for the AUTHORS section, so that
it renders without an unnecessary newline.

No .Dd bump since it isn't a content change.

MFC after: 3 days

14 months agouart: Don't change settings or throttle putc for Hyper-V
Wei Hu [Tue, 14 Mar 2023 15:49:33 +0000 (15:49 +0000)]
uart: Don't change settings or throttle putc for Hyper-V

Azure setup does not like it when FreeBSD overrides the settings of the
UART device. When Hyper-V is detected, don't do this and also don't
throttle putc() output. This is a workaround for the early boot hang
of FreeBSD on Azure.

Tested on Azure, ESXi (VM with serial port), and SG-8200

PR: 264267
Reviewed by: kevans, whu
Tested by: whu
Obtained from: Rubicon Communications, LLC (Netgate)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

14 months agoamd64 loader: Use efiserialio for Hyper-V booted systems
Wei Hu [Tue, 14 Mar 2023 15:13:46 +0000 (15:13 +0000)]
amd64 loader: Use efiserialio for Hyper-V booted systems

UEFI provides ConIn/ConOut handles for consoles that it supports,
which include the text-video and serial ports. When the serial port
is available, use the UEFI driver instead of direct io-port accesses
to avoid conflicts between the firmware and direct hardware access, as
happens on Hyper-V (Azure) setups.

This change enables efiserialio to be built for efi-amd64 and has
higher order priority vs comconsole, and only uses efiserialio
if the hypervisor is Hyper-V. When efiserialio successfully
probes, it will set efi_comconsole_avail=true which will prevent
comconsole from probing in this setup.

Tested on Hyper-V, ESXi and Azure VMs.

PR: 264267
Reviewed by: kevans, whu
Tested by: whu
Obtained from: Rubicon Communications, LLC (Netgate)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

14 months agoBelately bump __FreeBSD_version for introduction of __libc_start1()
Konstantin Belousov [Sat, 18 Mar 2023 06:21:59 +0000 (08:21 +0200)]
Belately bump __FreeBSD_version for introduction of __libc_start1()

and move of most of the initialization code from csu to libc.

Requested by: jrtc27
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

14 months agoDo not panic in case of corrupted directory
Fedor Uporov [Sat, 18 Mar 2023 06:11:27 +0000 (09:11 +0300)]
Do not panic in case of corrupted directory

The panic() will be called under ext2_dirbad()
function in case of rw mount. It cause user confusion,
like in BZ 265951.

PR: 265951
Reviewed by: pfg, mckusick
MFC after: 2 week
Differential revision:  https://reviews.freebsd.org/D38503

14 months agoAdd root directory entry check.
Fedor Uporov [Thu, 9 Feb 2023 09:34:25 +0000 (12:34 +0300)]
Add root directory entry check.

Add check that directory entry with ino=EXT2_ROOTINO
have correct namelength and name. It is possible to
create malicious image which will cause panic if root
directory entry have incorrect name.

PR: 259068
Reported by: Robert Morris
Reviewed by: pfg
MFC after: 2 weeks
Differential Revision:  https://reviews.freebsd.org/D38502

14 months agodaemon: kill off some stray blank lines
Kyle Evans [Sat, 18 Mar 2023 06:04:35 +0000 (01:04 -0500)]
daemon: kill off some stray blank lines

Overlooked in review; mea culpa.

Reported by: jrtc27

14 months agodaemon: remove unnecessary memset in daemon_state_init()
Ihor Antonov [Sat, 18 Mar 2023 05:43:35 +0000 (22:43 -0700)]
daemon: remove unnecessary memset in daemon_state_init()

Pull Request: https://github.com/freebsd/freebsd-src/pull/694

14 months agodaemon: repace goto exit with daemon_terminate()
Ihor Antonov [Sat, 18 Mar 2023 05:31:12 +0000 (22:31 -0700)]
daemon: repace goto exit with daemon_terminate()

Start breaking down big main()
Remove goto exit label and replace it with a function that does cleanup.

Comment re-worded by kevans@.

Pull Request: https://github.com/freebsd/freebsd-src/pull/694

14 months agouhci(4): Correct PCI device ID for Zhaoxin USB controller
Zhenlei Huang [Fri, 17 Mar 2023 17:20:58 +0000 (01:20 +0800)]
uhci(4): Correct PCI device ID for Zhaoxin USB controller

And minor style fixes.

Tested by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes: 986c7be472bd uhci(4): Add new USB IDs
Differential Revision: https://reviews.freebsd.org/D38924

14 months agoehci(4): Correct PCI device ID for Zhaoxin USB 2.0 controller
Zhenlei Huang [Fri, 17 Mar 2023 17:24:46 +0000 (01:24 +0800)]
ehci(4): Correct PCI device ID for Zhaoxin USB 2.0 controller

And minor style fixes.

Tested by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes: f9237e1937a4 ehci(4): Add new USB IDs
Differential Revision: https://reviews.freebsd.org/D38923

14 months agoxhci(4): Correct PCI device IDs for Zhaoxin USB 3.0 controllers
Zhenlei Huang [Fri, 17 Mar 2023 17:12:30 +0000 (01:12 +0800)]
xhci(4): Correct PCI device IDs for Zhaoxin USB 3.0 controllers

And minor style fixes.

Reviewed by: hselasky
Tested by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes: 0d7064d58f89 xhci(4): Add new USB IDs
Differential Revision: https://reviews.freebsd.org/D38921

14 months agovfs: retire KERN_VNODE
Mateusz Guzik [Thu, 16 Mar 2023 17:21:59 +0000 (17:21 +0000)]
vfs: retire KERN_VNODE

It got disabled in 2003:

commit acb18acfec97aa7fe26ff48f80a5c3f89c9b542d
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date:   Sun Feb 23 18:09:05 2003 +0000

    Bracket the kern.vnode sysctl in #ifdef notyet because it results
    in massive locking issues on diskless systems.

    It is also not clear that this sysctl is non-dangerous in its
    requirements for locked down memory on large RAM systems.

There does not seem to be practical use for it and the disabled routine
does not work anyway.

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

14 months agoping: Avoid magic numbers
Jose Luis Duran [Fri, 17 Mar 2023 13:24:44 +0000 (09:24 -0400)]
ping: Avoid magic numbers

The sizeof(struct ip) is 20.
The sizeof(struct in_addr) is 4.

No functional change intended.

Reviewed by: asomers, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39125

14 months agoamd64 acpi_wakeup.c: fix typo
Konstantin Belousov [Fri, 17 Mar 2023 12:42:26 +0000 (14:42 +0200)]
amd64 acpi_wakeup.c: fix typo

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

14 months agovmm: fix missing ipi statistic
Vitaliy Gusev [Fri, 17 Mar 2023 09:17:22 +0000 (10:17 +0100)]
vmm: fix missing ipi statistic

ipi counters are missing in bhyvectl's output because vm_maxcpu is 0
when initializing them. That's because vmm_stat_register is executed
before vmm_init.

Instead of directly fixing it, there's a better solution in illumos
which is cherry picked:
https://github.com/illumos/illumos-gate/commit/65a3bc83734e5fb0fc2c19df3e5112b87dcdc3f8

It replaces the matrix statistic by two counters per vcpu. One for
counting the ipis to the vcpu and one counting the ipis received by the
vcpu. This has several advantages:

- A matrix statistic becomes huge when using many vcpus.
- A matrix statistic easily reaches the MAX_VMM_STAT_ELEMS limit.
- Two counters are enough in most cases. DTrace can be used for more
  advanced debugging purposes.
- A matrix statistic wastes memory. The matrix size is determined by
  vm_maxcpu regardless of the number of vcpus assigned to the vm.

Reviewed by: corvink, markj
Fixes: ee98f99d7a68b284a669fefb969cbfc31df2d0ab ("vmm: Convert VM_MAXCPU into a loader tunable hw.vmm.maxcpu.")
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D39038

14 months agoarm: Remove SOCFPGA specific kernel configs
Emmanuel Vadot [Wed, 15 Mar 2023 09:29:27 +0000 (10:29 +0100)]
arm: Remove SOCFPGA specific kernel configs

We had GENERIC for a while now so anyone still interested in those boards
should make sure that we can boot on them with it and with upstream DTS files.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D39088

14 months agoUPDATING: Document arm video devices renaming.
Emmanuel Vadot [Thu, 16 Mar 2023 09:38:46 +0000 (10:38 +0100)]
UPDATING: Document arm video devices renaming.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39121

14 months agoarm: Rename hdmi_if.m to crtc_if.m
Emmanuel Vadot [Thu, 16 Mar 2023 09:48:06 +0000 (10:48 +0100)]
arm: Rename hdmi_if.m to crtc_if.m

There is nothing hdmi related in this interface, it's just a generic interface
for crt controller so rename it.
This also remove the 'hdmi' device used in arm kernel config. 'vt' now controls
if we build this interface (sc(4) isn't supported on arm).

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39120

14 months agoarm: ti: Rename video related devices
Emmanuel Vadot [Thu, 16 Mar 2023 09:36:23 +0000 (10:36 +0100)]
arm: ti: Rename video related devices

device 'hdmi' is too generic (and will be used later in a new device) so rename
the arm TI devices to some proper name.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39119

14 months agoarm: imx: Rename video related devices
Emmanuel Vadot [Thu, 16 Mar 2023 09:30:57 +0000 (10:30 +0100)]
arm: imx: Rename video related devices

device 'hdmi' is too generic (and will be used later in a new device) so rename
the arm IMX devices to some proper name.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39118

14 months agoarm: allwinner: Garbage collect a10_hdmi driver
Emmanuel Vadot [Wed, 15 Mar 2023 12:00:20 +0000 (13:00 +0100)]
arm: allwinner: Garbage collect a10_hdmi driver

It was disconnected 5 years ago in 4573cd3914d7
("arm: allwinner: Disconnect A10/A20 HDMI driver") as it wasn't working.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39117

14 months agoarm: Remove IMX6 kernel config
Emmanuel Vadot [Wed, 15 Mar 2023 09:53:15 +0000 (10:53 +0100)]
arm: Remove IMX6 kernel config

All devices are in GENERIC and GENERIC is known to boot on those SoCs.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39090

14 months agoarm: Remove IMX5 specific kernel configs
Emmanuel Vadot [Wed, 15 Mar 2023 09:39:02 +0000 (10:39 +0100)]
arm: Remove IMX5 specific kernel configs

We had GENERIC for a while now so anyone still interested in those boards
should make sure that we can boot on them with it and with upstream DTS files.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39089

14 months agoarm: Remove VYBRID specific kernel config
Emmanuel Vadot [Wed, 15 Mar 2023 09:26:24 +0000 (10:26 +0100)]
arm: Remove VYBRID specific kernel config

We had GENERIC for a while now so anyone still interested in those boards
should make sure that we can boot on them with it and with upstream DTS files.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39087

14 months agoarm: Remove kernel config APALIS-IMX6
Emmanuel Vadot [Wed, 15 Mar 2023 09:17:24 +0000 (10:17 +0100)]
arm: Remove kernel config APALIS-IMX6

It reference to a non-existant dts file apalis-imx6.dts so unlikekly to compile.
Aldo IMX6 support is in GENERIC so anyone interested in this board should
make it work with GENERIC kernel (if that's not already the case).

Sponsored by: Beckhoff Automation GmbH & Co. KG
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39086

14 months agostress2: Fix compiler warning
Peter Holm [Fri, 17 Mar 2023 11:06:52 +0000 (12:06 +0100)]
stress2: Fix compiler warning

14 months agobhyve: add cmdline option to enable qemu's fwcfg
Corvin Köhne [Wed, 18 Aug 2021 07:31:59 +0000 (09:31 +0200)]
bhyve: add cmdline option to enable qemu's fwcfg

Let the user decide if he wants to use bhyve's fwctl or qemu's fwcfg. He
can set the interface by adding a fwcfg option to bootrom:

-l bootrom,<path/to/rom>,fwcfg=bhyve
-l bootrom,<path/to/rom>,fwcfg=qemu

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38337

14 months agobhyve: add helper for adding fwcfg files
Corvin Köhne [Wed, 11 Aug 2021 08:04:36 +0000 (10:04 +0200)]
bhyve: add helper for adding fwcfg files

Fwcfg items without a fixed index are reported by the file_dir. They
have an index of 0x20 and above. This helper simplifies the addition of
such fwcfg items. It selects a new free index, assigns it to the fwcfg
items and creates an proper entry in the file_dir.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38336

14 months agox86: gate smbios hypervisor identification behind vm_guest
Kyle Evans [Thu, 16 Mar 2023 19:26:28 +0000 (14:26 -0500)]
x86: gate smbios hypervisor identification behind vm_guest

cpuid detection may have picked up a more specific guest type already,
and a follow-up check of smbios vendor/product may erroneously blow
away the previously detected type.

This reportedly fixes the boot under Hyper-V, which advertises an
smbios.system.product of "Virtual Machine."

PR: 270239
Reviewed by: imp, kib (both earlier version, same concept)
Fixes: 2fee87562948 ("abstract out the vm detection via smbios..")
Differential Revision: https://reviews.freebsd.org/D39140

14 months agonfscl: Add a new NFSv4.1/4.2 mount option for Kerberized mounts
Rick Macklem [Thu, 16 Mar 2023 22:55:36 +0000 (15:55 -0700)]
nfscl: Add a new NFSv4.1/4.2 mount option for Kerberized mounts

Without this patch, a Kerberized NFSv4.1/4.2 mount must provide
a Kerberos credential for the client at mount time.  This credential
is typically referred to as a "machine credential".  It can be
created one of two ways:
- The user (usually root) has a valid TGT at the time the mount
  is done and this becomes the machine credential.
  There are two problems with this.
  1 - The user doing the mount must have a valid TGT for a user
      principal at mount time.  As such, the mount cannot be put
      in fstab(5) or similar.
  2 - When the TGT expires, the mount breaks.
- The client machine has a service principal in its default keytab
  file and this service principal (typically called a host-based
  initiator credential) is used as the machine credential.
  There are problems with this approach as well:
  1 - There is a certain amount of administrative overhead creating
      the service principal for the NFS client, creating a keytab
      entry for this principal and then copying the keytab entry
      into the client's default keytab file via some secure means.
  2 - The NFS client must have a fixed, well known, DNS name, since
      that FQDN is in the service principal name as the instance.

This patch uses a feature of NFSv4.1/4.2 called SP4_NONE, which
allows the state maintenance operations to be performed by any
authentication mechanism, to do these operations via AUTH_SYS
instead of RPCSEC_GSS (Kerberos).  As such, neither of the above
mechanisms is needed.

It is hoped that this option will encourage adoption of Kerberized
NFS mounts using TLS, to provide a more secure NFS mount.

This new NFSv4.1/4.2 mount option, called "syskrb5" must be used
with "sec=krb5[ip]" to avoid the need for either of the above
Kerberos setups to be done by the client.

Note that all file access/modification operations still require
users on the NFS client to have a valid TGT recognized by the
NFSv4.1/4.2 server.  As such, this option allows, at most, a
malicious client to do some sort of DOS attack.

Although not required, use of "tls" with this new option is
encouraged, since it provides on-the-wire encryption plus,
optionally, client identity verification via a X.509
certificate provided to the server during TLS handshake.
Alternately, "sec=krb5p" does provide on-the-wire
encryption of file data.

A mount_nfs(8) man page update will be done in a separate commit.

Discussed on: freebsd-current@
MFC after: 3 months

14 months agolibipsec: ansify
Mateusz Guzik [Thu, 16 Mar 2023 19:19:35 +0000 (19:19 +0000)]
libipsec: ansify

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

14 months agolibmd: ansify
Mateusz Guzik [Thu, 16 Mar 2023 19:02:56 +0000 (19:02 +0000)]
libmd: ansify

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

14 months agolibc/yp: sort out warnings
Mateusz Guzik [Thu, 16 Mar 2023 18:56:47 +0000 (18:56 +0000)]
libc/yp: sort out warnings

.. in least-effort manner

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

14 months agoless: silence K&R warns
Mateusz Guzik [Thu, 16 Mar 2023 18:24:12 +0000 (18:24 +0000)]
less: silence K&R warns

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

14 months agolibz: silence K&R warns
Mateusz Guzik [Thu, 16 Mar 2023 18:22:24 +0000 (18:22 +0000)]
libz: silence K&R warns

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

14 months agosendmail: silence K&R warns
Mateusz Guzik [Thu, 16 Mar 2023 18:18:48 +0000 (18:18 +0000)]
sendmail: silence K&R warns

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

14 months agotun tests: Fix cleanup definitions
Mark Johnston [Thu, 16 Mar 2023 16:52:54 +0000 (12:52 -0400)]
tun tests: Fix cleanup definitions

Without this, vnet jails for the tests don't get torn down.

Fixes: fe701c39e8aa ("if_tun: Add basic connectivity test with nc tun support")

14 months agoMark arm64 mair_el1 fields as unsigned long
Andrew Turner [Thu, 16 Mar 2023 16:19:21 +0000 (16:19 +0000)]
Mark arm64 mair_el1 fields as unsigned long

The register is 64-bit so the upper bits could be shifted past the
signed 32-bit size of an int the values were before.

Sponsored by: Arm Ltd

14 months agoSwitch the arm64 VM_MEMATTR_DEVICE to nGnRE
Andrew Turner [Thu, 16 Mar 2023 15:36:06 +0000 (15:36 +0000)]
Switch the arm64 VM_MEMATTR_DEVICE to nGnRE

Move device memory to a weaker type. The new device memory type allows
the system to acknowledge a write to a device before the write has
completed. This is inline with VM_MEMATTR_DEVICE on armv6/armv7.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38945

14 months agoAllow forcing non-posted memory on arm64
Andrew Turner [Thu, 16 Mar 2023 15:35:59 +0000 (15:35 +0000)]
Allow forcing non-posted memory on arm64

To allow for debugging after changing the arm64 VM_MEMATTR_DEVICE
memory type add a new set of tunables to tell the kernel to use
non-posted memory.

This adds the following tunables:
 - kern.force_nonposted: When set to non-zero the kernel will use
   non-posted memory for all device allocations.
 - hint.<dev>.<unit>.force_nonposted: As above, however only forces
   non-posted memory on the named device.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38944

14 months agoRemove an unneeded CTASSERT in the smmu driver
Andrew Turner [Thu, 16 Mar 2023 15:35:04 +0000 (15:35 +0000)]
Remove an unneeded CTASSERT in the smmu driver

We don't map the DMAP here

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38951

14 months agoRemove unneeded arm64 smmu macros
Andrew Turner [Thu, 16 Mar 2023 15:34:59 +0000 (15:34 +0000)]
Remove unneeded arm64 smmu macros

These aren't used by the driver so can be removed.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38950

14 months agoOnly support a 4 level smmu page table
Andrew Turner [Thu, 16 Mar 2023 15:34:54 +0000 (15:34 +0000)]
Only support a 4 level smmu page table

We only ever build a 4 level page table for the Arm SMMU. Remove the
support for a 3 level table.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38949

14 months agoRename smmu pmap functions
Andrew Turner [Thu, 16 Mar 2023 15:34:48 +0000 (15:34 +0000)]
Rename smmu pmap functions

These are SMMU (and MALI GPU) specific. Give them a SMMU specific name.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38948

14 months agosctp: enforce Kahn's rule during the handshake
Michael Tuexen [Thu, 16 Mar 2023 16:40:40 +0000 (17:40 +0100)]
sctp: enforce Kahn's rule during the handshake

Don't take RTT measurements on packets containing INIT or COOKIE-ECHO
chunks, when they were retransmitted.

MFC after: 1 week

14 months agoMove access to tcp's t_logstate into inline functions and provide new tracepoint...
Randall Stewart [Thu, 16 Mar 2023 15:43:16 +0000 (11:43 -0400)]
Move access to tcp's t_logstate into inline functions and provide new tracepoint and bbpoint capabilities.

The TCP stacks have long accessed t_logstate directly, but in order to do tracepoints and the new bbpoints
we need to move to using the new inline functions. This adds them and moves rack to now use
the tcp_tracepoints.

Reviewed by: tuexen, gallatin
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D38831

14 months agotail: Verify correct behavior when input does not end in a newline.
Dag-Erling Smørgrav [Thu, 16 Mar 2023 15:36:49 +0000 (15:36 +0000)]
tail: Verify correct behavior when input does not end in a newline.

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39116

14 months agossh: Update to OpenSSH 9.3p1
Ed Maste [Thu, 16 Mar 2023 14:29:55 +0000 (10:29 -0400)]
ssh: Update to OpenSSH 9.3p1

This release fixes a number of security bugs and has minor new
features and bug fixes.  Security fixes, from the release notes
(https://www.openssh.com/txt/release-9.3):

This release contains fixes for a security problem and a memory
safety problem. The memory safety problem is not believed to be
exploitable, but we report most network-reachable memory faults as
security bugs.

 * ssh-add(1): when adding smartcard keys to ssh-agent(1) with the
   per-hop destination constraints (ssh-add -h ...) added in OpenSSH
   8.9, a logic error prevented the constraints from being
   communicated to the agent. This resulted in the keys being added
   without constraints. The common cases of non-smartcard keys and
   keys without destination constraints are unaffected. This problem
   was reported by Luci Stanescu.

 * ssh(1): Portable OpenSSH provides an implementation of the
   getrrsetbyname(3) function if the standard library does not
   provide it, for use by the VerifyHostKeyDNS feature. A
   specifically crafted DNS response could cause this function to
   perform an out-of-bounds read of adjacent stack data, but this
   condition does not appear to be exploitable beyond denial-of-
   service to the ssh(1) client.

   The getrrsetbyname(3) replacement is only included if the system's
   standard library lacks this function and portable OpenSSH was not
   compiled with the ldns library (--with-ldns). getrrsetbyname(3) is
   only invoked if using VerifyHostKeyDNS to fetch SSHFP records. This
   problem was found by the Coverity static analyzer.

Sponsored by: The FreeBSD Foundation

14 months agoAdd PSCI affinity info return values
Andrew Turner [Thu, 16 Mar 2023 12:16:59 +0000 (12:16 +0000)]
Add PSCI affinity info return values

These can be returned from the PSCI AFFINITY_INFO call. This is not
marked as optional so bhyve will need to implement it & can use these
macros.

Sponsored by: Arm Ltd

14 months agoAdd a psci macro to build a version value
Andrew Turner [Thu, 16 Mar 2023 12:14:01 +0000 (12:14 +0000)]
Add a psci macro to build a version value

Add PSCI_VER that takes a major and minor version and builds the value
returned by the firmware. This will be used by bhyve.

Sponsored by: Arm Ltd

14 months agoAllow psci.h to be used by userspace
Andrew Turner [Thu, 16 Mar 2023 12:08:32 +0000 (12:08 +0000)]
Allow psci.h to be used by userspace

Wrap parts of psci.h that aren't usable by userspace in _KERNEL checks.
This allows it to be used to implement PSCI and SMCCC by bhyve in
userspace.

Sponsored by: Arm Ltd
Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation

14 months agostress2: New problem found was added
Peter Holm [Thu, 16 Mar 2023 12:59:16 +0000 (13:59 +0100)]
stress2: New problem found was added

14 months agoVendor import of OpenSSH 9.3p1
Ed Maste [Thu, 16 Mar 2023 12:41:22 +0000 (08:41 -0400)]
Vendor import of OpenSSH 9.3p1

14 months agotarfs: Fix backtracking during node creation.
Dag-Erling Smørgrav [Thu, 16 Mar 2023 11:31:14 +0000 (11:31 +0000)]
tarfs: Fix backtracking during node creation.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39082

14 months agotarfs: Support tar files which include file modes with permissions.
Dag-Erling Smørgrav [Thu, 16 Mar 2023 11:31:10 +0000 (11:31 +0000)]
tarfs: Support tar files which include file modes with permissions.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39020

14 months agotarfs: Correctly track link count.
Dag-Erling Smørgrav [Thu, 16 Mar 2023 11:31:06 +0000 (11:31 +0000)]
tarfs: Correctly track link count.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39019

14 months agotarfs: Repeat tests using GNU tar if available.
Dag-Erling Smørgrav [Thu, 16 Mar 2023 11:31:01 +0000 (11:31 +0000)]
tarfs: Repeat tests using GNU tar if available.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: ngie, asomers
Differential Revision: https://reviews.freebsd.org/D39018

14 months agocarp: carp_master_down_locked() requires net epoch
Zhenlei Huang [Thu, 16 Mar 2023 10:00:13 +0000 (18:00 +0800)]
carp: carp_master_down_locked() requires net epoch

Reviewed by: kp
Fixes: 1d126e9b9474 carp: Widen epoch coverage
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D39113

14 months agopf tests: test IPv6 fragmentation with link-local addresses
Kristof Provost [Sun, 12 Mar 2023 15:08:31 +0000 (16:08 +0100)]
pf tests: test IPv6 fragmentation with link-local addresses

We've observed a panic after pf_refragment6() with link-local addresses,
because pf_refragment6() calls ip6_forward() even for a simple output
case.
That results in us entering ip6_forward() with an mbuf with a NULL
m->m_pkthdr.rcvif, which can cause a NULL deref (but seemingly not for
GUAs.

Test sending fragmented link-local packets to pf.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39063

14 months agopf: set scope in pf_refragment6()
Kristof Provost [Mon, 13 Mar 2023 09:27:59 +0000 (10:27 +0100)]
pf: set scope in pf_refragment6()

Link-local traffic needs to have a scope embedded before it's passed on
to ip6_output(). Do so in pf_refragment6(), because when we end up here
in the output path we may have passed through ip6_output() already
(before being reassembled), where the scope would have been removed.

Re-embed the scope so that link-local traffic is sent correctly.

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

14 months agopf: distinguish forwarding and output cases for pf_refragment6()
Kristof Provost [Sun, 12 Mar 2023 17:34:42 +0000 (18:34 +0100)]
pf: distinguish forwarding and output cases for pf_refragment6()

Re-introduce PFIL_FWD, because pf's pf_refragment6() needs to know if
we're ip6_forward()-ing or ip6_output()-ing.

ip6_forward() relies on m->m_pkthdr.rcvif, at least for link-local
traffic (for in6_get_unicast_scopeid()). rcvif is not set for locally
generated traffic (e.g. from icmp6_reflect()), so we need to call the
correct output function.

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

14 months agosctp: don't do RTT measurements with cookies
Michael Tuexen [Thu, 16 Mar 2023 09:45:13 +0000 (10:45 +0100)]
sctp: don't do RTT measurements with cookies

When receiving a cookie, the receiver does not know whether the
peer retransmitted the COOKIE-ECHO chunk or not. Therefore, don't
do an RTT measurement. It might be much too long.
To overcome this limitation, one could do at least two things:
1. Bundle the INIT-ACK chunk with a HEARTBEAT chunk for doing the
   RTT measurement. But this is not allowed.
2. Add a flag to the COOKIE-ECHO chunk, which indicates that it
   is the initial transmission, and not a retransmission. But
   this requires an RFC.

MFC after: 1 week

14 months agosctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option
Michael Tuexen [Wed, 15 Mar 2023 21:55:23 +0000 (22:55 +0100)]
sctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option

14 months agosctp: improve negotiation of zero checksum feature
Michael Tuexen [Wed, 15 Mar 2023 21:29:52 +0000 (22:29 +0100)]
sctp: improve negotiation of zero checksum feature

Enforce consistency between announcing 0-cksum support and actually
using it in the association. The value from the inp when the
INIT ACK is sent must be used, not the one from the inp when the
cookie is received.

14 months agonetlink: improve snl(3)
Alexander V. Chernikov [Wed, 15 Mar 2023 13:56:26 +0000 (13:56 +0000)]
netlink: improve snl(3)

Summary:
* add snl_send_message() as a convenient send wrapper
* add signed integer parsers
* add snl_read_reply_code() to simplify operation result checks
* add snl_read_reply_multi() to simplify reading multipart messages
* add snl_create_genl_msg_request()
* add snl_get_genl_family() to simplify family name->id resolution
* add tests for some of the functionality

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

14 months agoarm64: Support stage 2 mappings in pmap_remove_all
Andrew Turner [Wed, 15 Mar 2023 16:27:51 +0000 (16:27 +0000)]
arm64: Support stage 2 mappings in pmap_remove_all

This has been hit when testing bhyve.

Sponsored by: Arm Ltd

14 months agossh: update FREEBSD-upgrade instructions
Ed Maste [Wed, 23 Feb 2022 18:33:24 +0000 (13:33 -0500)]
ssh: update FREEBSD-upgrade instructions

Make it clear that the 'freebsd-configure.sh' and 'freebsd-namespace.sh'
scripts are run from the crypto/openssh directory.

Sponsored by: The FreeBSD Foundation

14 months agoStop using the rid as an index in the arm timer
Andrew Turner [Wed, 15 Mar 2023 13:35:04 +0000 (13:35 +0000)]
Stop using the rid as an index in the arm timer

The order of the interrupt array doesn't matter. Store the described
interrupts at the start of the array to simplify iterating over them.

Reviewed by: imp, kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39094

14 months agoUse the arm physical timer when able
Andrew Turner [Wed, 15 Mar 2023 13:33:02 +0000 (13:33 +0000)]
Use the arm physical timer when able

To allow bhyve manage the virtual timer while in a guest have FreeBSD
use the virtual timer only when bhyve will be unavailable due to not
starting at EL2 where the hypervisor switcher will run.

Reviewed by: imp, kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39093

14 months agoSupport the arm64 pmap_remove_write for stage 2
Andrew Turner [Tue, 15 Nov 2022 17:49:42 +0000 (17:49 +0000)]
Support the arm64 pmap_remove_write for stage 2

The fields we need to adjust are different in stage 1 and stage 2
tables. Handle this by adding variables to hold the bits to check,
set, and clear.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37399

14 months agoarm64: limit EFI excluded regions to physical memory types
Mitchell Horne [Wed, 15 Mar 2023 15:26:57 +0000 (12:26 -0300)]
arm64: limit EFI excluded regions to physical memory types

Consolidate add_efi_map_entry() and exclude_efi_map_entry() into a
single function, handle_efi_map_entry(), so that the exact set of entry
types handled is the same in the addition or exclusion cases. Before,
exclude_efi_map_entry() had a 'default' case that would exclude all
entry types that were not listed explicitly in the switch statement.

Logically, we do not need to exclude a range that could not possibly be
added to physmem, and we do not need to exclude bus ranges that are not
physical memory, for example EFI_MD_TYPE_IOMEM.

Since physmem's ram0 device will reserve bus memory resources for its
owned ranges, this was preventing attachment of the watchdog device on
the RPI4B. For some reason its region of memory-mapped I/O appeared in
the EFI memory map (with the aforementioned EFI_MD_TYPE_IOMEM type).
This change fixes the attachment issue, as we prevent the physmem API
from messing with this range of bus space.

PR: 270044
Reported by: karels, Mark Millard
Reviewed by: andrew, karels, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39003

14 months agonet: refactor if_clone.c #1
Alexander V. Chernikov [Mon, 13 Mar 2023 10:41:58 +0000 (10:41 +0000)]
net: refactor if_clone.c #1

* Add ifc_find_cloner()
* Rename current ifc_find_cloner() to ifc_find_cloner_in_vnet()
* Add ifc_find_cloner_match()

This change simplifies the code a bit and reduces the diff to
 the netlink interface cloners merge (D39032).

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

14 months agoSupport arm64 stage2 TLB invalidation
Andrew Turner [Thu, 3 Nov 2022 16:01:37 +0000 (16:01 +0000)]
Support arm64 stage2 TLB invalidation

To invalidate stage 2 mappings on arm64 we may need to call into the
hypervisor so add a function pointer that bhyve can use to implement
this.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37254

14 months agoKeep per-timer interrupt data together
Andrew Turner [Tue, 14 Mar 2023 09:27:23 +0000 (09:27 +0000)]
Keep per-timer interrupt data together

Eliminate a redundant resource array allow possible use by bhyve later.

Reviewed by: kevans
Sponsored by: Arm Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37424

14 months agoveriexec: Improve comments
Warner Losh [Wed, 15 Mar 2023 04:59:20 +0000 (22:59 -0600)]
veriexec: Improve comments

Make it clear we're checking to see if the target is a verified file and
prevent its replacement if so.

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

14 months agolibbe: Avoid double printing cloning errors.
John Grafton [Wed, 15 Mar 2023 03:14:14 +0000 (21:14 -0600)]
libbe: Avoid double printing cloning errors.

be_clone calls be_clone_cb and both call set_error on the return
error path.  set_error prints the error resulting in a double print.
be_clone_cb should just return the error code and allow be_clone
to print it.

PR: 265248
Reported by: Graham Perrin
Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/685

14 months agojail: convert several functions from int to bool
Mina Galić [Wed, 15 Mar 2023 03:04:40 +0000 (21:04 -0600)]
jail: convert several functions from int to bool

these functions exclusively return (0) and (1), so convert them to bool

We also convert some networking related jail functions from int to bool
some of which were returning an error that was never used.

Differential Revision: https://reviews.freebsd.org/D29659
Reviewed by: imp, jamie (earlier version)
Pull Request: https://github.com/freebsd/freebsd-src/pull/663

14 months agorc: ignore .pkgsave files
Mina Galić [Wed, 15 Mar 2023 02:52:15 +0000 (20:52 -0600)]
rc: ignore .pkgsave files

The local parts of rc already skip .sample files; we add .pkgsave to the
list, and add logic for base.

Thanks to @RhodiumToad for getting this started.

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

14 months agoppp: Remove trailing semicolon
Elyes Haouas [Wed, 15 Mar 2023 02:09:16 +0000 (20:09 -0600)]
ppp: Remove trailing semicolon

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654

14 months agopmccontrol: Remove trailing semicolon
Elyes Haouas [Wed, 15 Mar 2023 02:09:16 +0000 (20:09 -0600)]
pmccontrol: Remove trailing semicolon

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654

14 months agolpr: Remove trailing semicolon
Elyes Haouas [Wed, 15 Mar 2023 02:09:16 +0000 (20:09 -0600)]
lpr: Remove trailing semicolon

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654

14 months agobhyve: Remove trailing semicolon
Elyes Haouas [Wed, 15 Mar 2023 02:09:16 +0000 (20:09 -0600)]
bhyve: Remove trailing semicolon

Macros shouldn't use trailing semicolon.

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654

14 months agoCI: Run pkgbase METALOG lint script
Ed Maste [Wed, 16 Nov 2022 21:24:19 +0000 (16:24 -0500)]
CI: Run pkgbase METALOG lint script

tools/pkgbase/metalog_reader.lua checks for errors in METALOG (for
pkgbase staging), such as hard links with differing modes, duplicate
entries, etc.  Run it as part of the Cirrus-CI job to prevent
regressions.

Reviewed by: manu, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37521

14 months ago.github: Test DISK_IMAGE_TOOLS_BOOTSTRAP in CI
Jessica Clarke [Wed, 15 Mar 2023 00:06:53 +0000 (00:06 +0000)]
.github: Test DISK_IMAGE_TOOLS_BOOTSTRAP in CI

Building the tools is quick so we should provide coverage of this to
ensure it keeps working, especially on non-FreeBSD.

Reviewed by: emaste, arichardson
Differential Revision: https://reviews.freebsd.org/D39073

14 months agoAdd new DISK_IMAGE_TOOLS_BOOTSTRAP option
Jessica Clarke [Wed, 15 Mar 2023 00:06:53 +0000 (00:06 +0000)]
Add new DISK_IMAGE_TOOLS_BOOTSTRAP option

This will build etdump, makefs and mkimg as bootstrap tools to allow
easily creating disk images. Note that etdump is bootstrapped due to its
use in the release scripts for building ISO images.

Reviewed by: emaste, arichardson
Differential Revision: https://reviews.freebsd.org/D39072

14 months agosrc.conf.5: Regen after ZFS-related options changes
Jessica Clarke [Wed, 15 Mar 2023 00:06:52 +0000 (00:06 +0000)]
src.conf.5: Regen after ZFS-related options changes

Since 9503d2704ca6 LOADER_ZFS gets turned off when ZFS is, and since
63715498ac6b ZFS is no longer disabled on powerpc and powerpcspe.

Reviewed by: emaste
Fixes: 9503d2704ca6 ("opts: Minor cleanup of ZFS options")
Fixes: 63715498ac6b ("powerpc: enable ZFS on 32 bit powerpc/powerpcspe")
Differential Revision: https://reviews.freebsd.org/D39071

14 months agosecure_getenv: Put under __BSD_VISIBLE
Warner Losh [Tue, 14 Mar 2023 23:42:18 +0000 (17:42 -0600)]
secure_getenv: Put under __BSD_VISIBLE

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

14 months agojail.8: Update the allow.nfsd section
Rick Macklem [Tue, 14 Mar 2023 22:28:02 +0000 (15:28 -0700)]
jail.8: Update the allow.nfsd section

This patch updates the information for "allow.nfsd"
and adds configuration information.

This is a content change.

Reviewed by: karels, markj, pauamma (manpages)
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D39033

14 months agonet80211: make ieee80211_scan_dump_channels private
Bjoern A. Zeeb [Tue, 14 Mar 2023 21:01:19 +0000 (21:01 +0000)]
net80211: make ieee80211_scan_dump_channels private

ieee80211_scan_dump_channels() is only used locally and only when
IEEE80211_DEBUG is compiled.  Stop exporting it, make it file local
and hide under the #ifdef to reduce the footprint for production
kernels a tiny bit.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38833

14 months agonet80211: define mask for ss_flags rather than using hardcoded 0xfff
Bjoern A. Zeeb [Tue, 14 Mar 2023 21:00:48 +0000 (21:00 +0000)]
net80211: define mask for ss_flags rather than using hardcoded 0xfff

scan state ss_flags in two places cut off the "internal" GOTPICK
options.  Replace the hardcoded 0xfff with a defined mask.
Note that "internal" flags is confusing as we also supplement the
the 16bit by another 16bit of "internal flags" passed around but
comaparing to GOTPICK never stored to my understanding.

No functional change.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D38832

14 months agonetmap: get rid of save_if_input for emulated adapters
Vincenzo Maffione [Tue, 14 Mar 2023 21:59:23 +0000 (21:59 +0000)]
netmap: get rid of save_if_input for emulated adapters

The save_if_input function pointer was meant to save the previous
value of ifp->if_input before replacing it with the emulated
adapter hook.
However, the same pointer value is already stored in the if_input
field of the netmap_adapter struct, to be used for host TX ring processing.

Reuse the netmap_adapter if_input field to simplify the code
and save some space.

MFC after: 14 days

14 months agoinfiniband: Convert BPF handling for IfAPI
Justin Hibbits [Thu, 9 Feb 2023 02:32:47 +0000 (21:32 -0500)]
infiniband: Convert BPF handling for IfAPI

Summary:
All callers of infiniband_bpf_mtap() call it through the wrapper macro,
which checks the if_bpf member explicitly.  Since this is getting
hidden, move this check into the internal function and remove the
wrapper macro.

Reviewed by: hselasky
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39024