Commit Graph

268240 Commits

Author SHA1 Message Date
Mitchell Horne
0e78510b75 hwpmc: don't validate capabilities in allocation method
These checks were inconsistently applied across the various hwpmc
classes. The condition is already checked by the generic code in
hwpmc_mod.c, so remove them.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31388
2021-08-30 16:12:59 -03:00
Mitchell Horne
315cd55dba hwpmc: consistently validate PMC class in allocation method
It is always a good idea. In one case, attempting to allocate N+1 PMCs
from a class with N hardware counters would incorrectly attempt to
allocate from the next class in the list. Without this validation, this
can lead to all kinds of strange behaviour.

Since powerpc_allocate_pmc() is used by both the mpc7xxx and ppc970
classes, add a new global to track which is active (it will never be
both).

Reviewed by:	luporl, ray
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31387
2021-08-30 16:12:59 -03:00
Mark Johnston
564b6aa7fc aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm()
Given a partial block at the end of a payload, aes_encrypt_icm() would
perform a 16-byte load of the residual into a temporary variable.  This
is unsafe in principle since the full block may cross a page boundary.
Fix the problem by copying the residual into a stack buffer first.

Reported by:	syzbot+b7e44cde9e2e89f0f6c9@syzkaller.appspotmail.com
Reported by:	syzbot+4b5eaf123a99456b5160@syzkaller.appspotmail.com
Reported by:	syzbot+70c74c1aa232633355ca@syzkaller.appspotmail.com
Reported by:	syzbot+2c663776a52828373d41@syzkaller.appspotmail.com
Reviewed by:	cem, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31730
2021-08-30 14:22:20 -04:00
Ed Maste
0637070b5b ngatm: remove one of doubled semicolons
Discussed with:	harti
2021-08-30 11:39:30 -04:00
Mitchell Horne
4d0dc60f14 xinstall: fix invocation of llvm-strip
When executing strip(1), '--' is passed as an argument to explicitly
terminate the getopt(3) loop. The option parsing in llvm-strip doesn't
support this however, so setting XSTRIPBIN=llvm-strip results in an
unsupported argument error. llvm-strip(1) is otherwise
commandline-compatible with FreeBSD's strip(1), so just use the
documented argument format that is common to both.

Special care needs to be taken for filenames beginning with a '-'.

Reviewed by:	arichardson, eugen (earlier version, both)
Discussed with:	jilles
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D30614
2021-08-30 11:56:10 -03:00
Cy Schubert
213ceba977 wpa: Enclose FreeBSD specific defines
FreeBSD only defines are specific only to FreeBSD. Document them as such.
It is our intention to push this change to w1.fi.

MFC after:	1 week
2021-08-30 06:59:18 -07:00
Cy Schubert
81b521d2c0 wpa: Include all wpa include file search directories
Though not all include file search directories are presently needed,
add them to the search list. This is required for the next update to
wpa.

No functional change intended.

MFC after:	1 week
2021-08-30 06:59:17 -07:00
Cy Schubert
a0f2aa9318 wpa: Correctly build the hostapd BSD driver
driver.bsd.c initializes itself differently when built for
hostapd than it does when built for wpa_supplicant.

MFC after:	1 week
2021-08-30 06:59:17 -07:00
Andrew Turner
b792434150 Create sys/reg.h for the common code previously in machine/reg.h
Move the common kernel function signatures from machine/reg.h to a new
sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2).

Reviewed by:	imp, markj
Sponsored by:	DARPA, AFRL (original work)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19830
2021-08-30 12:50:53 +01:00
Andrew Turner
a947203221 Revert "Disable the accelerated arm64 sha25 in static libraries"
This is now unneeded as arm64 can now resolve ifuncs in static binaries

This reverts commit c81ea895b5.

Sponsored by:	The FreeBSD Foundation
2021-08-30 10:36:43 +01:00
Elliott Mitchell
e76c0e4f45 bhyve: Nuke double-semicolons
A distinct number of double-semicolons ended up in bhyve. Take a pass at
getting rid of many of these harmless typos.

MFC after:	3 days
2021-08-30 15:31:04 +08:00
Rick Macklem
13914e51eb nfsd: Make loop calling VOP_ALLOCATE() iterate until done
The NFSv4.2 Deallocate operation loops on VOP_DEALLOCATE()
while progress is being made (remaining length decreasing).
This patch changes the loop on VOP_ALLOCATE() for the NFSv4.2
Allocate operation do the same, instead of stopping after
an arbitrary 20 iterations.

MFC after:	2 weeks
2021-08-29 16:46:27 -07:00
Alexander V. Chernikov
d98954e229 routing: Bring back the ability to specify transmit interface via its name.
Some software references outgoing interfaces by specifying name instead of
 index.

Use rti_ifp from rt_addrinfo if provided instead of always using
 address interface when constructing nexthop.

PR: 		255678
Reported by:	martin.larsson2 at gmail.com
MFC after:	1 week
2021-08-29 20:05:14 +00:00
Piotr Pawel Stefaniak
0939f965d8 Update a sysctl name to nbuffers_pcpu in hwpmc.4 and pmcstat.c
This change was missed in r333509 (e6b475e0af).

Differential Revision:	https://reviews.freebsd.org/D31704
Reviewed by:	mjg
2021-08-29 21:24:50 +02:00
Dimitry Andric
8e3c56d6b6 xen: Fix warning by adding KERNBASE to modlist_paddr before casting
Clang 13 produces the following warning for hammer_time_xen():

sys/x86/xen/pv.c:183:19: error: the pointer incremented by -2147483648 refers past the last possible element for an array in 64-bit address space containing 256-bit (32-byte) elements (max possible 576460752303423488 elements) [-Werror,-Warray-bounds]
                    (vm_paddr_t)start_info->modlist_paddr + KERNBASE;
                                ^                               ~~~~~~~~
sys/xen/interface/arch-x86/hvm/start_info.h:131:5: note: array 'modlist_paddr' declared here
    uint64_t modlist_paddr;         /* Physical address of an array of           */
    ^

This is because the expression first casts start_info->modlist_paddr to
struct hvm_modlist_entry * (via vmpaddr_t), and *then* adds KERNBASE,
which is then interpreted as KERNBASE * sizeof(struct
hvm_modlist_entry).

Instead, parenthesize the addition to get the intended result, and cast
it to struct hvm_modlist_entry * afterwards. Also remove the cast to
vmpaddr_t since it is not necessary.

Reviewed by:	royger
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31711
2021-08-29 19:43:00 +02:00
Brian Behlendorf
70bf547a98
ZTS: Waiting for zvols to be available
The ZTS block_device_wait helper function should use -e when waiting
for a file to appear since it will be either a block special device
or a symlink.  This didn't cause any failures but when a device path
was specified the function would wait longer than needed.

Additionally update the most flakey test cases to pass the file path
to block_device_wait to try and improve the test reliability.  The
udev behavior on Fedora in particular can result in frequent false
positives.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12515
2021-08-29 09:56:58 -06:00
Dimitry Andric
5b8f07b12f Fix -Wformat errors in pfctl on 32-bit architectures
Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result
in "error: format specifies type 'unsigned long' but the argument has
type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit
architectures.

Fixes:		80078d9d38
MFC after:	1 week
2021-08-29 17:31:28 +02:00
Dimitry Andric
395d46caae Don't error out on unused but set variables with clang 13
Clang 13.0.0 now has a -Wunused-but-set-variable warning similar to the
one gcc has had for quite a while. Since this triggers *very* often for
our kernel builds, don't make it a hard error, but leave the warning
visible so is some incentive to fix the instances.

MFC after:	3 days
2021-08-29 15:53:40 +02:00
Dimitry Andric
22b8ab15c4 Remove -simplifycfg-dup-ret from CLANG_OPT_SMALL flags for clang 13
After llvm/clang 13.0.0, the -simplifycfg-dup-ret backend flag is no
longer supported. This was part of CLANG_OPT_SMALL, which is only still
used for stand/i386/boot2 and stand/i386/isoboot, to achieve the very
small binary size required. Luckily clang 13.0.0 does not need any
additional flags for this (I get 240 bytes available when building
boot2).

MFC after:	3 days
2021-08-29 15:39:16 +02:00
Kristof Provost
80078d9d38 pfctl: use libpfctl to retrieve pf status
Rather than call DIOCGETSTATUS ourselves use the new libpfctl functions.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31697
2021-08-29 14:59:38 +02:00
Kristof Provost
46fb68b1de libpfctl: Implement DIOCGETSTATUS wrappers
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31696
2021-08-29 14:59:38 +02:00
Kristof Provost
b0ccc2e277 libpfctl: fix double free
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31695
2021-08-29 14:59:29 +02:00
Kristof Provost
2b10cf85f8 pf: Introduce nvlist variant of DIOCGETSTATUS
Make it possible to extend the GETSTATUS call (e.g. when we want to add
new counters, such as for syncookie support) by introducing an
nvlist-based alternative.

MFC after:	1 week
Sponsored by:   Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31694
2021-08-29 14:59:04 +02:00
Gordon Bergling
5d785ad65e Fix a common typo in source code comments
- s/concurently/concurrently/

MFC after:	3 days
2021-08-29 11:45:09 +02:00
Ka Ho Ng
a58e222b3b vfs: yield in vn_deallocate_impl() loop
Yield at the end of each loop iteration if there are remaining works as
indicated by the value of *len updated by VOP_DEALLOCATE. Without this,
when calling vop_stddeallocate to zero a large region, the
implementation only zerofills a relatively small chunk and returns.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31705
2021-08-29 16:26:00 +08:00
Gordon Bergling
005fe24f2a libsa: Fix a typo in source code comments
- s/mininum/minimum/

MFC after:	3 days
2021-08-29 10:09:58 +02:00
Gordon Bergling
2dfcc3a91d isci(4): Fix a common typo in src comments
- s/exlusive/exclusive/

MFC after:	3 days
2021-08-29 09:55:10 +02:00
Peter Holm
22f5f4a14e stress2: Added new msdosfs rename() tests 2021-08-29 08:37:54 +02:00
Konstantin Belousov
17fc43bc01 ldd: Remove non-functional -v option
It seems -v only worked for a.out.  Remove it, not even keeping the current
nop for compat.  Also remove more mentions of a.out format from the man
page.

Reviewed by:	dim, emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31708
2021-08-28 23:39:16 +03:00
Konstantin Belousov
31607861e2 Style
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-08-28 23:39:16 +03:00
Mark Johnston
7326e8589c fsetown: Avoid process group lock recursion
Restore the pre-1d874ba4f8ba behaviour of disassociating the current
SIGIO recipient before looking up the specified process or process
group.  This avoids a lock recursion in the scenario where a process
group is configured to receive SIGIO for an fd when it has already been
so configured.

Reported by:	pho
Tested by:	pho
Reviewed by:	kib
MFC after:	3 days
2021-08-28 15:50:44 -04:00
Dimitry Andric
9fae476669 Explicitly link zfsd with libspl to avoid undefined references
Because lld 13.0.0 is more strict about undefined references when
linking to shared libraries, it produces the following errors for zfsd:

ld: error: /home/dim/obj/home/dim/src/llvm-13-update/amd64.amd64/tmp/usr/lib/libzfs_core.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined]
ld: error: /home/dim/obj/home/dim/src/llvm-13-update/amd64.amd64/tmp/usr/lib/libnvpair.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined]
ld: error: /home/dim/obj/home/dim/src/llvm-13-update/amd64.amd64/tmp/usr/lib/libavl.so: undefined reference to libspl_assertf [--no-allow-shlib-undefined]
*** [zfsd.full] Error code 1

Fix this by adding libspl (where libspl_assertf lives) to zfsd's LIBADD.

MFC after:	3 days
2021-08-28 20:23:28 +02:00
Gordon Bergling
b1603638e3 Fix a common typo in man pages and src comments
- s/desciptor/descriptor/

MFC after:	5 days
2021-08-28 19:24:27 +02:00
Gordon Bergling
5bdf58e196 Fix some common typos in source code comments
- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

MFC after:	3 days
2021-08-28 18:57:23 +02:00
Gordon Bergling
10e0082fff inet6(4): Fix a few common typos in source code comments
- s/reshedule/reschedule/

MFC after:	3 days
2021-08-28 18:53:59 +02:00
Gordon Bergling
586c9dc374 inet(3): Fix a few common typos in source code comments
- s/funtion/function/

MFC after:	3 days
2021-08-28 18:53:02 +02:00
Gordon Bergling
16b71d98d9 ocs_fs(4): Fix some common typos in source code comments
- s/transfered/transferred/
- s/associted/associated/

MFC after:	3 days
2021-08-28 18:24:08 +02:00
Baptiste Daroussin
3ae61b972b sh: improve emacs mode
in emacs mode ^W should delete the previous word by default
Note that upstreaming this change directly into libedit is in process.

Reported by:	manu
Reviewed by:	jills, pstef, manu
Differential Revision:	https://reviews.freebsd.org/D29493
2021-08-28 16:11:57 +02:00
Dimitry Andric
4544929cb5 Silence unused parameter warnings in fspacectl(2) bootstrap stub
While here, replace spaces with tabs and add a newline at EOF.

Fixes:		5425ba8332
MFC after:	3 days
2021-08-28 15:37:43 +02:00
Rick Macklem
08b9cc316a nfscl: Add a VOP_DEALLOCATE() for the NFSv4.2 client
This patch adds a VOP_DEALLOCATE() to the NFS client.
For NFSv4.2 servers that support the Deallocate operation,
it is used. Otherwise, it falls back on calling
vop_stddeallocate().

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31640
2021-08-27 18:31:36 -07:00
Rick Macklem
da779f262c vfs_default: Change vop_stddeallocate() from static to global
A future commit to the NFS client uses vop_stddeallocate() for
cases where the NFS server does not support a Deallocate operation.
Change vop_stddeallocate() from static to global so that it can
be called by the NFS client.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31640
2021-08-27 18:25:44 -07:00
Dimitry Andric
5a3a8cb01a Silence more gtest warnings, now in fusefs tests
Follow-up d396c67f26 by also silencing warnings about deprecated
implicit copy constructors in the fusefs tests, which use googletest.

Fixes:		d396c67f26
MFC after:	3 days
2021-08-27 23:39:36 +02:00
Alan Somers
f5c6c43d4c Add a regression test for ggatec remote code execution
Tests that ggatec appropriately handles unsupported BIO operations,
rather than overflowing a buffer.

Submitted by:	Johannes Bruelltuete <johannes@jo-t.de>
PR:		213479
Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D31318
2021-08-27 14:52:45 -06:00
Dimitry Andric
4e5d32a445 Fix null pointer subtraction in mergesort()
Clang 13 produces the following warning for this function:

lib/libc/stdlib/merge.c:137:41: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
                                               ^ ~~~~~~~~~

This is meant to check whether the size and base parameters are aligned
to the size of an int, so use our __is_aligned() macro instead.

Also remove the comment that indicated this "stupid subtraction" was
done to pacify some ancient and unknown Cray compiler, and which has
been there since the BSD 4.4 Lite Lib Sources were imported.

MFC after:	3 days
2021-08-27 19:46:18 +02:00
Stephen J. Kiernan
fd80208a5f Add SDT probes virtqueue::enqueue_segments:{entry,return}
This allows one to be able to map the sglist entries passed into the
vq_ring_enqueue_segments() function to the segment indexes used in
the virtqueue.

This function normally gets inlined and may not available via FBT
probes.

Differential Revision: https://reviews.freebsd.org/D31620
2021-08-27 13:08:59 -04:00
Ryan Moeller
5bee265908
Correct checking bdev_check_media_change message
We're not looking for bdev_disk_changed.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12492
2021-08-27 10:02:54 -07:00
Konstantin Belousov
b54eec8366 efi loader: disallow user to configure staging area size less than default
We need to round it up to 2M, for instance.  Having staging area too small
might cause the first resize to use negative size for memmove()/memcpy(),
which kills loader.

Tested by:	Harry Schmalzbauer <freebsd@omnilan.de>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-08-27 19:49:01 +03:00
Konstantin Belousov
b850806921 Restore the definition of EFI_STAGING_SIZE
The definition can be overridden by users, and before f75caed644 it
was in MBs.  Make the symbol' unit MB, to be compatible with users
customizations.

Reported and tested by:	Harry Schmalzbauer <freebsd@omnilan.de>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-08-27 19:48:53 +03:00
Tony Hutter
4dc115328f
Make 'zpool labelclear -f' work on offlined disks
This patch allows you to clear the label on offlined disks in an active
pool with `-f`.  Previously, labelclear wouldn't let you do that.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #12511
2021-08-27 10:26:49 -06:00
Konstantin Belousov
f19063ab02 vfs_hash_rehash(): require the vnode to be exclusively locked
Rehash updates v_hash.  Also, rehash moves the vnode to different hash
bucket, which should be noticed in vfs_hash_get() after sleeping for
the vnode lock.

Reviewed by:	mckusick, rmacklem
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31464
2021-08-27 18:39:45 +03:00