Commit Graph

281050 Commits

Author SHA1 Message Date
Warner Losh
ce18e19394 stand: only compute symidx on x86
We only use symidx on x86, so only compute it on x86 to fix a set but
not used warning on aarch64.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38246
2023-02-02 13:04:05 -07:00
Dimitry Andric
a9e0629719 gh-bc: don't force CFLAGS to -O0 -g
Otherwise, CFLAGS passed in via bsd.sys.mk or the user's environment are
not respected, and this leads to link errors on riscv64sf.
2023-02-02 19:20:18 +01:00
Cy Schubert
79f7745c09 ipfilter: Fix use after free on packet with broken lengths
Under the scenario with a packet with length of 67 bytes, a header length
using the default of 20 bytes and a TCP data offset (th_off) of 48 will
cause m_pullup() to fail to make sure bytes are arragned contiguously.
m_pullup() will free the mbuf chain and return a null. ipfilter stores
the resultant mbuf address (or the resulting NULL) in its fr_info_t
structure. Unfortuntely the eroneous packet is not flagged for drop.
This results in a kernel page fault at line 410 of sys/netinet/ip_fastfwd.c
as it tries to use a now previously freed, by m_pullup(), mbuf.

PR:		266442
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	1 week
2023-02-02 09:41:22 -08:00
Cy Schubert
c941e8c65d ipfilter: Correctly type ipf_pullup()
ipf_pullup() outputs a pointer to ip_t. Though returning a pointer to
void does work, it is imprecise and not completely correct.

MFC after:	1 week
2023-02-02 09:41:22 -08:00
Mateusz Piotrowski
e7ab133648 timeout: Move from /usr/bin to /bin
timeout(1) is used by /etc/rc.d/zfskeys. Unfortunately, having
timeout(1) installed in /usr/bin causes problems when /usr is an
encrypted ZFS partition.

Implementing timeout(1) in sh(1) is not trivial. A more elegant solution
is to move timeout(1) to /bin so that it is available to early services
in the boot process.

PR:		265221
Reviewed by:	allanjude, des, imp
Approved by:	allanjude, des, imp
Reported by:	Ivan <r4@sovserv.ru>
Fixes:	33ff39796f Add zfskeys rc.d script for auto-loading encryption keys
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Modirum MDPay
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D38344
2023-02-02 18:34:35 +01:00
John Baldwin
0f031350f3 rescue: Fix link order of SSL libraries and fetch.
ld.bfd requires libraries to be linked in order.  libssl requires
libcrypto.  libfetch requires libssl.  To fix the latter, move fetch
up above tar rather than listing the ssl libraries twice.

Reviewed by:	delphij
Fixes:		ea34aa4780 rescue: Add fetch(1) to the rescue tool.
Differential Revision:	https://reviews.freebsd.org/D38304
2023-02-02 09:23:02 -08:00
Dmitry Chagin
ce20c00e85 linux(4): Remove stale comment that no longer applies.
MFC after:		1 week
2023-02-02 20:21:37 +03:00
Dmitry Chagin
6ad07a4b2b linux(4): Microoptimize rt_sendsig() on amd64.
Drop proc lock earlier, before copying user stuff.

Pointed out by:		kib
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D38326
MFC after:		1 week
2023-02-02 20:21:37 +03:00
Dmitry Chagin
a95cb95e12 linux(4): Preserve fpu fxsave state across signal delivery on amd64.
PR:			240768
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D38302
MFC after:		1 week
2023-02-02 20:21:37 +03:00
Dag-Erling Smørgrav
69d94f4c76 Add tarfs, a filesystem backed by tarballs.
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	pauamma, imp
Differential Revision:	https://reviews.freebsd.org/D37753
2023-02-02 18:19:29 +01:00
Andrew Turner
f29942229d Read the arm64 far early in el0 exceptions
When handling userspace exceptions on arm64 we need to dereference the
current thread pointer. If this is being promoted/demoted there is a
small window where it will cause another exception to be hit. As this
second exception will set the fault address register we will read the
incorrect value in the userspace exception handler.

Fix this be always reading the fault address before dereferencing the
current thread pointer.

Reported by:	olivier@
Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D38196
2023-02-02 16:43:15 +00:00
Andrew Turner
22e4897422 Limit where we disable the Arm generic timer
Only disable the Arm generic timer on arm64 when entering the kernel
through EL2. There is no guarantee it will be enabled if we are running
under a hypervisor.

Sponsored by:	Arm Ltd
2023-02-02 16:43:15 +00:00
Andrew Turner
03d6e03851 Check for the IORT before adding the ITS driver
Before adding the ITS interrupt controller driver to handle MSI/MSI-X
interrupts check if it is present in the IO Remapping Table (IORT).
If not don't attach as devices expect to use this table to find the
correct MSI interrupt controller.

Sponsored by: Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D37772
2023-02-02 16:43:15 +00:00
Andrew Gallatin
8de48df35c ixgbe: Do not count L3/L4 checksum errors as input errors
NIC input errors have traditionally indicated problems at the link
level (crc errors, runts, etc).  People tend to build monitoring
infrastructure  around such errors in order to monitor for bad network
hardware. When L3/L4 checksum errors are included in the category of
input errors, it breaks such monitoring, as these errors can originate
anywhere on the internet, and do not necessarily indicate faulty
local network hardware.

Reviewed by: erj, glebius
Differential Revision: https://reviews.freebsd.org/D38346
Sponsored by: Netflix
2023-02-02 10:14:12 -05:00
Dmitry Chagin
95b8603427 linux(4): Deduplicate linux_trans_osrel().
MFC after:		1 week
2023-02-02 17:58:07 +03:00
Dmitry Chagin
6039e966ff linux(4): Deduplicate linux_copyout_strings().
It is still present in the 32-bit Linuxulator on amd64.

MFC after:		1 week
2023-02-02 17:58:07 +03:00
Dmitry Chagin
9e550625f8 linux(4): Deduplicate linux_fixup_elf().
Use native routines to fixup initial process stack. On Arm64 linux_elf_fixup() is
noop, as it do the stack fixup (room for argc) in the linux_copyout_strings().

MFC after:		1 week
2023-02-02 17:58:07 +03:00
Dmitry Chagin
cc1b0f7d96 linux(4): Add coredump support to i386.
MFC after:		1 week
2023-02-02 17:58:06 +03:00
Dmitry Chagin
6f8439db24 linux(4): Use COMPAT_LINUX32 enstead of __ELF_WORD_SIZE.
COMPAT_LINUX32 option is defined for case when building 32-bit Linuxulator
for the 64-bit host. Usage of __ELF_WORD_SIZE is wrong here as it is equal to 32
on i386 too.

MFC after:		1 week
2023-02-02 17:58:06 +03:00
Dmitry Chagin
7446514533 linux(4): Microoptimize linux_elf.h for future use.
In order to reduce code duplication move coredump support definitions
into the appropriate header and hide private definitions.

MFC after:		1 week
2023-02-02 17:58:06 +03:00
Dag-Erling Smørgrav
6c85042afc cp: Simplify the common case.
* The allocated buffer is only used in the fallback case, so move it
  there.  The argument for passing it in from the caller was that if
  malloc(3) were to fail, we'd want it to fail before we started
  copying anything, but firstly, it was already not in the right place
  to ensure that, and secondly, malloc(3) never fails (except in very
  contrived circumstances, such as an unreasonable RLIMIT_AS or
  RLIMIT_DATA).

* Remove the mmap(2) option.  It is almost never beneficial,
  especially when the alternative is copy_file_range(2), and it adds
  needless complexity and indentation.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rmacklem, mav
Differential Revision:	https://reviews.freebsd.org/D38291
2023-02-02 15:46:04 +01:00
Dag-Erling Smørgrav
822fa7ae1e cp: Add tests involving sparse files.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38290
2023-02-02 15:45:55 +01:00
Dag-Erling Smørgrav
606d0e4a9a libc: Add tests for strchrnul(3).
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D38286
2023-02-02 15:45:45 +01:00
Stefan Eßer
f7e5465cb5 Revert "sys/kbio.h: support Unicode key codes in vt keymap files"
It has been pointed out, that this change causes ABI breakage for
[GP]IO_DEADKEYMAP. I'll create a review on phabricator.

Since the 8 bit limit on keycodes causes issues for certain keymaps,
a fix should be committed in time to allow a MFC to 13.2.

This reverts commit 1e0853ee84.

Reported by: 	    Jessica Clarke
2023-02-02 09:05:43 +01:00
Corvin Köhne
55f1ca209d
atrtc: expose power loss as sysctl
Exposing the a power loss of the rtc as an sysctl makes it easier to
detect an empty cmos battery.

Reviewed by:		manu
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38325
2023-02-02 08:25:08 +01:00
Rick Macklem
99187c3a44 prison_check_nfsd: Add check for enforce_statfs != 0
Since mountd(8) will not be able to do exports
when running in a vnet prison if enforce_statfs is
set to 0, add a check for this to prison_check_nfsd().

Reviewed by:	jamie, markj
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D38189
2023-02-01 16:02:20 -08:00
Konstantin Belousov
25c862ae50 libthr pshared: correct a bug in allocation
When __thr_pshared_offpage() is called for allocation, it must not use
the cached offpage for the key.  Instead, the cached offpage must be
unmapped and removed from the cache, if any.

It is legitimate for the user code to unmap the shared lock object without
destroying it, and then mapping something over the freed VA to carry
another shared lock.  In this case the cached offpage must be un-cached.

PR:	269277
Reported by:	rau8344@gmail.com
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38345
2023-02-02 00:59:27 +02:00
Konstantin Belousov
3cf37d1251 libthr: add pshared_destroy() helper
Rewviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38345
2023-02-02 00:59:27 +02:00
Konstantin Belousov
83a49712af kstack_contains(): account for struct pcb on stack
for arm64, arm, powerpc, and riscv

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38320
2023-02-02 00:59:27 +02:00
Konstantin Belousov
3f08bd5653 i386 trap_check_kstack(): use kstack_contains()
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38320
2023-02-02 00:59:27 +02:00
Konstantin Belousov
7c567fcc56 i386 kstack_contains(): account for pcb/fpu save area
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38320
2023-02-02 00:59:26 +02:00
Konstantin Belousov
2555f175b3 Move kstack_contains() and GET_STACK_USAGE() to MD machine/stack.h
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38320
2023-02-02 00:59:26 +02:00
John Baldwin
6cc52efa13 arm_smcc_1_2_*: Don't trash SP and X19 if no return value structure.
Jumping direct to ret was not restoring the saved value of x19 and was
also not adjusting sp to discard the two saved registers.

Reviewed by:	andrew
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D37922
2023-02-01 13:54:09 -08:00
Gleb Smirnoff
a0102dee34 sockets: in sousrsend() pass down the error to aio(4)
This somewhat undermines the initial goal of sousrsend() to have all
the special error handling for a write on a socket in a single place.
The aio(4) needs to see EWOULDBLOCK to re-schedule the job.  Because
aio(4) handles return from soreceive() and sousrsend() with the same
code, we can't check for (error == 0 && done < job_nbytes).  Keeping
this exclusion for aio(4) seems a lesser evil.

Fixes:	7a2c93b86e
2023-02-01 13:03:10 -08:00
Dmitry Chagin
575e48f1c4 linux(4): Deduplicate MI futex structures.
MFC after:	1 week
2023-02-01 21:57:04 +03:00
Gleb Smirnoff
fd53298799 unix: add myself to the copyright notice
for the new implementation of PF_UNIX/SOCK_DGRAM
2023-02-01 09:39:28 -08:00
Gleb Smirnoff
5ebea466dc inpcb: add myself to the copyright notice
for the SMR synchronization in late 2021 and following cleanups
2023-02-01 09:39:25 -08:00
Wei Hu
c75ae52216 arm64: Hyper-V: vPCI: Fix typo and some indentations
Fix a typo and some indentation errors in the previous commits.

Reported by:	jrtc27
Fixes:	db247798c5 ("arm64: Hyper-V: vPCI: SPI MSI mapping for gic v3 acpi in arm64")
Fixes:	6e5b082cab ("arm64: Hyper-V: vPCI: Adding Hyper-V PCI protocol 1.4")
Sponsored by:	Microsoft
2023-02-01 17:34:19 +00:00
Warner Losh
f051d72314 hyperv: Build and install where supported
Remove the hard-coded dependency on HYPERV being only x86. Instead, 100%
rely on MK_HYPERV. It's always right (since it's marked BROKEN (so set
to "no") on architectures we don't support).

Sponsored by:		Netflix
Reviewed by:		bz
Differential Revision:	https://reviews.freebsd.org/D38306
2023-02-01 10:21:57 -07:00
Wei Hu
ea11861e43 arm64: Hyper-V: vPCI: Enabling v-PCI in FreeBSD in ARM64 Hyper-V
This patch does remaining enablement in hyperv vpci driver to work
on arm64 Hyper-V. For that it required to use PCI protocol 1.4 and
corresponding different PCI message handling. Also new MSI allocation,
MSI-X mapping, release.

This is the last patch of total three patches to enalbe Hyper-V vPCI
support in arm64.

Reviewed by:	whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Obtained from:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37958
2023-02-01 16:59:27 +00:00
Stefan Eßer
1e0853ee84 sys/kbio.h: support Unicode key codes in vt keymap files
Some keyboard definitions return Unicode characters that cannot be
represented in the 8 bits provided by an u_char.

Extend then width of the keycode entries to 16 bits to allow for all
keycodes currently defined in share/vt/keymaps/*,kbd.

Reported by:	   yuri@aetern.org
MFC after:	   3 days
2023-02-01 17:24:18 +01:00
Krzysztof Zdziarski
c0a4a7bb94 qat: Fixed Coverity reported issue
This patch provides fixes for following Coverity issues:
CID 1504073
CID 1504075
CID 1504076
CID 1504077

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Karol Grzadziel <karolx.grzadziel@intel.com>

Fixes:		a977168c48 ("qat: Add Intel® 4xxx Series platform support")
Reviewed by:	markj
Sponsored by:   Intel Corporation
Differential Revision: https://reviews.freebsd.org/D38339
2023-02-01 11:02:08 -05:00
Wei Hu
6e5b082cab arm64: Hyper-V: vPCI: Adding Hyper-V PCI protocol 1.4
This is enabling the PCI protocol 1.4 and corresponding structures
in order to support arm64 Hyper-V.

This is the 2nd of the three patches to enable Hyper-V vPCI support
in arm64.

Reviewed by:	whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Obtained from:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37780
2023-02-01 16:00:10 +00:00
Wei Hu
db247798c5 arm64: Hyper-V: vPCI: SPI MSI mapping for gic v3 acpi in arm64
Microsoft Azure Hyper-V uses SPI to map MSI in ARM64, instead of
using LPI IDS. To enable that we need to have gic registered with
ACPI_MSI_XREF and gic acpi to map SPI for MSI.

This is the 1st of the three patchs to enable Hyper-V vPCI support
in arm64.

Reviewed by:	andrew, emaste, whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Obtained from:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37763
2023-02-01 15:40:08 +00:00
Dmitry Chagin
5c32146723 amd64: Eliminate write only cpu_fxsr.
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D38289
MFC after:		1 week
2023-02-01 18:17:06 +03:00
Mateusz Piotrowski
197947e0a3 ifconfig.8: Improve readability of vlanproto's description
Sponsored by:	Klara Inc.
MFC after:	1 week
2023-02-01 16:06:45 +01:00
Corvin Köhne
892feec221
vmm: avoid spurious rendezvous
A vcpu only checks if a rendezvous is in progress or not to decide if it
should handle a rendezvous. This could lead to spurios rendezvous where
a vcpu tries a handle a rendezvous it isn't part of. This situation is
properly handled by vm_handle_rendezvous but it could potentially
degrade the performance. Avoid that by an early check if the vcpu is
part of the rendezvous or not.

At the moment, rendezvous are only used to spin up application
processors and to send ioapic interrupts. Spinning up application
processors is done in the guest boot phase by sending INIT SIPI
sequences to single vcpus. This is known to cause spurious rendezvous
and only occurs in the boot phase. Sending ioapic interrupts is rare
because modern guest will use msi and the rendezvous is always send to
all vcpus.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37390
2023-02-01 12:36:36 +01:00
Gregory Neil Shapiro
17c8213559 Note upgrade to sendmail 8.17.1 2023-02-01 02:23:02 +00:00
Gregory Neil Shapiro
38c2f8fe62 Note upgrade to sendmail 8.17.1 2023-02-01 02:22:39 +00:00
Bjoern A. Zeeb
b0ddb44fd4 LinuxKPI: 802.11: fix indent in lkpi_wake_tx_queues()
Fix indentation in lkpi_wake_tx_queues().
No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 23:12:30 +00:00