Commit Graph

267904 Commits

Author SHA1 Message Date
Adam Fenn
346f5a0c48 x86: files: Make sys/x86/x86/pvclock.c optional
Make inclusion of `sys/x86/x86/pvclock.c` contingent on that of its
dependents.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31417
2021-08-14 15:57:54 +03:00
Adam Fenn
652ae7b114 x86: cpufunc: Add rdtsc_ordered()
Add a variant of 'rdtsc()' that performs the ordered version of 'rdtsc'
appropriate for the invoking x86 variant.

Also, expose the 'lfence'-ed and 'mfence'-ed 'rdtsc()' variants needed
by 'rdtsc_ordered()' for general use.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31416
2021-08-14 15:57:53 +03:00
Adam Fenn
908e277230 x86: cpufunc: Add rdtscp_aux()
Add a variant of 'rdtscp()' that retains and returns the 'IA32_TSC_AUX'
value read by 'rdtscp'.

Sponsored By:	Juniper Networks, Inc.
Sponsored By:	Klara, Inc.
Reviewed by:	markj, kib
Differential Revision:	https://reviews.freebsd.org/D31415
2021-08-14 15:57:53 +03:00
Gordon Bergling
0d71cea832 md5(1): Fix a typo in the manual page
- s/compatibilty/compatibility/

MFC after:	5 days
2021-08-14 14:48:39 +02:00
Gordon Bergling
646f3a36c8 Fix a typo that was introduced while fixing a typo
- s/enrtry/entry/

MFC after:	5 days
2021-08-14 14:30:59 +02:00
Gordon Bergling
a1581cd735 Fix a common typo in source code comments
- s/aligment/alignment/

MFC after:	5 days
2021-08-14 14:17:48 +02:00
Gordon Bergling
1da11b8ac3 Fix a common typo in source code comments
- s/definitons/definitions/

MFC after:	5 days
2021-08-14 14:08:46 +02:00
Konstantin Belousov
b42df9dafb Add test for fstatat(pipefd, AT_EMPTY_PATH)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-08-14 14:41:01 +03:00
Gordon Bergling
86b74b7368 Fix a common typo in a comment
- s/enrty/entry/

MFC after: 5 days
2021-08-14 13:31:51 +02:00
Gordon Bergling
288e553623 Fix a few typos in source code comments
- s/procesing/processing/

MFC after:	5 days
2021-08-14 10:08:49 +02:00
Gordon Bergling
34f620f1d0 Fix a few typos in source code comments
- s/posbile/possible/

MFC after:	5 days
2021-08-14 09:39:17 +02:00
Gordon Bergling
fa7a635f7e Fix a few typos in source code comments
- s/becase/because/

MFC after:	5 days
2021-08-14 09:06:09 +02:00
Gordon Bergling
17db4b52fb Fix some common typos in source code comments
- s/struture/structure/
- s/structre/structure/

MFC after:	5 days
2021-08-14 08:55:58 +02:00
Alan Somers
825fb07c55 aio: revert the workaround for bug 251828 in the tests
This bug is no longer reproducible in 14.0-CURRENT and 13.0-RELEASE

Do not MFC to stable/12 !

PR:		251828
Reported by:	markj
Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D31535
2021-08-13 18:01:18 -06:00
Konstantin Belousov
9446d9e88f fstatat(2): handle non-vnode file descriptors for AT_EMPTY_PATH
Set NIRES_EMPTYPATH earlies, to have use of EMPTYPATH recorded even if
we are going to return error.  When namei_setup() refused to accept dirfd,
which is not of the vnode type, and indicated by ENOTDIR error return,
fall back to kern_fstat(dirfd).

Reported by:	dchagin
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31530
2021-08-14 00:17:18 +03:00
Ed Maste
6b25b4a73f mgb: update Microchip URLs
Sponsored by:	The FreeBSD Foundation
2021-08-13 16:58:25 -04:00
Ed Maste
866c807472 ar: remove duplicate function declaration in header
Sponsored by:	The FreeBSD Foundation
2021-08-13 16:58:18 -04:00
Ryan Moeller
41bee4039c
zfs: add missed dependency of zfs module on zlib
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Martin Matuska <mm@FreeBSD.org>
Co-authored-by: Konstantin Belousov <kib@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
External-issue: https://reviews.freebsd.org/D31207
Closes #12442
2021-08-13 13:42:45 -07:00
Ryan Moeller
6daf036ab5
Add zfs.sh -r flag to reload modules
zfs.sh already can load and unload, so why not both?

This is convenient when developing changes to the module and you want
to rapidly make some changes, rebuild the module, reload the module,
and test the changes.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12450
2021-08-13 13:37:46 -07:00
Ryan Moeller
a7491f9990
Fix usage of find in tests/Makefile.am
The path is not optional on FreeBSD.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12453
2021-08-13 13:13:57 -07:00
Ed Maste
57aaefdcec ar: diff reduction against ELF Tool Chain
Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive
directly.

(This was originally committed in d20e9e02db but reverted due to a
regression, now fixed with an update from cy@.)

Obtained from:	ELF Tool Chain
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31496
2021-08-13 11:17:46 -04:00
Konstantin Belousov
8df4bc48c8 ufs rename: ensure that the result of ufs_checkpath() is stable
ufs_rename() calls ufs_checkpath() to ensure that the target directory
is not a child of the source.  If not, rename would create a loop.
For instance:
	source->X1->X2->target
and if source moved under target, we get corrupted filesystem.
Suppose that we initially have
	source->X1 .... and X2->target
where X1 is not on path from root to X2.  Then ufs_checkpath() accepts
the inodes, but there is nothing preventing parallel rename of X2 to become
under X1, after checkpath finished.

Ensure stability of ufs_checkpath() result by taking a per-mount sx in
ufs_rename right before ufs_checkpath() and till the end.

Reviewed by:	chs, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2021-08-13 17:52:26 +03:00
Konstantin Belousov
2e2212b4f5 Style: wrap the long line, definition of ufs_checkpath()
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-08-13 17:52:20 +03:00
Ed Maste
086f090877 ar: diff reduction against ELF Tool Chain
Drop exit status from bsdar_errc.  ELF Tool Chain always returns
EXIT_FAILURE in bsdar_errc.

Recommit of one part of d20e9e02db / review D31496.

Obtained from:	ELF Tool Chain
Sponsored by:	The FreeBSD Foundation
2021-08-13 10:39:44 -04:00
Mark Johnston
3d69515cfe arc4random: Avoid KMSAN false positives from pre-seeding results
If code calls arc4random(), and our RNG is not yet seeded and
random_bypass_before_seeding is true, we'll compute a key using the
SHA256 hash of some hopefully hard-to-predict data, including the
contents of an uninitialized stack buffer (which is also the output
buffer).

When KMSAN is enabled, this use of uninitialized state propagtes through
to the arc4random() output, resulting in false positives.  To address
this, lie to KMSAN and explicitly mark the buffer as initialized.

Reviewed by:	cem (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31510
2021-08-13 09:58:42 -04:00
Mark Johnston
e0e3ded78a ng_bridge: Use M_NOWAIT when allocating memory in the newhook routine
newhook can be invoked by ngthread, which runs in a network epoch
section and is thus not permitted to perform M_WAITOK allocations.

Reported by:	Jenkins
Reviewed by:	donner, afedorov
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31486
2021-08-13 09:49:43 -04:00
Wojciech Macek
4920e38fec ipsec: fix race condition in key.c
Small patch that fixes a race condition in sys/netipsec/key.c

Obtained from:		Stormshield
Differential revision:	https://reviews.freebsd.org/D31271
2021-08-13 12:52:38 +02:00
Konstantin Belousov
c9f833abf1 rtld: Round down relro_size
lld rounds up p_memsz(PT_GNU_RELRO) to satisfy common-page-size. If the
page size is smaller than common-page-size, rounding up relro_size may
incorrectly make some RW pages read-only.

GNU ld, gold, and ld.lld ensures p_vaddr+p_memsz is a multiple of
common-page-size. While max-page-size >= system the page size,
common-page-size can be smaller than the system page size.

Submitted by:	MaskRay
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31498
2021-08-13 12:58:53 +03:00
Stefan Eßer
44d4804d19 usr.bin/ghä-bc, contrib/bc: update to version 5.0.0
Merge commit 2f57ecae4b

This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.

MFC after:	1 week
2021-08-13 11:28:06 +02:00
Wojciech Macek
f61cb12aac mroute: fix locking issues
In some cases the code may fall into deadlock.
Avoid calling epoch_wait when W-lock is taken.

Sponsored by:	Stormshield
Obtained from:	Semihalf
2021-08-13 11:06:17 +02:00
Dmitry Chagin
d4da692862 linux(4): Improve comment.
Reported by:	pfg
MFC after:	2 weeks
2021-08-13 11:36:42 +03:00
Kornel Duleba
a16771de4c ipsec: Return error code if no matching SA was found
If we matched SP to a packet, but no associated SA was found
ipsec4_allocsa will return NULL while setting error=0.
This resulted in use after free and potential kernel panic.
Return EINPROGRESS if the case described above instead.

Obtained from:		Semihalf
Sponsored by:		Stormshield
Differential revision:	https://reviews.freebsd.org/D30994
2021-08-13 09:35:08 +02:00
Kornel Duleba
6b66194bcb ipsec: Check PMTU before sending a frame.
If an encapsulated frame is going to have DF bit set check its desitnitions'
PMTU and if it won't fit drop it and:

Generate ICMP 3/4 message if the packet was to be forwarded.
Return EMSGSIZE error otherwise.

Obtained from:		Semihalf
Sponsored by:		Stormshield
Differential revision:	https://reviews.freebsd.org/D30993
2021-08-13 09:22:24 +02:00
Rick Macklem
06afb53bcd nfsd: Fix sanity check for NFSv4.2 Allocate operations
The NFSv4.2 Allocate operation sanity checks the aa_offset
and aa_length arguments.  Since they are assigned to variables
of type off_t (signed) it was possible for them to be negative.
It was also possible for aa_offset+aa_length to exceed OFF_MAX
when stored in lo_end, which is uint64_t.

This patch adds checks for these cases to the sanity check.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31511
2021-08-12 16:48:28 -07:00
Jessica Clarke
5ff5d1177b clang: Fix inverted condition in llvm.build.mk
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
2021-08-12 23:53:30 +01:00
Jessica Clarke
8a1895a3fa tools/build/cross-build: Fix building libllvmminimal on Linux
There is a __used member in glibc's posix_spawn_file_actions_t in
spawn.h, so we must temporarily undefine __used when including it,
otherwise Support/Unix/Program.inc fails to build. This is based on
similar handling for __unused in other headers.

Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
2021-08-12 23:50:48 +01:00
Jessica Clarke
cef65082ae bsd.compiler.mk: Fix cross-building from non-FreeBSD
On non-FreeBSD, the various MACHINE variables for the host when
bootstrapping can be missing or not match FreeBSD's naming, causing
bsd.endian.mk to be unable to infer the endianness. Work around this by
assuming it's unsupported.

Note that we can't check BOOTSTRAPPING here as Makefile.inc1 includes
bsd.compiler.mk before that is set, and so we are unable to catch errors
during buildworld itself when cross-building and bsd.endian.mk failed,
but such errors should also show up when building on FreeBSD.

Fixes:	47363e99d3 ("Enable compressed debug on little-endian targets")
2021-08-12 23:45:09 +01:00
Ed Maste
c5bf58add0 Revert "ar: diff reduction against ELF Tool Chain"
This reverts commit d20e9e02db.
It caused port build failures.

Reported by:	cy
2021-08-12 14:26:37 -04:00
John Baldwin
2eb0e53a6b cxgbei: Wait for the final CPL to be received in icl_cxgbei_conn_close.
A socket in the FIN_WAIT_1 state is marked disconnected by
do_close_con_rpl() even though there might still receive data pending.
This is because the socket at that point has set SBS_CANTRCVMORE which
causes the protocol layer to discard any data received before the FIN.
However, icl_cxgbei_conn_close needs to wait until all the data has
been discarded.  Replace the wait for SS_ISDISCONNECTED with instead
waiting for final_cpl_received() to be called.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
2021-08-12 08:48:35 -07:00
Ka Ho Ng
95941b9636 param.h: Bump __FreeBSD_version to 1400030
Commit a638dc4ebc expands VOP_DEALLOCATE(9)'s parameters list. File
system modules and modules calling VOP_DEALLOCATE(9) need to be rebuilt.

Commit 454bc887f2 introduces fspacectl(2) SPACECTL_DEALLOC support for
POSIX shared memory.

Sponsored by:	The FreeBSD Foundation
2021-08-12 23:05:26 +08:00
Ka Ho Ng
454bc887f2 uipc_shm: Implements fspacectl(2) support
This implements fspacectl(2) support on shared memory objects. The
semantic of SPACECTL_DEALLOC is equivalent to clearing the backing
store and free the pages within the affected range. If the call
succeeds, subsequent reads on the affected range return all zero.

tests/sys/posixshm/posixshm_tests.c is expanded to include a
fspacectl(2) functional test.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kevans, kib
Differential Revision:	https://reviews.freebsd.org/D31490
2021-08-12 23:04:18 +08:00
Ka Ho Ng
a638dc4ebc vfs: Add ioflag to VOP_DEALLOCATE(9)
The addition of ioflag allows callers passing
IO_SYNC/IO_DATASYNC/IO_DIRECT down to the file system implementation.
The vop_stddeallocate fallback implementation is updated to pass the
ioflag to the file system implementation. vn_deallocate(9) internally is
also changed to pass ioflag to the VOP_DEALLOCATE call.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D31500
2021-08-12 23:03:49 +08:00
Cy Schubert
ce92f5a91b wpa: Add wpa_cli action file event
Yan Zhong at FreeBSD Foundation is working on a wireless network
configuratior for an experimental FreeBSD installer. The new installer
requires an event to detect when connecting to a network fails due to a
bad password. When this happens a WPA-EVENT-TEMP-DISABLED event is
triggered. This patch passes the event to an action file provided by
the new experimental installer.

Submitted by:	Yang Zhong <yzhong () freebsdfoundation.org>
Reviewed by:	assumed to be reviewed by emaste (and cy)
MFC after:	1 week
2021-08-12 07:13:25 -07:00
Gordon Bergling
4b4850aefe hms(4): Fix a typo in sysctl description
- s/threshhold/threshold/

MFC after:	3 days
2021-08-12 15:37:47 +02:00
Dmitry Chagin
aecd31a8a3 linux(4): Remove clone3 and faccessat2 from dummy.
MFC after:		2 weeks
2021-08-12 16:07:21 +03:00
NagaChaitanya Vellanki
2a9b4076dc
Merge common parts of i386 and amd64's ieeefp.h into x86/x86_ieeefp.h
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D26292
2021-08-12 18:45:22 +08:00
Ka Ho Ng
c15384f896 vfs: Add get_write_ioflag helper to calculate ioflag
Converted vn_write to use this helper.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31513
2021-08-12 17:35:34 +08:00
Toomas Soome
5d5a621664 loader: cstyle cleanup of userboot/devicename.c
No functional changes intended.

MFC after:	1 week
2021-08-11 10:13:46 +03:00
Dmitry Chagin
bed2ac27a1 linux(4): Remove the unnecessary spaces.
MFC after:		2 weeks
2021-08-12 11:58:33 +03:00
Dmitry Chagin
71854d9b2b fork: Remove the unnecessary spaces.
MFC after:		2 weeks
2021-08-12 11:58:17 +03:00