Commit Graph

282140 Commits

Author SHA1 Message Date
Peter Holm
bce30c896d stress2: Added two syzkaller reproducers 2023-03-18 10:31:31 +01:00
Gordon Bergling
ac6bc808f5 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
2023-03-18 10:02:59 +01:00
Wei Hu
8ea7fa16d9 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)
2023-03-18 07:07:54 +00:00
Wei Hu
927358dd98 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)
2023-03-18 07:07:35 +00:00
Konstantin Belousov
ab3ff87a33 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
2023-03-18 08:31:41 +02:00
Fedor Uporov
3c2dc524c3 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
2023-03-18 09:16:24 +03:00
Fedor Uporov
366da717de 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
2023-03-18 09:16:22 +03:00
Kyle Evans
6b49a630f4 daemon: kill off some stray blank lines
Overlooked in review; mea culpa.

Reported by:	jrtc27
2023-03-18 01:05:43 -05:00
Ihor Antonov
8117ea0a41 daemon: remove unnecessary memset in daemon_state_init()
Pull Request:	https://github.com/freebsd/freebsd-src/pull/694
2023-03-18 00:52:59 -05:00
Ihor Antonov
cf6356fd47 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
2023-03-18 00:52:59 -05:00
Zhenlei Huang
b754d7faaf uhci(4): Correct PCI device ID for Zhaoxin USB controller
And minor style fixes.

Tested by:	Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Fixes:		986c7be472 uhci(4): Add new USB IDs
Differential Revision:	https://reviews.freebsd.org/D38924
2023-03-18 01:30:19 +08:00
Zhenlei Huang
95b2d16b38 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:		f9237e1937 ehci(4): Add new USB IDs
Differential Revision:	https://reviews.freebsd.org/D38923
2023-03-18 01:30:18 +08:00
Zhenlei Huang
f50f53931e 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:		0d7064d58f xhci(4): Add new USB IDs
Differential Revision:	https://reviews.freebsd.org/D38921
2023-03-18 01:30:18 +08:00
Mateusz Guzik
62a573d953 vfs: retire KERN_VNODE
It got disabled in 2003:

commit acb18acfec
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
2023-03-17 16:21:45 +00:00
Jose Luis Duran
491263d7a6 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
2023-03-17 09:24:44 -04:00
Konstantin Belousov
ff6d60946a amd64 acpi_wakeup.c: fix typo
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-03-17 15:10:34 +02:00
Vitaliy Gusev
94a3876d7e
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:
65a3bc8373

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:			ee98f99d7a ("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
2023-03-17 13:50:08 +01:00
Emmanuel Vadot
949efdaa1d 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
2023-03-17 14:49:01 +01:00
Emmanuel Vadot
a4f8318ace UPDATING: Document arm video devices renaming.
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D39121
2023-03-17 13:35:03 +01:00
Emmanuel Vadot
00e84f52f0 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
2023-03-17 13:34:57 +01:00
Emmanuel Vadot
3bcb469c61 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
2023-03-17 13:34:52 +01:00
Emmanuel Vadot
8574d32f22 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
2023-03-17 13:34:46 +01:00
Emmanuel Vadot
37531e78df arm: allwinner: Garbage collect a10_hdmi driver
It was disconnected 5 years ago in 4573cd3914
("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
2023-03-17 13:34:40 +01:00
Emmanuel Vadot
1c4ff02a74 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
2023-03-17 13:34:03 +01:00
Emmanuel Vadot
cdb0c2a73d 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
2023-03-17 13:33:57 +01:00
Emmanuel Vadot
ba9f8eeb47 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
2023-03-17 13:33:51 +01:00
Emmanuel Vadot
031461b166 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
2023-03-17 13:33:46 +01:00
Peter Holm
7861fce32b stress2: Fix compiler warning 2023-03-17 12:06:52 +01:00
Corvin Köhne
d85147f3d6
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
2023-03-17 09:35:36 +01:00
Corvin Köhne
6f9ebb3d0f
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
2023-03-17 09:35:32 +01:00
Kyle Evans
f7a884cb01 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:	2fee875629 ("abstract out the vm detection via smbios..")
Differential Revision:	https://reviews.freebsd.org/D39140
2023-03-17 00:54:32 -05:00
Rick Macklem
896516e54a 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
2023-03-16 15:55:36 -07:00
Mateusz Guzik
58436df347 libipsec: ansify
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 19:19:35 +00:00
Mateusz Guzik
b38688df1d libmd: ansify
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 19:02:56 +00:00
Mateusz Guzik
ba5070ab44 libc/yp: sort out warnings
.. in least-effort manner

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 18:56:47 +00:00
Mateusz Guzik
3451ed888e less: silence K&R warns
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 18:24:12 +00:00
Mateusz Guzik
de0009f001 libz: silence K&R warns
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 18:22:24 +00:00
Mateusz Guzik
95a2b4d172 sendmail: silence K&R warns
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 18:18:48 +00:00
Mark Johnston
a7ba32e6bc tun tests: Fix cleanup definitions
Without this, vnet jails for the tests don't get torn down.

Fixes:	fe701c39e8 ("if_tun: Add basic connectivity test with nc tun support")
2023-03-16 13:27:24 -04:00
Andrew Turner
a671f96d93 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
2023-03-16 16:45:42 +00:00
Andrew Turner
3473f28322 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
2023-03-16 16:45:42 +00:00
Andrew Turner
f7acb7ed41 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
2023-03-16 16:45:42 +00:00
Andrew Turner
bc10894757 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
2023-03-16 16:45:42 +00:00
Andrew Turner
9a5dddc94f 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
2023-03-16 16:45:42 +00:00
Andrew Turner
5f2070adb9 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
2023-03-16 16:45:42 +00:00
Andrew Turner
83fb1bdbfe 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
2023-03-16 16:45:42 +00:00
Michael Tuexen
8ed1e2c880 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
2023-03-16 17:40:40 +01:00
Randall Stewart
69c7c81190 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
2023-03-16 11:43:16 -04:00
Dag-Erling Smørgrav
fa3af3ce50 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
2023-03-16 15:37:02 +00:00
Ed Maste
4d3fc8b057 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
2023-03-16 10:29:55 -04:00