]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agonfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd
Rick Macklem [Thu, 18 Feb 2021 22:38:01 +0000 (14:38 -0800)]
nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd

Add rc.d scripts that control the recently committed rpc.tlsclntd(8)
and rpc.tlsservd(8) daemons.

Reviewed by: gbe
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28432

3 years agonfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd
Rick Macklem [Thu, 18 Feb 2021 22:08:19 +0000 (14:08 -0800)]
nfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd

The kernel changes needed for nfs-over-tls have been committed to main.
However, nfs-over-tls requires user space daemons to handle the
TLS handshake and other non-application data TLS records.
There is one daemon (rpc.tlsclntd) for the client side and one daemon
(rpc.tlsservd) for the server side, although they share a fair amount
of code found in rpc.tlscommon.c and rpc.tlscommon.h.
They use a KTLS enabled OpenSSL to perform the actual work and, as such,
are only built when MK_OPENSSL_KTLS is set.
Communication with the kernel is done via upcall RPCs done on AF_LOCAL
sockets and the custom system call rpctls_syscall.

Reviewed by: gbe (man pages only), jhb (usr.sbin/Makefile only)
Comments by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28430
Relnotes: yes

3 years agoMove XPT_IMMEDIATE_NOTIFY handling out of periph lock.
Alexander Motin [Thu, 18 Feb 2021 21:22:01 +0000 (16:22 -0500)]
Move XPT_IMMEDIATE_NOTIFY handling out of periph lock.

It is a rare, but still better to not have lock dependencies.

MFC after: 1 month

3 years agoMerge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456
Dimitry Andric [Thu, 18 Feb 2021 21:30:27 +0000 (22:30 +0100)]
Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456

Interesting fixes:
b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877
7b2335c Mostly fix __cxa_demangle after #3

Reported by: arichardson
PR: 253226
MFC after: 3 days

3 years agocgem: improve usage of busdma(9) KPI
Mitchell Horne [Wed, 20 Jan 2021 15:07:53 +0000 (11:07 -0400)]
cgem: improve usage of busdma(9) KPI

BUS_DMA_NOCACHE should only be used when one needs to guarantee the
created mapping has uncached memory attributes, usually as a result
of buggy hardware. Normal use cases should pass BUS_DMA_COHERENT, to
create an appropriate mapping based on the flags passed to
bus_dma_tag_create().

This should have no functional change, since the DMA tags in this driver
are created without the BUS_DMA_COHERENT flag.

Reported by: mmel
Reviewed by: mmel, Thomas Skibo <thomas-bsd@skibo.net>
MFC after: 3 days

3 years agoImport libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456
Dimitry Andric [Thu, 18 Feb 2021 21:07:28 +0000 (22:07 +0100)]
Import libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456

Interesting fixes:
b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877
7b2335c Mostly fix __cxa_demangle after #3

3 years agovis(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 18 Feb 2021 18:04:23 +0000 (19:04 +0100)]
vis(1): Add EXAMPLES section

Add three examples showing the use of `-h`, `-l`, `-t`, `-w`

christos@netbsd.org to be notified.

Reviewed by: bcr@, gbe@, imp@
Approved by: bcr@, gbe@ (mentor), imp@

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

3 years agomq_unlink(3): Add manual page
Fernando Apesteguía [Thu, 18 Feb 2021 17:53:06 +0000 (18:53 +0100)]
mq_unlink(3): Add manual page

Summary: Add a succinct manual page for mq_unlink

Mostly borrowed from https://pubs.opengroup.org/onlinepubs/9699959099/ and
hence, the disclaimer note at the bottom.

PR: 243174
Reported by: rfg-freebsd@tristatelogic.com
Reviewed by: gbe@, yuripv@
Approved by: gbe@ (mentor), yuripv@
Differential Revision: https://reviews.freebsd.org/D28593

3 years agocryptosoft: Support per-op keys for AES-GCM and AES-CCM.
John Baldwin [Thu, 18 Feb 2021 17:24:35 +0000 (09:24 -0800)]
cryptosoft: Support per-op keys for AES-GCM and AES-CCM.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28752

3 years agoAdd Chacha20-Poly1305 support in the OCF backend for KTLS.
John Baldwin [Thu, 18 Feb 2021 17:24:26 +0000 (09:24 -0800)]
Add Chacha20-Poly1305 support in the OCF backend for KTLS.

This supports Chacha20-Poly1305 for both send and receive for TLS 1.2
and for send in TLS 1.3.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27841

3 years agoAdd Chacha20-Poly1305 as a KTLS cipher suite.
John Baldwin [Thu, 18 Feb 2021 17:23:59 +0000 (09:23 -0800)]
Add Chacha20-Poly1305 as a KTLS cipher suite.

Chacha20-Poly1305 for TLS is an AEAD cipher suite for both TLS 1.2 and
TLS 1.3 (RFCs 7905 and 8446).  For both versions, Chacha20 uses the
server and client IVs as implicit nonces xored with the record
sequence number to generate the per-record nonce matching the
construction used with AES-GCM for TLS 1.3.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27839

3 years agocryptocheck: Add Chacha20-Poly1305 AEAD coverage.
John Baldwin [Thu, 18 Feb 2021 17:23:36 +0000 (09:23 -0800)]
cryptocheck: Add Chacha20-Poly1305 AEAD coverage.

- Make openssl_gcm_encrypt generic to AEAD ciphers (aside from CCM)
  and use it for Chacha20-Poly1305.

- Use generic AEAD control constants instead of GCM/CCM specific names.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27838

3 years agoAdd an implementation of CHACHA20_POLY1305 to cryptosoft.
John Baldwin [Thu, 18 Feb 2021 17:22:18 +0000 (09:22 -0800)]
Add an implementation of CHACHA20_POLY1305 to cryptosoft.

This uses the chacha20 IETF and poly1305 implementations from
libsodium.  A seperate auth_hash is created for the auth side whose
Setkey method derives the poly1305 key from the AEAD key and nonce as
described in RFC 8439.

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

3 years agoAdd an OCF algorithm for ChaCha20-Poly1305 AEAD.
John Baldwin [Thu, 18 Feb 2021 17:21:56 +0000 (09:21 -0800)]
Add an OCF algorithm for ChaCha20-Poly1305 AEAD.

Note that this algorithm implements the mode defined in RFC 8439.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27836

3 years agogit-arc: Preserve the commit author when staging commits
Mark Johnston [Thu, 18 Feb 2021 15:59:43 +0000 (10:59 -0500)]
git-arc: Preserve the commit author when staging commits

Reported by: jhb

3 years agogit-arc: Globally save and restore the git checkout head
Mark Johnston [Thu, 18 Feb 2021 15:59:32 +0000 (10:59 -0500)]
git-arc: Globally save and restore the git checkout head

This script uses -e, so it's prone to exiting in awkward places.  In
particular, if arc diff fails, the script just exits without restoring
the checkout.

Mitigate this for now by using a global variable to record the previous
checkout and use a trap handler to restore it in the face of errors.  A
better solution might be to use arc diff's --head parameter but that
will require more testing.

Reported by: kevans
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28631

3 years agoddb: fix show devmap output on 32-bit arm
Thomas Skibo [Mon, 11 Jan 2021 20:58:12 +0000 (16:58 -0400)]
ddb: fix show devmap output on 32-bit arm

The output has been broken since 1b6dd6d772ca. Casting to uintmax_t
before the call to printf is necessary to ensure that 32-bit addresses
are interpreted correctly.

PR: 243236
MFC after: 3 days

3 years agoarm64: Include NUMA locality info in the CPU topology
Mark Johnston [Thu, 18 Feb 2021 15:50:57 +0000 (10:50 -0500)]
arm64: Include NUMA locality info in the CPU topology

The scheduler uses this topology to try and preserve locality when
migrating threads between CPUs and when performing work stealing.
Ensure that on NUMA systems it will at least take the NUMA topology into
account.

Reviewed by: mmel
Submitted by: Klara, Inc.
Sponsored by: Ampere Computing
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28579

3 years agoipmi_ssif: Fix inverted for the end of multi-part reads
Allan Jude [Thu, 18 Feb 2021 15:48:01 +0000 (15:48 +0000)]
ipmi_ssif: Fix inverted for the end of multi-part reads

As per Intelligent Platform Management Interface Specification v2.0 rev. 1.1,
section 12.5: SSIF Multi-part Read Transactions

Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D28749

3 years agoig4(4): Increase timeout to about 1 second
Allan Jude [Thu, 18 Feb 2021 15:47:17 +0000 (15:47 +0000)]
ig4(4): Increase timeout to about 1 second

Per the i2c spec, a slave device can stretch SCL idefinitely, so 25ms is
a bit arbitrary in general. smbus does specify an optional timeout
recovery mechanism to be done at about 25~35ms, but the IPMI SSIF spec
says that BMCs don't have any obligation to implement that.
The BMC on Altra seems to mostly respond within 25ms, but occasionally
will stretch SCL for ~300 msec.

Also, the count_us mechanism seems to actually timeout around 25%
earlier than it would claim (timeout really happening around 19ms
instead of 25ms).

Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.
Reviewed by: manu, imp
Differential Revision: https://reviews.freebsd.org/D28747

3 years agoFix ibnd_* manpages sources
Fernando Apesteguía [Wed, 17 Feb 2021 14:55:57 +0000 (15:55 +0100)]
Fix ibnd_* manpages sources

Some ibnd_* manpages source other manpages from a `man3/` directory when it
should reference the pages in the current directory.

Instead of modifying contributing sources and using `.so` (discouraged by
mandoc(1)) use MLINKS in the proper Makefile and do not install the affected
manpages.

PR: 237693
Reported by: wosch@FreeBSD.org
Reviewed by: gbe@ (mentor) yuripv@
Approved by: gbe@ (mentor) yuripv@
Differential Revision: https://reviews.freebsd.org/D28727

3 years agovn_printf: handle VI_FOPENING
Konstantin Belousov [Thu, 18 Feb 2021 14:24:55 +0000 (16:24 +0200)]
vn_printf: handle VI_FOPENING

Noted by: mjg
Sponsored by: The FreeBSD Foundation
MFC after: 6 days
Fixes: fa3bd463cee

3 years agozfs: bump version and install new share files
Martin Matuska [Thu, 18 Feb 2021 11:08:20 +0000 (12:08 +0100)]
zfs: bump version and install new share files

- bump version to 2.0.0-FreeBSD_gbf156c966
- install definition files for the new "-o compatibility" option
  to "zpool create"

MFC after: 2 weeks

3 years agozfs: merge OpenZFS master-bf156c966
Martin Matuska [Thu, 18 Feb 2021 14:17:31 +0000 (15:17 +0100)]
zfs: merge OpenZFS master-bf156c966

Notable upstream changes:
    bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt
    658fb8020 Add "compatibility" property for zpool feature sets

This update introduces a new pool property called "compatibility"
that can be used to enable a limited set of pool features on pool
creation and "stick" to it, so the "zpool upgrade" does not
accidentally enable features that are not desired. The value of
this property may then be changed later.

See zpool-features(5) for more information about the "compatibility"
pool property.

Obtained from: OpenZFS
MFC after: 2 weeks

3 years agoUse atomic loads/stores when updating td->td_state
Alex Richardson [Thu, 18 Feb 2021 10:25:10 +0000 (10:25 +0000)]
Use atomic loads/stores when updating td->td_state

KCSAN complains about racy accesses in the locking code. Those races are
fine since they are inside a TD_SET_RUNNING() loop that expects the value
to be changed by another CPU.

Use relaxed atomic stores/loads to indicate that this variable can be
written/read by multiple CPUs at the same time. This will also prevent
the compiler from doing unexpected re-ordering.

Reported by: GENERIC-KCSAN
Test Plan: KCSAN no longer complains, kernel still runs fine.
Reviewed By: markj, mjg (earlier version)
Differential Revision: https://reviews.freebsd.org/D28569

3 years agotests/sys/audit: Avoid race caused by starting auditd(8) for testing
Alex Richardson [Thu, 18 Feb 2021 10:14:27 +0000 (10:14 +0000)]
tests/sys/audit: Avoid race caused by starting auditd(8) for testing

In the CheriBSD CI we reproducibly see the first test in sys/audit
(administrative:acct_failure) fail due to a missing startup message.
It appears this is caused by a race condition when starting auditd:
`service auditd onestart` returns as soon as the initial auditd() parent
exits (after the daemon(3) call).
We can avoid this problem by setting up the auditd infrastructure
in-process: libauditd contains audit_quick_{start,stop}() functions that
look like they are ideally suited to this task.
This patch also avoids forking lots of shell processes for each of the 418
tests by using `auditon(A_SENDTRIGGER, &trigger, sizeof(trigger))` to check
for a running auditd(8) instead of using `service auditd onestatus`.

With these two changes (and D28388 to fix the XFAIL'd test) I can now
boot and run `cd /usr/tests/sys/audit && kyua test` without any failures
in a single-core QEMU instance. Before there would always be at least one
failed test.

Besides making the tests more reliable in CI, a nice side-effect of this
change is that it also significantly speeds up running them by avoiding
lots of fork()/execve() caused by shell scripts:
Running kyua test on an AArch64 QEMU took 315s before and now takes 68s,
so it's roughly 3.5 times faster. This effect is even larger when running
on a CHERI-RISC-V QEMU since emulating CHERI instructions on an x86 host
is noticeably slower than emulating AArch64.

Test Plan: aarch64+amd64 QEMU no longer fail.

Reviewed By: asomers
Differential Revision: https://reviews.freebsd.org/D28451

3 years agolibc/qsort: Don't allow interposing recursive calls
Alex Richardson [Thu, 18 Feb 2021 10:12:29 +0000 (10:12 +0000)]
libc/qsort: Don't allow interposing recursive calls

This causes problems when using ASAN with a runtime older than 12.0 since
the intercept does not expect qsort() to call itself using an interposable
function call. This results in infinite recursion and stack exhaustion
when a binary compiled with -fsanitize=address calls qsort.
See also https://bugs.llvm.org/show_bug.cgi?id=46832 and
https://reviews.llvm.org/D84509 (ASAN runtime patch).

To prevent this problem, this patch uses a static helper function
for the actual qsort() implementation. This prevents interposition and
allows for direct calls. As a nice side-effect, we can also move the
qsort_s checks to the top-level function and out of the recursive calls.

Reviewed By: kib
Differential Revision: https://reviews.freebsd.org/D28133

3 years agolibc: Fix t_spawn_fileactions test after ATF update
Alex Richardson [Thu, 18 Feb 2021 10:07:51 +0000 (10:07 +0000)]
libc: Fix t_spawn_fileactions test after ATF update

Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da
ATF opens the results file on startup. This fixes problems like
capsicumized tests not being able to open the file on exit.

However, this test closes all file descriptors above 3 to get a
deterministic fd table allocation for the child. Instead of using closefrom
(which will close the ATF output file FD) I've changed this test use
the lowest available fd and pass that to the helper program as a string.

We could also try to re-open the results file in ATF if we get a EBADF
error, but that will fail when running under Capsicum.

Reviewed By: cem
Differential Revision: https://reviews.freebsd.org/D28684

3 years agoAllocate BAR for ENA MSIx vector table
Michal Krawczyk [Thu, 18 Feb 2021 09:00:58 +0000 (10:00 +0100)]
Allocate BAR for ENA MSIx vector table

In the new ENA-based instances like c6gn, the vector table moved to a
new PCIe bar - BAR1. Previously it was always located on the BAR0, so
the resources were already allocated together with the registers.

As the FreeBSD isn't doing any resource allocation behind the scenes,
the driver is responsible to allocate them explicitly, before other
parts of the OS (like the PCI code allocating MSIx) will be able to
access them.

To determine dynamically BAR on which the MSIx vector table is present
the pci_msix_table_bar() is being used and the new BAR is allocated if
needed.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc
MFC after: 3 days

3 years agofix Navdeeps LINT_NOINET error.
Randall Stewart [Thu, 18 Feb 2021 12:29:12 +0000 (07:29 -0500)]
fix Navdeeps LINT_NOINET error.

3 years agocxgbe(4): Break up t4_read_chip_settings.
Navdeep Parhar [Thu, 18 Feb 2021 09:15:46 +0000 (01:15 -0800)]
cxgbe(4): Break up t4_read_chip_settings.

Read the PF-only hardware settings directly in get_params__post_init.
Split the rest into two routines used by both the PF and VF drivers: one
that reads the SGE rx buffer configuration and another that verifies
miscellaneous hardware configuration.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoUpdate OpenZFS to master-bf156c966
Martin Matuska [Thu, 18 Feb 2021 09:14:16 +0000 (10:14 +0100)]
Update OpenZFS to master-bf156c966

Notable upstream changes:
  bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt
  658fb8020 Add "compatibility" property for zpool feature sets

3 years agopf: Fix osfp configuration
Kristof Provost [Thu, 18 Feb 2021 07:36:46 +0000 (08:36 +0100)]
pf: Fix osfp configuration

pf_rule_to_krule() incorrectly converted the rule osfp configuration to
the krule structure.

Reported by: delphij@
MFC after: 3 days

3 years agoFix another pesky missing #ifdef TCPHPTS
Randall Stewart [Thu, 18 Feb 2021 06:27:30 +0000 (01:27 -0500)]
Fix another pesky missing #ifdef TCPHPTS

3 years agorelease: permanently remove the 'reldoc' target and associates
Glen Barber [Thu, 18 Feb 2021 04:00:03 +0000 (23:00 -0500)]
release: permanently remove the 'reldoc' target and associates

Following 7b1d1a1658ffb69eff93afc713f9e88ed8b20eac, the structure
for the reldoc target has significantly changed as result of the
ASCIIDoctor/Hugo migration.  As the release notes related files
on the installation medium are inherently out of date, purge them
entirely.

Discussed within: re, doceng
No objection: re (silence), doceng (silence)
Timeout: 2 weeks
MFC after: 1 week
MFC to: stable/13, stable/12, and stable/11 only
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agolibvmm: clean up vmmapi.h
Robert Wing [Fri, 29 Jan 2021 08:30:31 +0000 (23:30 -0900)]
libvmm: clean up vmmapi.h

struct checkpoint_op, enum checkpoint_opcodes, and
MAX_SNAPSHOT_VMNAME are not vmm specific, move them out of the vmmapi
header.

They are used for the save/restore functionality that bhyve(8)
provides and are better suited in usr.sbin/bhyve/snapshot.h

Since bhyvectl(8) requires these, the Makefile for bhyvectl has been
modified to include usr.sbin/bhyve/snapshot.h

Reviewed by:    kevans, grehan
Differential Revision:  https://reviews.freebsd.org/D28410

3 years agomips: Don't set __NO_TLS to disable some uses of TLS.
John Baldwin [Thu, 18 Feb 2021 00:34:23 +0000 (16:34 -0800)]
mips: Don't set __NO_TLS to disable some uses of TLS.

__NO_TLS was originally added to disable use of _Thread in the locale
code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34.  At the time
libc did not support TLS on MIPS (I believe), but TLS support was
added to libc (at least _set_tp.c) for MIPS about a month after
__NO_TLS was added, but __NO_TLS was still left around.

Reviewed by: imp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D28713

3 years agoriscv: Don't set __NO_TLS to disable some uses of TLS.
John Baldwin [Thu, 18 Feb 2021 00:33:09 +0000 (16:33 -0800)]
riscv: Don't set __NO_TLS to disable some uses of TLS.

__NO_TLS was originally added to disable use of _Thread in the locale
code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34.  The initial
RISC-V import set this for RISC-V presumably due to immaturity in the
toolchains at the time.  However, TLS via _Thread works fine in both
GCC and clang on RISC-V.

Reviewed by: mhorne, imp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D28712

3 years agoAdd a VA_IS_CLEANMAP() macro.
John Baldwin [Thu, 18 Feb 2021 00:32:11 +0000 (16:32 -0800)]
Add a VA_IS_CLEANMAP() macro.

This macro returns true if a provided virtual address is contained
in the kernel's clean submap.

In CHERI kernels, the buffer cache and transient I/O map are allocated
as separate regions.  Abstracting this check reduces the diff relative
to FreeBSD.  It is perhaps slightly more readable as well.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D28710

3 years agolockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)
Konstantin Belousov [Fri, 29 Jan 2021 23:48:55 +0000 (01:48 +0200)]
lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)

or EX_SHLOCK.  Do it by setting a vnode iflag indicating that the locking
exclusive open is in progress, and not allowing F_LOCK request to make
a progress until the first open finishes.

Requested by: mckusick
Reviewed by: markj, mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28697

3 years agoOpenSSL: Regen manual page for the previous commit
Jung-uk Kim [Wed, 17 Feb 2021 23:19:13 +0000 (18:19 -0500)]
OpenSSL: Regen manual page for the previous commit

This is regen for 9b2f020c14af71a2606012143432dd717c7cf90e.

MFC after: 1 week

3 years agoHandle partial data re-sending on ktls/sendfile on FreeBSD
Oleksandr Tymoshenko [Wed, 17 Feb 2021 22:49:30 +0000 (14:49 -0800)]
Handle partial data re-sending on ktls/sendfile on FreeBSD

Add a handler for EBUSY sendfile error in addition to
EAGAIN. With EBUSY returned the data still can be partially
sent and user code has to be notified about it, otherwise it
may try to send data multiple times.

PR: 251969
Reviewed by: jkim
Obtained from: OpenSSL (dfcfd17f2818cf520ce6381aed9ec3d2fc12170d)
MFC after: 1 week
Sponsored by: Netflix (merging to FreeBSD)
Differential Revision: https://reviews.freebsd.org/D28714

3 years agoAdd fileprefixmap compiler feature
Dan McGregor [Wed, 17 Feb 2021 22:26:49 +0000 (22:26 +0000)]
Add fileprefixmap compiler feature

-ffile-prefix-map=<old>=<new> is a compiler feature first added in
GCC 8, and implemented for clang 10. It remaps old paths to new paths
in both debug information and __FILE__ and __BASE_FILE__ macros. It can
be used to improve reproducibility or to hide local system directories.

I intend to use it to replace the real source directory and real object
directory with constant values across all builds.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D28632

3 years agouart: only use MSI on devices that advertise 1 MSI vector
Warner Losh [Wed, 17 Feb 2021 22:08:19 +0000 (15:08 -0700)]
uart: only use MSI on devices that advertise 1 MSI vector

This updates r311987/fb1d9b7f4113d which allowed any number of vectors to be
used. Since we're just attaching one instance, the meaning of more than one
vector is not clear and seems to cause problems. Fall back to old methods for
these cards.

PR: 235016
Submitted by: David Cross

3 years agoUpgrade to version 3.3.0
Stefan Eßer [Wed, 17 Feb 2021 21:56:16 +0000 (22:56 +0100)]
Upgrade to version 3.3.0

This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS:

Use of these options on the command line makes bc exit after executing
the given commands. These options will not cause bc to exit when
passed via the environment (but EOF in STDIN or -e or -f on the
command line will make bc exit as before).

The same applies to DC_ENV_ARGS with regard to the dc program.

3 years agogicv3_its: Don't restrict target CPUs based on SRAT
D Scott Phillips [Tue, 16 Feb 2021 18:07:27 +0000 (10:07 -0800)]
gicv3_its: Don't restrict target CPUs based on SRAT

ACPI Sec 5.2.16.5 (SRAT, GIC Interrupt Translation Service (ITS)
Affinity Structure) says:

> The GIC ITS Affinity Structure provides the association between
> a GIC ITS and a proximity domain. This enables the OSPM to
> discover the memory that is closest to the ITS, and use that in
> allocating its management tables and command queue.

Previously the ITS driver was using the proximity domain to
restrict which CPUs can be targeted by an LPI. We keep that logic
just for the original dual socket ThunderX which cannot forward
LPIs between sockets.

We also use the SRAT entry for its intended purpose of attempting
to allocate ITS table structures near the ITS.

Reviewed by: andrew
Sponsored by: Ampere Computing LLC
Differential Revision: https://reviews.freebsd.org/D28340

3 years agoGiant: move back Giant removal until 14
Warner Losh [Wed, 17 Feb 2021 16:28:41 +0000 (09:28 -0700)]
Giant: move back Giant removal until 14

Update the Giant Lock warning message to FreeBSD 14. It's growing increasling
clear that this won't be done before 13.0.

MFC: Insta (re@'s request)

3 years agoHandle negative return values from syncache_expand().
John Baldwin [Wed, 17 Feb 2021 21:28:04 +0000 (13:28 -0800)]
Handle negative return values from syncache_expand().

These errors do not clear so to NULL, so the existing check was
treating these failures as success.  The rest of do_pass_establish()
then tried to use the listen socket as if it was a connection socket
newly created by syncache_expand().

In addition, for negative return values, do not send a RST to the
peer.

Reported by: Sony Arpita Das @ Chelsio
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D28243

3 years agofwohci: Cast bitfield to uint32_t before passing it to roundup2().
John Baldwin [Wed, 17 Feb 2021 21:12:06 +0000 (13:12 -0800)]
fwohci: Cast bitfield to uint32_t before passing it to roundup2().

The fallback for __align_up() used by roundup2() uses __typeof__()
which doesn't work for bitfields.  This fixes the build on GCC which
uses the fallback.

Reviewed by: arichardson, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D28599

3 years agogicv3_its: Leave LPI interrupts enabled during handling
D Scott Phillips [Wed, 17 Feb 2021 19:06:48 +0000 (14:06 -0500)]
gicv3_its: Leave LPI interrupts enabled during handling

This follows the behavior on x86 where edge triggered interrupts are
not disabled when executing the handler. Because the ITS is a shared
resource, contention for the command queue lock can be substantial.

Suggested by: gallatin
Reviewed by: andrew
Tested by: gallatin
Sponsored by: Ampere Computing LLC
Differential Revision: https://reviews.freebsd.org/D28709

3 years agoAdd ifdef TCPHPTS around build_ack_entry and do_bpf_and_csum to avoid
Randall Stewart [Wed, 17 Feb 2021 17:49:42 +0000 (12:49 -0500)]
Add ifdef TCPHPTS around build_ack_entry and do_bpf_and_csum to avoid
warnings when HPTS is not included

Thanks to Gary Jennejohn for pointing this out.

3 years agoFix bootstrap tools build on macOS after 02af91c52e71e8a0f47251e637c9687f35d45dd9
Alex Richardson [Wed, 17 Feb 2021 16:03:11 +0000 (16:03 +0000)]
Fix bootstrap tools build on macOS after 02af91c52e71e8a0f47251e637c9687f35d45dd9

After changing the namespace.h header we need to provide _err on macOS, too.
Previously we used the system libc err*/warn*, but that does not provide
_err/_warn (which is used by other bootstrapped files from libc).
To fix this problem bootstrap err.c on macOS as well.

Fixes: 02af91c52 (Fix crossbuild bootstrap tools build with Clang 12)

3 years agoarm64: use macros to access special register values
Mitchell Horne [Thu, 28 Jan 2021 17:53:00 +0000 (13:53 -0400)]
arm64: use macros to access special register values

3 years agoBump __FreeBSD_version after f2583be110ca
Mitchell Horne [Wed, 17 Feb 2021 15:56:40 +0000 (11:56 -0400)]
Bump __FreeBSD_version after f2583be110ca

Provide a compatibility point around the ABI-breaking change.

Sponsored by: The FreeBSD Foundation

3 years agoarm64: extend struct db_reg to include watchpoint registers
Mitchell Horne [Thu, 28 Jan 2021 17:49:47 +0000 (13:49 -0400)]
arm64: extend struct db_reg to include watchpoint registers

The motivation is to provide access to these registers from userspace
via ptrace(2) requests PT_GETDBREGS and PT_SETDBREGS.

This change breaks the ABI of these particular requests, but is
justified by the fact that the intended consumers (debuggers) have not
been taught to use them yet. Making this change now enables active
upstream work on lldb to begin using this interface, and take advantage
of the hardware debugging registers available on the platform.

PR: 252860
Reported by: Michał Górny (mgorny@gentoo.org)
Reviewed by: andrew, markj (earlier version)
Tested by: Michał Górny (mgorny@gentoo.org)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28415

3 years agoarm64: handle watchpoint exceptions from EL0
Mitchell Horne [Fri, 5 Feb 2021 21:46:48 +0000 (17:46 -0400)]
arm64: handle watchpoint exceptions from EL0

This is a prerequisite to allowing the use of hardware watchpoints for
userspace debuggers.

This is also a slight departure from the x86 behaviour, since `si_addr`
returns the data address that triggered the watchpoint, not the
address of the instruction that was executed. Otherwise, there is no
straightforward way for the application to determine which watchpoint
was triggered. Make a note of this in the siginfo(3) man page.

Reviewed by: jhb, markj (earlier version)
Tested by: Michał Górny (mgorny@gentoo.org)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28561

3 years agoarm64: validate breakpoint registers
Mitchell Horne [Tue, 9 Feb 2021 18:29:38 +0000 (14:29 -0400)]
arm64: validate breakpoint registers

In particular, we want to disallow setting breakpoints on kernel
addresses from userspace. The control register fields are validated or
ignored as appropriate.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28560

3 years agolibdtrace: Stop relying on lex compatibility
Mark Johnston [Wed, 17 Feb 2021 15:49:38 +0000 (10:49 -0500)]
libdtrace: Stop relying on lex compatibility

It does not appear to be required, and as of commit 6b7e592c215f
("lex: Do not let input() return 0 when end-of-file is reached") it
causes input to return 0 instead of EOF when end-of-input is reached.

PR: 253440
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoBump the FreeBSD kernel version in kernel boot shim.
Hans Petter Selasky [Wed, 17 Feb 2021 15:45:09 +0000 (16:45 +0100)]
Bump the FreeBSD kernel version in kernel boot shim.

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoUpdate the LRO processing code so that we can support
Randall Stewart [Wed, 27 Jan 2021 17:09:32 +0000 (12:09 -0500)]
Update the LRO processing code so that we can support
a further CPU enhancements for compressed acks. These
are acks that are compressed into an mbuf. The transport
has to be aware of how to process these, and an upcoming
update to rack will do so. You need the rack changes
to actually test and validate these since if the transport
does not support mbuf compression, then the old code paths
stay in place. We do in this commit take out the concept
of logging if you don't have a lock (which was quite
dangerous and was only for some early debugging but has
been left in the code).

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

3 years agopf tests: Explicitly ask for python3
Kristof Provost [Wed, 17 Feb 2021 10:45:54 +0000 (11:45 +0100)]
pf tests: Explicitly ask for python3

If we install the scapy package (which we do list as a dependency) we
don't automatically install python (but we do have python3).

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC (“Netgate”’)

3 years agopf: Assert that pfil_link() calls succeed
Kristof Provost [Wed, 17 Feb 2021 10:44:37 +0000 (11:44 +0100)]
pf: Assert that pfil_link() calls succeed

These should only fail if we use them incorrectly, so assert that they
succeed.

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC (“Netgate”’)

3 years agoarm64: rpi4: gpio: Add brcm,bcm2711-gpio compatible
Emmanuel Vadot [Wed, 17 Feb 2021 12:12:45 +0000 (13:12 +0100)]
arm64: rpi4: gpio: Add brcm,bcm2711-gpio compatible

Looks like we never enabled the main gpio controller on the RPI4 board.
Now gpio are usable.

MFC after: 3 days

3 years agoarm64: rpi4: firmware: Attach at BUS_PASS_BUS + BUS_PASS_ORDER_LATE
Emmanuel Vadot [Wed, 17 Feb 2021 12:11:36 +0000 (13:11 +0100)]
arm64: rpi4: firmware: Attach at BUS_PASS_BUS + BUS_PASS_ORDER_LATE

The node have now a compatible with simple-mfd so we need to attach
at the same pass so the specific driver will be used.

MFC after: 3 days
PR: 252971

3 years agoautomount(8): fix absolute path when creating a mountpoint
Robert Wing [Wed, 17 Feb 2021 09:22:23 +0000 (00:22 -0900)]
automount(8): fix absolute path when creating a mountpoint

When executing automount(8), it will attempt to create the directory where an
autofs filesystem is to be mounted. Explicity set the root path for this
directory to "/".

This fixes the issue where the directory being created was being treated as a
relative path instead of an absolute path (as expected).

PR:     224601
Reported by:    kusumi.tomohiro@gmail.com
Reviewed by:    trasz
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27832

3 years agoFix crossbuild bootstrap tools build with Clang 12
Alex Richardson [Wed, 10 Feb 2021 11:05:02 +0000 (11:05 +0000)]
Fix crossbuild bootstrap tools build with Clang 12

Clang 12 no longer allows re-defining a weak symbol as non-weak. This
happed here because we compile err.c with _err defined to err. To fix
this, use the same approach as the libc namespace.h

3 years agopf: Remove unused return value from (de)hook_pf()
Kristof Provost [Tue, 16 Feb 2021 11:40:51 +0000 (12:40 +0100)]
pf: Remove unused return value from (de)hook_pf()

These functions always return 0, which is good, because the code calling
them doesn't handle this error gracefully.

As the functions always succeed remove their return value, and the code
handling their errors (because it was never executed anyway).

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (“Netgate”’)

3 years agolex: Do not let input() return 0 when end-of-file is reached
Jung-uk Kim [Wed, 17 Feb 2021 07:22:47 +0000 (02:22 -0500)]
lex: Do not let input() return 0 when end-of-file is reached

Importing flex 2.6.4 has introduced a regression: input() now returns 0
instead of EOF to indicate that the end of input was reached, just like
traditional AT&T and POSIX lex.  Note the behavior contradicts flex(1).
See "INCOMPATIBILITIES WITH LEX AND POSIX" section for information.
This incompatibility traces back to the original version and documented
in its manual page by the Vern Paxson.

Apparently, it has been reported in a few places, e.g.,

https://github.com/westes/flex/issues/448
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911415

Unfortunately, this also breaks the scanner used by libdtrace and
dtrace is unable to resolve some probe argument types as a result.  See
PR253440 for more information.

Note the regression was introduced by the following upstream commit
without any explanation or documentation change:

https://github.com/westes/flex/commit/f863c9490e6912ffcaeb12965fb3a567a10745ff

Now we restore the traditional flex behavior unless lex-compatibility
mode is set with "-l" option because I believe the author originally
wanted to make it more lex and POSIX compatible.

PR: 253440
Reported by: markj

3 years agoOpenSSL: Regen assembly files for OpenSSL 1.1.1j
Jung-uk Kim [Wed, 17 Feb 2021 05:35:11 +0000 (00:35 -0500)]
OpenSSL: Regen assembly files for OpenSSL 1.1.1j

3 years agoOpenSSL: Remove obsolete include directory
Jung-uk Kim [Wed, 17 Feb 2021 03:53:37 +0000 (22:53 -0500)]
OpenSSL: Remove obsolete include directory

This directory was deprecated since OpenSSL 1.1.1e.

https://github.com/openssl/openssl/pull/9681

3 years agocxgbe(4): Save proper zone index on low memory in refill_fl().
Alexander Motin [Wed, 17 Feb 2021 02:15:28 +0000 (21:15 -0500)]
cxgbe(4): Save proper zone index on low memory in refill_fl().

When refill_fl() fails to allocate large (9/16KB) mbuf cluster, it
falls back to safe (4KB) ones.  But it still saved into sd->zidx
the original fl->zidx instead of fl->safe_zidx.  It caused problems
with the later use of that cluster, including memory and/or data
corruption.

While there, make refill_fl() to use the safe zone for all following
clusters for the call, since it is unlikely that large succeed.

MFC after: 3 days
Sponsored by: iXsystems, Inc.
Reviewed by: np, jhb
Differential Revision: https://reviews.freebsd.org/D28716

3 years agolinux: Update the i386/linux vdso deinitialization routine
Mark Johnston [Tue, 16 Feb 2021 22:06:20 +0000 (17:06 -0500)]
linux: Update the i386/linux vdso deinitialization routine

This was missed in commit 0fc8a796722 ("linux: Unmap the VDSO page when
unloading").

Reported by: Mark Millard
MFC with: 0fc8a796722

3 years agoOpenSSL: Regen manual pages for OpenSSL 1.1.1j.
Jung-uk Kim [Tue, 16 Feb 2021 22:05:00 +0000 (17:05 -0500)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1j.

3 years agoOpenSSL: Merge OpenSSL 1.1.1j
Jung-uk Kim [Tue, 16 Feb 2021 22:00:27 +0000 (17:00 -0500)]
OpenSSL: Merge OpenSSL 1.1.1j

Merge commit '4f55bd5321b72491d4eff396e4928e9ab0706735'

3 years agoFix NOINET6 build broken by 2fe5a79425c7.
Alexander V. Chernikov [Tue, 16 Feb 2021 21:49:48 +0000 (21:49 +0000)]
Fix NOINET6 build broken by 2fe5a79425c7.

Reported by: mjg

3 years agoFix dst/netmask handling in routing socket code.
Alexander V. Chernikov [Tue, 16 Feb 2021 20:30:04 +0000 (20:30 +0000)]
Fix dst/netmask handling in routing socket code.

Traditionally routing socket code did almost zero checks on
 the input message except for the most basic size checks.

This resulted in the unclear KPI boundary for the routing system code
 (`rtrequest*` and now `rib_action()`) w.r.t message validness.

Multiple potential problems and nuances exists:
* Host bits in RTAX_DST sockaddr. Existing applications do send prefixes
 with hostbits uncleared. Even `route(8)` does this, as they hope the kernel
 would do the job of fixing it. Code inside `rib_action()` needs to handle
 it on its own (see `rt_maskedcopy()` ugly hack).
* There are multiple way of adding the host route: it can be DST without
 netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set correspondingly.
 Currently, these 2 options create 2 DIFFERENT routes in the kernel.
* no sockaddr length/content checking for the "secondary" fields exists: nothing
 stops rtsock application to send sockaddr_in with length of 25 (instead of 16).
 Kernel will accept it, install to RIB as is and propagate to all rtsock consumers,
 potentially triggering bugs in their code. Same goes for sin_port, sin_zero, etc.

The goal of this change is to make rtsock verify all sockaddr and prefix consistency.
Said differently, `rib_action()` or internals should NOT require to change any of the
 sockaddrs supplied by `rt_addrinfo` structure due to incorrectness.

To be more specific, this change implements the following:
* sockaddr cleanup/validation check is added immediately after getting sockaddrs from rtm.
* Per-family dst/netmask checks clears host bits in dst and zeros all dst/netmask "secondary" fields.
* The same netmask checking code converts /32(/128) netmasks to "host" route case
 (NULL netmask, RTF_HOST), removing the dualism.
* Instead of allowing ANY "known" sockaddr families (0<..<AF_MAX), allow only actually
 supported ones (inet, inet6, link).
* Automatically convert `sockaddr_sdl` (AF_LINK) gateways to
  `sockaddr_sdl_short`.

Reported by: Guy Yur <guyyur at gmail.com>
Reviewed By: donner
Differential Revision: https://reviews.freebsd.org/D28668
MFC after: 3 days

3 years agoAdd ifa_try_ref() to simplify ifa handling inside epoch.
Alexander V. Chernikov [Tue, 16 Feb 2021 20:12:58 +0000 (20:12 +0000)]
Add ifa_try_ref() to simplify ifa handling inside epoch.

More and more code migrates from lock-based protection to the NET_EPOCH
 umbrella. It requires some logic changes, including, notably, refcount
 handling.

When we have an `ifa` pointer and we're running inside epoch we're
 guaranteed that this pointer will not be freed.
However, the following case can still happen:
 * in thread 1 we drop to 0 refcount for ifa and schedule its deletion.
 * in thread 2 we use this ifa and reference it
 * destroy callout kicks in
 * unhappy user reports bug

To address it, new `ifa_try_ref()` function is added, allowing to return
 failure when we try to reference `ifa` with 0 refcount.
Additionally, existing `ifa_ref()` is enforced with `KASSERT` to provide
 cleaner error in such scenarious.

Reviewed By: rstone, donner
Differential Revision: https://reviews.freebsd.org/D28639
MFC after: 1 week

3 years agoMake in_localip_more() fib-aware.
Alexander V. Chernikov [Tue, 16 Feb 2021 20:00:46 +0000 (20:00 +0000)]
Make in_localip_more() fib-aware.

It fixes loopback route installation for the interfaces
 in the different fibs using the same prefix.

Reviewed By: donner
PR: 189088
Differential Revision: https://reviews.freebsd.org/D28673
MFC after: 1 week

3 years agoImport OpenSSL 1.1.1j.
Jung-uk Kim [Tue, 16 Feb 2021 19:54:02 +0000 (14:54 -0500)]
Import OpenSSL 1.1.1j.

3 years agojail: Handle a possible race between jail_remove(2) and fork(2)
Jamie Gritton [Tue, 16 Feb 2021 19:19:13 +0000 (11:19 -0800)]
jail: Handle a possible race between jail_remove(2) and fork(2)

jail_remove(2) includes a loop that sends SIGKILL to all processes
in a jail, but skips processes in PRS_NEW state.  Thus it is possible
the a process in mid-fork(2) during jail removal can survive the jail
being removed.

Add a prison flag PR_REMOVE, which is checked before the new process
returns.  If the jail is being removed, the process will then exit.
Also check this flag in jail_attach(2) which has a similar issue.

Reported by:    trasz
Approved by:    kib
MFC after:      3 days

3 years agoUse iflib_if_init_locked() during media change instead of iflib_init_locked().
Allan Jude [Sun, 14 Feb 2021 18:39:09 +0000 (18:39 +0000)]
Use iflib_if_init_locked() during media change instead of iflib_init_locked().

iflib_init_locked() assumes that iflib_stop() has been called, however,
it is not called for media changes.
iflib_if_init_locked() calls stop then init, so fixes the problem.

PR: 253473
MFC after: 3 days
Reviewed by: markj
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28667

3 years agobi_load: only add MODULEP on arches that have it defined
Roger Pau Monné [Tue, 16 Feb 2021 15:06:14 +0000 (16:06 +0100)]
bi_load: only add MODULEP on arches that have it defined

Do not attempt to add MODINFOMD_MODULEP to the kernel medatada on
arches that don't have it defined.

This fixes the build for arches different than amd64 after
7d3259775cb69f250df3e7fe51d6fff2283c6f20.

Sponsored by: Citrix Systems R&D
Reported by: lwhsu, arichardson

3 years agolinux: Unmap the VDSO page when unloading
Mark Johnston [Tue, 16 Feb 2021 14:30:21 +0000 (09:30 -0500)]
linux: Unmap the VDSO page when unloading

linux_shared_page_init() creates an object and grabs and maps a single
page to back the VDSO.  When destroying the VDSO object, we failed to
destroy the mapping and free KVA.  Fix this.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28696

3 years agoUpdate capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b
Alex Richardson [Tue, 16 Feb 2021 14:35:12 +0000 (14:35 +0000)]
Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b

This includes changes to use GTEST_SKIP() instead of the local hand-rolled
mechanism as well as a few minor cleanups.

3 years agoxen/efi: introduce a PV interface for EFI run time services for dom0
Roger Pau Monné [Fri, 12 Feb 2021 12:11:34 +0000 (13:11 +0100)]
xen/efi: introduce a PV interface for EFI run time services for dom0

FreeBSD when running as a dom0 under Xen is not supposed to access the
run time services directly, and instead should proxy the calls through
Xen using an hypercall interface that exposes access to selected run
time services.

Implement the efirt interface on top of the Xen provided hypercalls.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D28621

3 years agoefirt: add hooks for diverging EFI implementations
Roger Pau Monné [Fri, 12 Feb 2021 11:11:58 +0000 (12:11 +0100)]
efirt: add hooks for diverging EFI implementations

Introduce a set of hooks for MI EFI public functions, so that a new
implementation can be done. This will be used to implement the Xen PV
EFI interface that's used when running FreeBSD as a Xen dom0 from UEFI
firmware. Also make the efi_status_to_errno non-static since it will
be used to evaluate status return values from the PV interface.

No functional change indented.

Sponsored by: Citrix Systems R&D
Reviewed by: kib, imp
Differential revision: https://reviews.freebsd.org/D28620

3 years agoxen/boot: allow specifying boot method when booted from Xen
Roger Pau Monné [Mon, 8 Feb 2021 10:28:36 +0000 (11:28 +0100)]
xen/boot: allow specifying boot method when booted from Xen

Allow setting the bootmethod variable from the Xen PVH entry point, in
order to be able to correctly set the underlying firmware mode when
booted as a dom0.

Move the bootmethod variable to be defined in x86/cpu_machdep.c
instead so it can be shared by both i386 and amd64.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D28619

3 years agostand/multiboot2: add support for booting a Xen dom0 in UEFI mode
Roger Pau Monné [Wed, 27 Jan 2021 11:23:32 +0000 (12:23 +0100)]
stand/multiboot2: add support for booting a Xen dom0 in UEFI mode

Add some basic multiboot2 infrastructure to the EFI loader in order to
be capable of booting a FreeBSD/Xen dom0 when booted from UEFI.

Only a very limited subset of the multiboot2 protocol is implemented
in order to support enough to boot into Xen, the implementation
doesn't intend to be a full multiboot2 capable implementation.

Such multiboot2 functionality is hooked up into the amd64 EFI loader,
which is the only architecture that supports Xen dom0 on FreeBSD.

The options to boot a FreeBSD/Xen dom0 system are exactly the same as
on BIOS, and requires setting the xen_kernel and xen_cmdline options
in loader.conf.

Sponsored by: Citrix Systems R&D
Reviewed by: tsoome, imp
Differential revision: https://reviews.freebsd.org/D28497

3 years agostand/efi: add modulep to kernel metadata
Roger Pau Monné [Fri, 5 Feb 2021 10:11:36 +0000 (11:11 +0100)]
stand/efi: add modulep to kernel metadata

This mirrors the functionality of the BIOS amd64 bi_load function,
that stashes the absolute address of the module metadata. This is
required for booting as a Xen dom0 that does relocate the modulep and
the loaded modules, and thus requires adjusting the offset.

No functional change introduced, further patches will make use of this
functionality for Xen dom0 loading.

Sponsored by: Citrix Systems R&D
Reviewed by: imp
Differential revision: https://reviews.freebsd.org/D28496

3 years agostand/efi: allow not exiting boot services
Roger Pau Monné [Fri, 5 Feb 2021 10:15:19 +0000 (11:15 +0100)]
stand/efi: allow not exiting boot services

Xen requires that UEFI BootServices are enabled in order to boot, so
introduce a new parameter to bi_load in order to select whether BS
should be exited.

No functional change introduced in this patch, as all current users of
bi_load request BS to be exited. Further changes will make use of this
functionality.

Note the memory map is still appended to the kernel metadata, even
when it could be modified by further calls to the Boot Services, as it
will be used to detect if the kernel has been booted from UEFI.

Sponsored by: Citrix Systems R&D
Reviewed by: tsoome, imp
Differential revision: https://reviews.freebsd.org/D28495

3 years agoUpdate capsicum-test to 7707222b46abe52d18fd4fbb76115ffdb3e6f74b
Alex Richardson [Tue, 16 Feb 2021 13:12:51 +0000 (13:12 +0000)]
Update capsicum-test to 7707222b46abe52d18fd4fbb76115ffdb3e6f74b

Using the following steps:
```
git worktree add ../freebsd-vendor-capsicum-test freebsd/vendor/google/capsicum-test
cd ../freebsd-vendor-capsicum-test
git remote add upstream-capsicum-test https://github.com/google/capsicum-test
git fetch upstream-capsicum-test
git checkout -f upstream-capsicum-test/dev --
git rm -rf autoconf/ casper/ gtest-1.10.0/ libcaprights/
git commit
```

3 years agoupdate the SACK loss recovery to RFC6675, with the following new features:
Richard Scheffenegger [Tue, 16 Feb 2021 11:18:43 +0000 (12:18 +0100)]
update the SACK loss recovery to RFC6675, with the following new features:
- improved pipe calculation which does not degrade under heavy loss
- engaging in Loss Recovery earlier under adverse conditions
- Rescue Retransmission in case some of the trailing packets of a request got lost

All above changes are toggled with the sysctl "rfc6675_pipe" (disabled by default).

Reviewers: #transport, tuexen, lstewart, slavash, jtl, hselasky, kib, rgrimes, chengc_netapp.com, thj, #manpages, kbowling, #netapp, rscheff
Reviewed By: #transport
Subscribers: imp, melifaro
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D18985

3 years agozfs: change file mode of all merged tests
Martin Matuska [Tue, 16 Feb 2021 11:23:43 +0000 (12:23 +0100)]
zfs: change file mode of all merged tests

If the ksh files are not executable then the tests are not run
and reported as failed.

MFC after: 2 weeks
X-MFC-with: 6b52139eb8e8eda0ea263b24735556194f918642

3 years agopf tests: Test unicast reverse path forwarding check
Kristof Provost [Mon, 15 Feb 2021 21:16:36 +0000 (22:16 +0100)]
pf tests: Test unicast reverse path forwarding check

Ensure that pf's urpf-failed keyword works as expected.

PR: 253479
MFC after: 1 week
Reviewed by: melifaro@
Differential Revision: https://reviews.freebsd.org/D28694

3 years agoSource repo changes to add new committer Rajesh Kumar M A
Rajesh Kumar M A [Tue, 16 Feb 2021 08:52:09 +0000 (08:52 +0000)]
Source repo changes to add new committer Rajesh Kumar M A

Approved by: vmaffione, gallatin

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

3 years agoUFS snapshots: properly set the vm object size.
Konstantin Belousov [Mon, 15 Feb 2021 03:36:02 +0000 (05:36 +0200)]
UFS snapshots: properly set the vm object size.

Citing Kirk:
The previous code [before 8563de2f2799b2cb -- kib] did not call
vnode_pager_setsize() but worked because later in ffs_snapshot() it
does a UFS_WRITE() to output the snaplist. Previously the UFS_WRITE()
allocated the extra block at the end of the file which caused it to do
the needed vnode_pager_setsize(). But the new code had already allocated
the extra block, so UFS_WRITE() did not extend the size and thus did not
do the vnode_pager_setsize().

PR: 253158
Reported by: Harald Schmalzbauer <bugzilla.freebsd@omnilan.de>
Reviewed by: mckusick
Tested by: cy
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agopgcache read: protect against reads past end of the vm object size
Konstantin Belousov [Mon, 15 Feb 2021 03:34:06 +0000 (05:34 +0200)]
pgcache read: protect against reads past end of the vm object size

If uio_offset is past end of the object size, calculated resid is negative.
Delegate handling this case to the locked read, as any other non-trivial
situation.

PR: 253158
Reported by: Harald Schmalzbauer <bugzilla.freebsd@omnilan.de>
Tested by: cy
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agozfs: merge OpenZFS master-436ab35a5
Martin Matuska [Tue, 16 Feb 2021 00:39:34 +0000 (01:39 +0100)]
zfs: merge OpenZFS master-436ab35a5

- speed up writing to ZFS pools without ZIL devices (aa755b3)
- speed up importing ZFS pools (2d8f72da0e0199cf0977a)
...

MFC after: 2 weeks
Reviewed by: mjg (partial)
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D28677

3 years agoUpdate OpenZFS to master-436ab35a5
Martin Matuska [Mon, 15 Feb 2021 23:33:50 +0000 (00:33 +0100)]
Update OpenZFS to master-436ab35a5

3 years agoFix two failing tests after ATF update
Alex Richardson [Mon, 15 Feb 2021 22:11:30 +0000 (22:11 +0000)]
Fix two failing tests after ATF update

Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da
ATF opens the results file on startup. This fixes problems like
capsicumized tests not being able to open the file on exit.

However, this test closes all file descriptors just to check that
socketpair returns fd 3+4 and thereby also closes the ATF results file.
This then results in an EBADF when writing the result so the test is
reported as broken.

While system calls that create new file descriptors (must?) use the lowest
available file descriptor number, it does not seem useful to test this
property here. Drop the check for FD==3/4 to unbreak the testsuite.

We could also try to re-open the results file in ATF if we get a EBADF
error, but that will fail when running under Capsicum.

Reviewed By: cem
Differential Revision: https://reviews.freebsd.org/D28683