]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agokerneldump: Inline dump_savectx() into its callers
Mark Johnston [Mon, 20 Mar 2023 18:16:00 +0000 (14:16 -0400)]
kerneldump: Inline dump_savectx() into its callers

The callers of dump_savectx() (i.e., doadump() and livedump_start())
subsequently call dumpsys()/minidumpsys(), which dump the calling
thread's stack when writing the dump.  If dump_savectx() gets its own
stack frame, that frame might be clobbered when its caller later calls
dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the
stack.

Fix this by making dump_savectx() a macro, so that savectx() is always
called directly by the function which subsequently calls
dumpsys()/minidumpsys().

This fixes stack unwinding for the panicking thread from arm64
minidumps.  The same happened to work on amd64, but kgdb reports the
dump_savectx() calls as coming from dumpsys(), so in that case it
appears to work by accident.

Fixes: c9114f9f86f9 ("Add new vnode dumper to support live minidumps")
Reviewed by: mhorne, jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39151

14 months agosh(1): fix history file write checking
Daniel Kolesa [Mon, 20 Mar 2023 16:42:59 +0000 (17:42 +0100)]
sh(1): fix history file write checking

We cannot just compare histsizeval() against 0, since that returns
a string pointer, which is always non-zero (non-null). The logic
in sethistsize() initializes the history size to 100 with values
that are non-number, and an empty string counts as that. Therefore,
the only time we want to not write into history with HISTSIZE val
set is when it's explicitly 0.

MFC after: 2 weeks

14 months agopf tests: try to trigger locking issues in pfsync_timeout()
Kristof Provost [Mon, 20 Mar 2023 13:58:34 +0000 (14:58 +0100)]
pf tests: try to trigger locking issues in pfsync_timeout()

PR: 268246
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

14 months agopfsync: fix pfsync_undefer_state() locking
Kristof Provost [Mon, 20 Mar 2023 13:29:55 +0000 (14:29 +0100)]
pfsync: fix pfsync_undefer_state() locking

pfsync_undefer_state() takes the bucket lock, but could get called from
places (e.g. from pfsync_update_state() or pfsync_delete_state()) where
we already held the lock.

As it can also be called from places where we don't yet hold the lock
create new locked variant for use when the lock is already held. Keep
using pfsync_undefer_state() where the lock must still be taken.

PR: 268246
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

14 months agopfsync: add missing unlock in pfsync_defer_tmo()
Kristof Provost [Mon, 20 Mar 2023 13:26:33 +0000 (14:26 +0100)]
pfsync: add missing unlock in pfsync_defer_tmo()

The callout for pfsync_defer_tmo() is created with
CALLOUT_RETURNUNLOCKED, because while the callout framework takes care
of taking the lock we want to run a few operations outside of the lock,
so we unlock ourselves.

However, if `sc->sc_sync_if == NULL` we return without releasing the
lock, and leak the lock, causing later deadlocks.
Ensure we always release the bucket lock when we exit pfsync_defer_tmo()

PR: 268246
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

14 months agonetipsec tests: Serialize
Mark Johnston [Mon, 20 Mar 2023 16:15:32 +0000 (12:15 -0400)]
netipsec tests: Serialize

The tunnel mode tests use VNET jails and reuse jail names.  Until this
is addressed, serialize them.

MFC after: 1 week

14 months agopkg-stage.sh: update port trailing version information
Glen Barber [Mon, 20 Mar 2023 14:36:51 +0000 (10:36 -0400)]
pkg-stage.sh: update port trailing version information

Reported by: Ian Smith, Graham Perrin
MFC after: 1 week
X-MFC-13.2: NO

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

14 months agocarp: use if_name()
Kristof Provost [Mon, 20 Mar 2023 09:22:39 +0000 (10:22 +0100)]
carp: use if_name()

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

14 months agocarp: document peer/peer6 and mcast/mcast6 in the relevant man pages
Kristof Provost [Mon, 6 Mar 2023 14:02:21 +0000 (15:02 +0100)]
carp: document peer/peer6 and mcast/mcast6 in the relevant man pages

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

14 months agocarp tests: unicast tests (IPv6)
Kristof Provost [Mon, 6 Mar 2023 07:49:57 +0000 (08:49 +0100)]
carp tests: unicast tests (IPv6)

Test the new unicast carp mode for IPv6.

There's a routing hop between the peers, to ensure that the TTL check is
correctly disabled for unicast carp.

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

14 months agocarp tests: unicast tests (IPv4)
Kristof Provost [Thu, 2 Mar 2023 17:21:06 +0000 (18:21 +0100)]
carp tests: unicast tests (IPv4)

Test the new unicast carp mode for IPv4.

There's a routing hop between the peers, to ensure that the TTL check is
correctly disabled for unicast carp.

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

14 months agocarp: support unicast
Kristof Provost [Wed, 15 Mar 2023 12:31:45 +0000 (13:31 +0100)]
carp: support unicast

Allow users to configure the address to send carp messages to. This
allows carp to be used in unicast mode, which is useful in certain
virtual configurations (e.g. AWS, VMWare ESXi, ...)

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

14 months agolibdtrace: fix indendation in dt_printd()
Christos Margiolis [Mon, 20 Mar 2023 13:34:20 +0000 (09:34 -0400)]
libdtrace: fix indendation in dt_printd()

No functional change.

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

14 months agoarm64: Adding a missing include file
Dmitry Mikushin [Mon, 20 Mar 2023 11:18:45 +0000 (11:18 +0000)]
arm64: Adding a missing include file

Adding a missing include file, which provides the definition of
SYSCTL_INT.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D39149

14 months agocarp tests: test manually switch between backup and master
Kristof Provost [Thu, 16 Mar 2023 10:16:24 +0000 (11:16 +0100)]
carp tests: test manually switch between backup and master

There's been at least one issue where we failed to correctly enter
NET_EPOCH that was triggered in this scenario.
Add a test case for it to make it easier to detect issues like this in
the future.

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

14 months agocarp: add netlink interface
Kristof Provost [Tue, 7 Mar 2023 18:17:09 +0000 (19:17 +0100)]
carp: add netlink interface

Allow carp configuration information to be supplied and retrieved via
netlink.

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

14 months agoext2_dirbad(): fix !DTRACE build
Konstantin Belousov [Mon, 20 Mar 2023 08:42:51 +0000 (10:42 +0200)]
ext2_dirbad(): fix !DTRACE build

Fixes: 3c2dc524c333747a8c5deb3f0f88b29a8e36dff4
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

14 months agoxhci(4): Describe Fresco Logic FL1009 USB 3.0 controller
Zhenlei Huang [Mon, 20 Mar 2023 04:00:59 +0000 (12:00 +0800)]
xhci(4): Describe Fresco Logic FL1009 USB 3.0 controller

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38922

14 months agoMFV: xz 5.4.2.
Xin LI [Mon, 20 Mar 2023 02:30:08 +0000 (19:30 -0700)]
MFV: xz 5.4.2.

MFC after: 2 weeks

14 months agoVendor import of xz 5.4.2 (trimmed)
Xin LI [Sun, 19 Mar 2023 17:03:12 +0000 (10:03 -0700)]
Vendor import of xz 5.4.2 (trimmed)

14 months agoping: Avoid reporting negative time statistics
Jose Luis Duran [Thu, 9 Feb 2023 23:38:54 +0000 (20:38 -0300)]
ping: Avoid reporting negative time statistics

Display a warning when the time goes back.

PR: 192417
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38480

14 months agoping tests: Add tests for IP header options
Jose Luis Duran [Thu, 9 Feb 2023 16:41:02 +0000 (13:41 -0300)]
ping tests: Add tests for IP header options

The function pr_pack() prints out a packet, if the IP packet contains
options, these are printed as well.

Test the functionality fixed in
70960bb86a3ba5b6f5c4652e613e6313a7ed1ac1.

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

14 months agoping: Remove pr_retip()
Jose Luis Duran [Thu, 9 Feb 2023 21:05:58 +0000 (18:05 -0300)]
ping: Remove pr_retip()

Ping used to provide some sort of packet sniffing capabilities, this was
in an era where hubs were used and tcpdump wasn't invented.

pr_iph() is a function that prints the IP header of the packet.

pr_retip() is essentially a wrapper function to pr_iph(), that also
displays the source and destination ports of a TCP or UDP packet.

After ef9e6dc7eebe9830511602904d3ef5218d964080 some of this
functionality was almost removed, to only display packets sent by us
(26+ years ago).

At this point, reaching this code path was only possible by doctoring
the original packet.

After 46d7b45a267b3d78c5054b210ff7b6c55bfca42b this code path can never
be reached.

Remove the code.

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

14 months agoping: Print the IP options of the original packet
Jose Luis Duran [Thu, 9 Feb 2023 15:47:53 +0000 (12:47 -0300)]
ping: Print the IP options of the original packet

When an ICMP packet contains an IP packet in its payload, and that
original IP packet contains options, these options were not displayed
accordingly in pr_iph().

pr_iph() is a function that prints the original "quoted packet" IP
header, with only an IP struct as an argument.  The IP struct does not
contain IP options, and it is not guaranteed that the options will be
contiguous in memory to the IP struct after
d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52.

Pass the raw ICMP data along with the IP struct, in order to print the
options, if any.

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

14 months agostress2: Added more FFS tests
Peter Holm [Sun, 19 Mar 2023 08:55:00 +0000 (09:55 +0100)]
stress2: Added more FFS tests

14 months agotcp_rack.4: Correct a link in the SEE ALSO section
Gordon Bergling [Sun, 19 Mar 2023 08:49:33 +0000 (09:49 +0100)]
tcp_rack.4: Correct a link in the SEE ALSO section

The PDF at arxiv.org is only accessible when
retrieving it via the website.

MFC after: 3 days

14 months agoFix syntax error in 0697670.
Kirk McKusick [Sun, 19 Mar 2023 00:02:59 +0000 (17:02 -0700)]
Fix syntax error in 0697670.

Reported by: Michael Tuexen

14 months agosctp: fix typo in assignment
Michael Tuexen [Sat, 18 Mar 2023 22:58:50 +0000 (23:58 +0100)]
sctp: fix typo in assignment

14 months agoDo not panic in case of corrupted UFS/FFS directory.
Kirk McKusick [Sat, 18 Mar 2023 22:36:54 +0000 (15:36 -0700)]
Do not panic in case of corrupted UFS/FFS directory.

Historically the system panic'ed when it encountered a corrupt
directory. This change recovers well enough to continue operations.
This change is made in response to a similar change made in the ext2
filesystem as described in the cited Differential Revision.

MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38503

14 months agonetgraph tests: Serialize
Mark Johnston [Sat, 18 Mar 2023 14:57:36 +0000 (10:57 -0400)]
netgraph tests: Serialize

Some tests share names for netgraph nodes, so they cannot be run in
parallel.

MFC after: 1 week

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