Commit Graph

256812 Commits

Author SHA1 Message Date
Dimitry Andric
0ee0dbfb0d 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
2021-02-18 22:30:27 +01:00
Mitchell Horne
04d2d2d7fd 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
2021-02-18 17:17:41 -04:00
Dimitry Andric
3f8a54b208 Import libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456
Interesting fixes:
b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877
7b2335c Mostly fix __cxa_demangle after #3
2021-02-18 22:07:28 +01:00
Fernando Apesteguía
cee8be2c78 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
2021-02-18 19:10:33 +01:00
Fernando Apesteguía
acab1d58be 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
2021-02-18 18:56:52 +01:00
John Baldwin
a10020cfe2 cryptosoft: Support per-op keys for AES-GCM and AES-CCM.
Reviewed by:	cem
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28752
2021-02-18 09:53:25 -08:00
John Baldwin
4dd6800e22 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
2021-02-18 09:30:13 -08:00
John Baldwin
9c64fc4029 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
2021-02-18 09:26:32 -08:00
John Baldwin
1bd9fc96d4 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
2021-02-18 09:26:32 -08:00
John Baldwin
dd2e1352b6 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
2021-02-18 09:26:23 -08:00
John Baldwin
fc8fc743d8 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
2021-02-18 09:26:00 -08:00
Mark Johnston
cd6114d1a6 git-arc: Preserve the commit author when staging commits
Reported by:	jhb
2021-02-18 11:00:09 -05:00
Mark Johnston
57ba8673d7 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
2021-02-18 11:00:09 -05:00
Thomas Skibo
9976b42b69 ddb: fix show devmap output on 32-bit arm
The output has been broken since 1b6dd6d772. 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
2021-02-18 11:53:14 -04:00
Mark Johnston
17d0f830dd 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
2021-02-18 10:51:38 -05:00
Allan Jude
8c280db0b4 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
2021-02-18 15:48:01 +00:00
Allan Jude
37ef8d4cd6 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
2021-02-18 15:47:17 +00:00
Fernando Apesteguía
0577e39bec 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
2021-02-18 15:59:34 +01:00
Konstantin Belousov
662283b108 vn_printf: handle VI_FOPENING
Noted by:	mjg
Sponsored by:	The FreeBSD Foundation
MFC after:	6 days
Fixes:	fa3bd463ce
2021-02-18 16:28:28 +02:00
Martin Matuska
10f57cb98f 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
2021-02-18 15:21:10 +01:00
Martin Matuska
ee36e25a86 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
2021-02-18 15:19:35 +01:00
Alex Richardson
fa2528ac64 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
2021-02-18 14:02:48 +00:00
Alex Richardson
df093aa946 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
2021-02-18 14:02:48 +00:00
Alex Richardson
cbcfe28f9d 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
2021-02-18 14:02:48 +00:00
Alex Richardson
2aa3ef285a libc: Fix t_spawn_fileactions test after ATF update
Since 4581cefc1e
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
2021-02-18 14:02:47 +00:00
Michal Krawczyk
1c808fcd85 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
2021-02-18 13:54:36 +01:00
Randall Stewart
e13e4fa6c4 fix Navdeeps LINT_NOINET error. 2021-02-18 07:29:12 -05:00
Navdeep Parhar
fae028dd97 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
2021-02-18 01:22:42 -08:00
Martin Matuska
62ceb3c592 Update OpenZFS to master-bf156c966
Notable upstream changes:
  bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt
  658fb8020 Add "compatibility" property for zpool feature sets
2021-02-18 10:14:16 +01:00
Kristof Provost
2ed689a674 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
2021-02-18 08:38:28 +01:00
Randall Stewart
0a4f851074 Fix another pesky missing #ifdef TCPHPTS 2021-02-18 01:27:30 -05:00
Glen Barber
f61e92ca5a release: permanently remove the 'reldoc' target and associates
Following 7b1d1a1658, 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")
2021-02-17 23:00:03 -05:00
Robert Wing
4f4065e0a2 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
2021-02-17 17:46:42 -09:00
John Baldwin
24fd63e097 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 82dd5016bd.  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
2021-02-17 16:34:23 -08:00
John Baldwin
dd176fd7e7 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 82dd5016bd.  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
2021-02-17 16:33:09 -08:00
John Baldwin
67932460c7 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
2021-02-17 16:32:11 -08:00
Konstantin Belousov
fa3bd463ce 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
2021-02-18 01:22:05 +02:00
Jung-uk Kim
351d06eeb5 OpenSSL: Regen manual page for the previous commit
This is regen for 9b2f020c14.

MFC after:	1 week
2021-02-17 18:19:13 -05:00
Oleksandr Tymoshenko
9b2f020c14 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
2021-02-17 14:51:55 -08:00
Dan McGregor
d616ae46b4 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
2021-02-17 22:26:49 +00:00
Warner Losh
955b6109bb 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
2021-02-17 15:08:19 -07:00
Stefan Eßer
9a995fe186 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.
2021-02-17 23:02:01 +01:00
D Scott Phillips
3046eb03cc 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
2021-02-17 13:54:51 -08:00
Warner Losh
00065c7630 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)
2021-02-17 14:33:09 -07:00
John Baldwin
1deaad9364 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
2021-02-17 13:28:04 -08:00
John Baldwin
50a61f8db5 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
2021-02-17 13:12:06 -08:00
D Scott Phillips
c720435062 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
2021-02-17 14:08:38 -05:00
Randall Stewart
ab4fad4be1 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.
2021-02-17 12:49:42 -05:00
Alex Richardson
962a3814d4 Fix bootstrap tools build on macOS after 02af91c52e
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)
2021-02-17 16:35:14 +00:00
Mitchell Horne
39df2b5682 arm64: use macros to access special register values 2021-02-17 12:09:45 -04:00