]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoix(4): Report RX errors as sum of all RX error counters
Piotr Pietruszewski [Wed, 3 Mar 2021 01:21:58 +0000 (17:21 -0800)]
ix(4): Report RX errors as sum of all RX error counters

HW keeps track of RX errors using several counters, each for
specific type of errors. Report RX errors to OS as sum
of all those counters: CRC errors, illegal bytes, checksum,
length, undersize, fragment, oversize and jabber errors.

Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is
to provide an another way to display the sum of RX errors.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed By: erj
Tested By: gowtham.kumar.ks@intel.com
Sponsored By: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D27191

3 years agozfs: merge OpenZFS master-bedbc13da
Martin Matuska [Wed, 3 Mar 2021 01:15:33 +0000 (02:15 +0100)]
zfs: merge OpenZFS master-bedbc13da

Notable upstream commits:
  8e43fa12c Fix vdev_rebuild_thread deadlock
  03ef8f09e Add missing checks for unsupported features
  2e160dee9 Fix assert in FreeBSD-specific dmu_read_pages
  bedbc13da Cancel TRIM / initialize on FAULTED non-writeable vdevs

MFC after: 1 week
Obtained from: OpenZFS

3 years agoUpdate vendor/openzfs to master-bedbc13da
Martin Matuska [Wed, 3 Mar 2021 00:40:13 +0000 (01:40 +0100)]
Update vendor/openzfs to master-bedbc13da

Notable upstream commits:
  8e43fa12c Fix vdev_rebuild_thread deadlock
  03ef8f09e Add missing checks for unsupported features
  2e160dee9 Fix assert in FreeBSD-specific dmu_read_pages
  bedbc13da Cancel TRIM / initialize on FAULTED non-writeable vdevs

3 years agoReplace STAILQ_SWAP() with simpler STAILQ_CONCAT().
Alexander Motin [Tue, 2 Mar 2021 23:39:44 +0000 (18:39 -0500)]
Replace STAILQ_SWAP() with simpler STAILQ_CONCAT().

Also remove stray STAILQ_REMOVE_AFTER(), not causing problems only
because STAILQ_SWAP() fixed corrupted stqh_last.

MFC after: 1 week

3 years agoiflib: add support for admin completion queues
Marcin Wojtas [Tue, 2 Mar 2021 23:24:29 +0000 (00:24 +0100)]
iflib: add support for admin completion queues

For interfaces with admin completion queues, introduce a new devmethod
IFDI_ADMIN_COMPLETION_HANDLE and a corresponding flag IFLIB_HAS_ADMINCQ.

This provides an option for handling any admin cq logic, which cannot be
run from an interrupt context.

Said method is called from within iflib's admin task, making it safe to
sleep.

Reviewed by: mmacy
Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D28708

3 years agolib/flua/libjail: Allow empty params table
Ryan Moeller [Thu, 25 Feb 2021 05:16:52 +0000 (05:16 +0000)]
lib/flua/libjail: Allow empty params table

The name or jid always gets added to the params, and that's enough to
avoid allocating a 0 length params array.

Reported by: kevans
Reviewed by: kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28778

3 years agomvebu_gpio: fix interrupt cause register configuration
Marcin Wojtas [Wed, 24 Feb 2021 17:02:40 +0000 (18:02 +0100)]
mvebu_gpio: fix interrupt cause register configuration

According to Armada 8k documentation, the interrupt cause register
(at offset 0x14) is RW0C. Update the configuration in attach and
the mvebu_gpio_isrc_eoi() to follow the description.

Reviewed by: mmel
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D29013

3 years agofilt_fsevent: only record interested events
Robert Wing [Tue, 2 Mar 2021 23:19:22 +0000 (14:19 -0900)]
filt_fsevent: only record interested events

Respect filter-specific flags for the EVFILT_FS filter.

When a kevent is registered with the EVFILT_FS filter, it is always
triggered when an EVFILT_FS event occurs, regardless of the
filter-specific flags used. Fix that.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D28974

3 years agoautounmountd: set filter-specific flags for the EVFILT_FS filter
Robert Wing [Tue, 2 Mar 2021 23:18:40 +0000 (14:18 -0900)]
autounmountd: set filter-specific flags for the EVFILT_FS filter

Set the filter-specific flags VQ_MOUNT and VQ_UNMOUNT for the
EVFILT_FS filter.

The filter-specific flags for the EVFILT_FS filter are undocumented, but
their usage can be found by looking up vfs_event_signal().

Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D28975

3 years ago[PowerPC64] add mpr to GENERIC64 and GENERIC64LE
Alfredo Dal'Ava Junior [Tue, 2 Mar 2021 14:05:37 +0000 (11:05 -0300)]
[PowerPC64] add mpr to GENERIC64 and GENERIC64LE

Submitted by: Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by: luporl, alfredo, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by email)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25785

3 years agompr: big-endian support
Alfredo Dal'Ava Junior [Tue, 2 Mar 2021 14:05:15 +0000 (11:05 -0300)]
mpr: big-endian support

This fixes mpr driver on big-endian devices.
Tested on powerpc64 and powerpc64le targets using a SAS9300-8i card
(LSISAS3008 pci vendor=0x1000 device=0x0097)

Submitted by: Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by: luporl, alfredo, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by email)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25785

3 years agonfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS
Rick Macklem [Tue, 2 Mar 2021 22:18:23 +0000 (14:18 -0800)]
nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS

During a recent virtual NFSv4 testing event, a bug in the FreeBSD client
was detected when doing I/O DS operations on a Flexible File Layout pNFS
server.  For an NFSv3 DS, the Read/Write/Commit nfsstats were incremented
instead of the ReadDS/WriteDS/CommitDS counts.
This patch fixes this.

Only the RPC counts reported by nfsstat(1) were affected by this bug,
the I/O operations were performed correctly.

MFC after: 2 weeks

3 years agoRegenerate src.conf(5) after FMTREE removal
Kyle Evans [Tue, 2 Mar 2021 21:21:46 +0000 (15:21 -0600)]
Regenerate src.conf(5) after FMTREE removal

3 years agoRemove fmtree(8)
Kyle Evans [Tue, 2 Mar 2021 21:15:17 +0000 (15:15 -0600)]
Remove fmtree(8)

fmtree(8) deprecation was announced on February 12, 2021, and no longer
built by default as of that date.  The deprecation notice was merged
back to stable/12 and stable/13 + releng/13.0.

Continue with the plan by finishing the removal.

Relnotes: yes

3 years agoRegenerate src.conf(5) after PIE default change
Kyle Evans [Tue, 2 Mar 2021 21:21:27 +0000 (15:21 -0600)]
Regenerate src.conf(5) after PIE default change

3 years agoFix initiator panic after 6895f89fe54e.
Alexander Motin [Tue, 2 Mar 2021 21:07:22 +0000 (16:07 -0500)]
Fix initiator panic after 6895f89fe54e.

There are sessions without socket that are not disconnecting yet.

MFC after: 3 weeks

3 years agosecurity(7): mention new W^X sysctls in the manual page
Evgeniy Khramtsov [Tue, 2 Mar 2021 18:52:22 +0000 (19:52 +0100)]
security(7): mention new W^X sysctls in the manual page

Reviewed by: emaste, gbe
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28986

3 years agotests/sys/audit: add missing comma delimiter between fields
Alex Richardson [Tue, 2 Mar 2021 18:34:42 +0000 (18:34 +0000)]
tests/sys/audit: add missing comma delimiter between fields

This makes the `kyua report --verbose` output a lot easier to parse when
looking at failed tests. It also fixes the closefrom() test since I
tested my changes with this commit but forgot to push it together with
fa32350347b4e351a144b5423f0fb2ca9d67f4ca.

Fixes: fa32350347b4 ("close_range: add audit support")

3 years agoSimplify the capsicum-test wrapper script
Alex Richardson [Tue, 2 Mar 2021 18:27:34 +0000 (18:27 +0000)]
Simplify the capsicum-test wrapper script

Instead of running tests one-by-one with the shell wrapper we now run
the full gtest testsuite twice (once as root, once as non root). This
significantly speeds up running tests despite running them twice.
This change also passes the missing -u flag to capsicum-test that caused
test failures (https://bugs.freebsd.org/250178)

Previously, running the testsuite with the wrapper script took ~3s per
test on aarch64 QEMU, i.e. a total of almost 5 minutes.
Now it takes 6 seconds to run all tests twice.

Before:
root@freebsd-aarch64:/usr/tests/sys/capsicum # /usr/bin/time kyua test functional
94/96 passed (2 failed)
      309.97 real        58.46 user       244.31 sys

After:
root@freebsd-aarch64:/usr/tests/sys/capsicum # /usr/bin/time kyua test functional
functional:test_root  ->  passed  [2.659s]
functional:test_unprivileged  ->  passed  [2.391s]
2/2 passed (0 failed)
        5.48 real         1.06 user         2.52 sys

This overhead is caused by kyua + atf-sh spawning lots of additional
processes and can be avoided by just running the googletest test binary.
syscall                     seconds   calls  errors
fork                   39.810229456    1275       0
sigprocmask            13.546928736     572       0

i.e. 1275 processes spawned to run a single test.

Test Plan: All tests pass with D28907.
PR: 250178
Reviewed By: lwhsu
Differential Revision: https://reviews.freebsd.org/D29014

3 years agoO_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path
Konstantin Belousov [Sun, 28 Feb 2021 23:59:12 +0000 (01:59 +0200)]
O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path

Requested and reviewed by: markj
Tested by: arichardson,  pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28907

3 years agonameicap_check_dotdot: trim tracker on check
Konstantin Belousov [Sun, 28 Feb 2021 00:15:21 +0000 (02:15 +0200)]
nameicap_check_dotdot: trim tracker on check

Tracker should contain exactly the path from the starting directory to
the current lookup point. Otherwise we might not detect some cases of
dotdot escape. Consequently, if we are walking up the tree by dotdot
lookup, we must remove an entries below the walked directory.

Reviewed by: markj
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28907

3 years agoAdd nameicap_cleanup_from(), to clean tracker list starting from some element
Konstantin Belousov [Sun, 28 Feb 2021 00:14:43 +0000 (02:14 +0200)]
Add nameicap_cleanup_from(), to clean tracker list starting from some element

Reviewed by: markj
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28907

3 years agonameicap_tracker_add: avoid duplicates in the tracker list
Konstantin Belousov [Sun, 28 Feb 2021 00:13:19 +0000 (02:13 +0200)]
nameicap_tracker_add: avoid duplicates in the tracker list

Reviewed by: markj
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28907

3 years agoDo not call nameicap_tracker_add() for dotdot case.
Konstantin Belousov [Sun, 28 Feb 2021 00:12:43 +0000 (02:12 +0200)]
Do not call nameicap_tracker_add() for dotdot case.

Reviewed by: markj
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28907

3 years agoopen(2): Remove O_BENEATH and AT_BENEATH
Konstantin Belousov [Tue, 16 Feb 2021 03:31:40 +0000 (05:31 +0200)]
open(2): Remove O_BENEATH and AT_BENEATH

with the reasoning that the flags did not worked properly, and were not
shipped in a release.

O_RESOLVE_BENEATH is kept as useful.

Reviewed by: markj
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28907

3 years agofhlink(2): the syscalls do not take flag
Konstantin Belousov [Sun, 28 Feb 2021 00:38:11 +0000 (02:38 +0200)]
fhlink(2): the syscalls do not take flag

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

3 years agoRemove /boot/efi from mtree, missed in 0b7472b3d8d2.
Nathan Whitehorn [Tue, 2 Mar 2021 16:47:00 +0000 (11:47 -0500)]
Remove /boot/efi from mtree, missed in 0b7472b3d8d2.

This had prevented the bootconfig step from determining if an ESP exists,
resulting in its unconditional setup. On BIOS-booted amd64, this wasn't
harmful, just unnecessary, but it resulted in failed installations on
non-EFI-supporting platforms like powerpc64.

MFC after: 3 days

3 years agoUpdate capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40
Alex Richardson [Tue, 2 Mar 2021 16:28:26 +0000 (16:28 +0000)]
Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40

This includes various fixes that I submitted recently such as updating the
pdkill() tests for the actual implemented behaviour
(https://github.com/google/capsicum-test/pull/53) and lots of changes to
avoid calling sleep() and replacing it with reliable synchronization
(pull requests 49,51,52,53,54). This should make the testsuite more reliable
when running on Jenkins. Additionally, process status is now retrieved using
libprocstat instead of running `ps` and parsing the output
(https://github.com/google/capsicum-test/pull/50). This fixes one previously
failing test and speeds up execution.

Overall, this update reduces the total runtime from ~60s to about 4-5 seconds.

3 years agoUpdate capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40
Alex Richardson [Tue, 2 Mar 2021 16:22:31 +0000 (16:22 +0000)]
Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40

3 years agovm: Round up npages and alignment for contig reclamation
Mark Johnston [Tue, 2 Mar 2021 15:19:53 +0000 (10:19 -0500)]
vm: Round up npages and alignment for contig reclamation

When searching for runs to reclaim, we need to ensure that the entire
run will be added to the buddy allocator as a single unit.  Otherwise,
it will not be visible to vm_phys_alloc_contig() as it is currently
implemented.  This is a problem for allocation requests that are not a
power of 2 in size, as with 9KB jumbo mbuf clusters.

Reported by: alc
Reviewed by: alc
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28924

3 years agoInclude Makefile.inc1 in Makefile.vm, missed in previous change
Glen Barber [Tue, 2 Mar 2021 15:19:59 +0000 (10:19 -0500)]
Include Makefile.inc1 in Makefile.vm, missed in previous change

MFC after: 3 days
MFC with: 80ab50e1de190be274d37379
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoAdjust where UNAME_r is defined for ports builds
Glen Barber [Tue, 2 Mar 2021 15:11:04 +0000 (10:11 -0500)]
Adjust where UNAME_r is defined for ports builds

In followup to 80ab50e1de19ca125f05a13937c796d48c4edd4a,
export UNAME_r in Makefile.inc1 instead of Makefile.vm.

MFC after: 3 days
MFC with: 80ab50e1de19
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoopenzfs: attach pam_zfs_key to build
Greg V [Tue, 2 Mar 2021 11:01:14 +0000 (06:01 -0500)]
openzfs: attach pam_zfs_key to build

This PAM module allows unlocking encrypted user home datasets when
logging in (and changing passphrase when changing the account password),
see https://github.com/openzfs/zfs/pull/9903

Also supposed to unload the key when the last session for the user is
done, but there are EBUSY issues:
https://github.com/openzfs/zfs/issues/11222#issuecomment-731897858

Submitted by: Greg V <greg_unrelenting.technology>
Reviewed by: mm
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28018

3 years agoRACK: fix an issue triggered by using the CDG CC module
Michael Tuexen [Tue, 2 Mar 2021 11:32:16 +0000 (12:32 +0100)]
RACK: fix an issue triggered by using the CDG CC module

Obtained from: rrs@
MFC after: 3 days
PR: 238741
Sponsored by: Netlix, Inc.

3 years agoipfw: add IPv6 support for sockarg opcode.
Andrey V. Elsukov [Tue, 2 Mar 2021 09:45:59 +0000 (12:45 +0300)]
ipfw: add IPv6 support for sockarg opcode.

MFC after: 1 week
Sponsored by: Yandex LLC

3 years agoshare/man/man9: document zero_region(9)
Ka Ho Ng [Tue, 2 Mar 2021 09:14:05 +0000 (17:14 +0800)]
share/man/man9: document zero_region(9)

The zero_region() kernel interface was previously undocumented.
Add a new zero_region(9) manual page to document it.

Submitted by: Ka Ho Ng <khng@freebsdfoundation.org>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28914

3 years agoImport wireguard fixes from pfSense 2.5
Peter Grehan [Sat, 27 Feb 2021 04:15:04 +0000 (14:15 +1000)]
Import wireguard fixes from pfSense 2.5

Merge the following fixes from https://github.com/pfsense/FreeBSD-src
 1940e7d3  Save address of ingress packets to allow wg to work on HA
 8f5531f1  Fix connection to IPv6 endpoint
 825ed9ee  Fix tcpdump for wg IPv6 rx tunnel traffic
 2ec232d3  Fix issue with replying to INITIATION messages in server mode
 ec77593a  Return immediately in wg_init if in DETACH'd state
 0f0dde6f  Remove unnecessary wg debug printf on transmit
 2766dc94  Detect and fix case in wg_init() where sockets weren't cleaned up
 b62cc7ac  Close the UDP tunnel sockets when the interface has been stopped

Reviewed by: kevans
Obtained from: pfSense 2.5
MFC after: 3 days
Relnotes: yes
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28962

3 years agoOptimize TX coalescing by keeping pointer to last mbuf.
Alexander Motin [Tue, 2 Mar 2021 04:31:34 +0000 (23:31 -0500)]
Optimize TX coalescing by keeping pointer to last mbuf.

Before m_cat() each time traversed through all the coalesced chain.

MFC after: 1 week

3 years agolibc: Use musl's optimized strchr and strchrnul
Ed Maste [Tue, 2 Mar 2021 01:57:36 +0000 (20:57 -0500)]
libc: Use musl's optimized strchr and strchrnul

Parentheses added to HASZERO macro to avoid a GCC warning, and formatted
with clang-format as we have adopted these and don't consider them
'contrib' code.

Obtained from: musl (snapshot at commit 4d0a82170a25)
Reviewed by: kib (libc integration), mjg (both earlier)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17630

3 years agoFFS extattr: fix handling of the tail
Konstantin Belousov [Mon, 1 Mar 2021 15:24:11 +0000 (17:24 +0200)]
FFS extattr: fix handling of the tail

There are three issues with change that stopped truncating ea area before
write, and resulted in possible zero tail in the ea area:
- Truncate to zero checked i_ea_len after the reference was dropped,
  making the last drop effectively truncate to zero length always.
- Loop to fill uio for zeroing specified too large length, that triggered
  assert in normal situation.
- Integrity check could trip over the tail, instead we must allow
  partial header or header with zero length, and clamp ea image in
  memory at it.

Reported by: arichardson
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Fixup: 5e198e7646a27412c0541719f7bf1bbc0bd89223
Differential Revision: https://reviews.freebsd.org/D28999

3 years agoOptimize out few extra memory accesses.
Alexander Motin [Mon, 1 Mar 2021 23:35:45 +0000 (18:35 -0500)]
Optimize out few extra memory accesses.

MFC after: 1 week

3 years agoCirrus-CI: temporarily avoid qemu smoke test boot
Ed Maste [Mon, 1 Mar 2021 21:39:25 +0000 (16:39 -0500)]
Cirrus-CI: temporarily avoid qemu smoke test boot

Cirrus-CI has been red for some time because we're running out of disk
space on the ephemeral GCP VMs.  For now remove the package + qemu boot,
and just check for build regressions.

This change to be reverted once we have identified and addressed the
underlying issue.

Sponsored by: The FreeBSD Foundation

3 years agoservice: respect nojailvnet keyword
Mariusz Zaborski [Mon, 1 Mar 2021 22:18:58 +0000 (23:18 +0100)]
service: respect nojailvnet keyword

In the 761d2bb5b9e70cf30f9c2dac62a47a2d2593e83f we added nojailvnet
keyword. The nojailvnet keyword is used to skip startup scripts in
jails that are run without VNET.

The service.sh was omitted in this commit. The service.sh
even documents that this is the same code as in rc - so lets reflect
that.

Submitted by: Adam Wołk <a.wolk@fudosecurity.com>
Sponsored by: Fudo Security

3 years agonfsclient: Fix the stripe unit size for a File Layout pNFS layout
Rick Macklem [Mon, 1 Mar 2021 20:49:32 +0000 (12:49 -0800)]
nfsclient: Fix the stripe unit size for a File Layout pNFS layout

During a recent virtual NFSv4 testing event, a bug in the FreeBSD client
was detected when doing a File Layout pNFS DS I/O operation.
The size of the I/O operation was smaller than expected.
The I/O size is specified as a stripe unit size in bits 6->31 of nflh_util
in the layout.  I had misinterpreted RFC5661 and had shifted the value
right by 6 bits. The correct interpretation is to use the value as
presented (it is always an exact multiple of 64), clearing bits 0->5.
This patch fixes this.

Without the patch, I/O through the DSs work, but the I/O size is 1/64th
of what is optimal.

MFC after: 2 weeks

3 years agoAllow ssp_test:read to pass more reliably
Alex Richardson [Mon, 1 Mar 2021 19:50:38 +0000 (19:50 +0000)]
Allow ssp_test:read to pass more reliably

It appears that the stackframe layout can be slightly different depending on
compiler and target architecture. For example, when using CHERI LLVM for RISC-V
we can actually overflow the buffer by up to 8 bytes without SSP detecting it.
Fix this by increasing the overflow to 15 bytes.

Reviewed By: ngie, emaste
Differential Revision: https://reviews.freebsd.org/D28997

3 years agoFix ptrace_test:ptrace__syscall_args after ATF upgrade
Alex Richardson [Tue, 23 Feb 2021 12:51:35 +0000 (12:51 +0000)]
Fix ptrace_test:ptrace__syscall_args after ATF upgrade

ATF now opens the results file (without CLOEXEC), so the child actually
has a valid file descriptor 3. To fix this simply use a large number that
will definitely not be a valid file descriptor.

Reviewed by: jhb, cem, lwhsu
Differential Revision: https://reviews.freebsd.org/D28889

3 years agoRemove atf_tc_skip calls from ptrace_test
Alex Richardson [Mon, 1 Mar 2021 18:51:02 +0000 (18:51 +0000)]
Remove atf_tc_skip calls from ptrace_test

I've run these tests many times in a loop on multiple architectures and
it works reliably for me, maybe it's time to retire these skips?
This also adds an additional waitpid to one of the tests to avoid
a potential race condition (suggested by markj@).

PR: 239397, 244056, 239425, 240510, 220841, 243605
Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D28888

3 years agoptrace_test: Add more debug output on test failures
Alex Richardson [Mon, 1 Mar 2021 18:49:31 +0000 (18:49 +0000)]
ptrace_test: Add more debug output on test failures

Mostly automatic, using
`CHILD_REQUIRE\(([^|&\n]*) ==` -> `CHILD_REQUIRE_EQ_INT($1,`
`ATF_REQUIRE\(([^|&\n]*) ==` -> `REQUIRE_EQ_INT($1,` followed by
git-clang-format -f and then manually checking ones that contain ||/&&.

Test Plan:
Still getting the same failure but now it prints
`psr.sr_error (0) == EBADF (9) not met` instead of just failing
without printing the values.

PR: 243605
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D28887

3 years agojail: allow root to implicitly widen its cpuset to attach
Kyle Evans [Fri, 26 Feb 2021 21:46:47 +0000 (15:46 -0600)]
jail: allow root to implicitly widen its cpuset to attach

The default behavior for attaching processes to jails is that the jail's
cpuset augments the attaching processes, so that it cannot be used to
escalate a user's ability to take advantage of more CPUs than the
administrator wanted them to.

This is problematic when root needs to manage jails that have disjoint
sets with whatever process is attaching, as this would otherwise result
in a deadlock. Therefore, if we did not have an appropriate common
subset of cpus/domains for our new policy, we now allow the process to
simply take on the jail set *if* it has the privilege to widen its mask
anyways.

With the new logic, root can still usefully cpuset a process that
attaches to a jail with the desire of maintaining the set it was given
pre-attachment while still retaining the ability to manage child jails
without jumping through hoops.

A test has been added to demonstrate the issue; cpuset of a process
down to just the first CPU and attempting to attach to a jail without
access to any of the same CPUs previously resulted in EDEADLK and now
results in taking on the jail's mask for privileged users.

PR: 253724
Reviewed by: jamie (also discussed with)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28952

3 years agoCirrus-CI: show mounted filesystems and free space at start
Ed Maste [Mon, 1 Mar 2021 03:07:05 +0000 (22:07 -0500)]
Cirrus-CI: show mounted filesystems and free space at start

CI runs have been encountering disk full errors.  Add a `df` invocation
so that we can see what we're working with.

3 years agocalculate prr_out correctly when pipe < ssthresh
Richard Scheffenegger [Mon, 1 Mar 2021 15:25:46 +0000 (16:25 +0100)]
calculate prr_out correctly when pipe < ssthresh

Reviewed By: #transport, tuexen
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28998

3 years agoriscv: Fix whitespace issues in fabs added in 524b018d2004
Jessica Clarke [Mon, 1 Mar 2021 14:01:13 +0000 (14:01 +0000)]
riscv: Fix whitespace issues in fabs added in 524b018d2004

3 years agodialog: fix macro redefinition
Baptiste Daroussin [Mon, 1 Mar 2021 14:58:34 +0000 (15:58 +0100)]
dialog: fix macro redefinition

dialog.h defines MIN and MAX (making sure to undefine the previous
macros if it already exists), but sys/param.h also defines those
macros (without guards) and is included after dialog.h resulting
in both gcc and clang complaining about macro redefiniton

While clang do accept -Wno-macro-redefined to ignore the redefinition
warning, gcc does not [1]

Undefine both macros prior inclusion of sys/param.h to avoid the warning

Reported by: arichardson

3 years agocopy_file_range(2): Fix for small values of input file offset and len
Rick Macklem [Mon, 1 Mar 2021 14:28:30 +0000 (06:28 -0800)]
copy_file_range(2): Fix for small values of input file offset and len

r366302 broke copy_file_range(2) for small values of
input file offset and len.

It was possible for rem to be greater than len and then
"len - rem" was a large value, since both variables are
unsigned.

Reported by: koobs, Pablo <pablogsal gmail com> (Python)
Reviewed by: asomers, koobs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28981

3 years agoAArch64: Don't set flush-subnormals-to-zero flag on startup
Alex Richardson [Mon, 1 Mar 2021 14:27:30 +0000 (14:27 +0000)]
AArch64: Don't set flush-subnormals-to-zero flag on startup

This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301.
However, This causes some of the math-related tests to fail as they report
zero instead of a tiny number. This fixes at least
/usr/tests/lib/msun/ldexp_test and possibly others.
Additionally, setting this flag prevents printf() from printing subnormal
numbers in decimal form.
See also https://www.openwall.com/lists/musl/2021/02/26/1

PR: 253847
Reviewed By: mmel
Differential Revision: https://reviews.freebsd.org/D28938

3 years agoSilence a macro-redefined warning when crossbuilding
Alex Richardson [Mon, 1 Mar 2021 14:11:20 +0000 (14:11 +0000)]
Silence a macro-redefined warning when crossbuilding

This is already defined by the ncurses headers, so just undef it before
defining it again.

3 years agos_scalbn.c: Add missing float.h include
Alex Richardson [Mon, 1 Mar 2021 14:10:24 +0000 (14:10 +0000)]
s_scalbn.c: Add missing float.h include

This caused LDBL_MANT_DIG to not be defined and therefore the scalbnl
alias was not being emitted for double==long double platforms.

Fixes: 760b2ffc ("Update scalbn* functions to the musl versions")
Reported by: Jenkins

3 years agoarm64: add definition for IS_SSTEP_TRAP()
Mitchell Horne [Mon, 1 Mar 2021 14:01:25 +0000 (10:01 -0400)]
arm64: add definition for IS_SSTEP_TRAP()

arm64 has a distinct exception code for single-step, so we can use this
to detect when an unexpected SS trap is encountered, or when an expected
one is not. See db_stop_at_pc().

Reviewed by: markj, jhb
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28942

3 years agoarm64: update kdb_thrctx->pcb_lr with BKPT_SKIP
Mitchell Horne [Mon, 1 Mar 2021 14:00:17 +0000 (10:00 -0400)]
arm64: update kdb_thrctx->pcb_lr with BKPT_SKIP

This value should be kept in sync with updates to kdb_frame->tf_elr,
since it is queried by PC_REGS() in several places.

Reviewed by: markj, jhb
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28943

3 years agoarm64: fix hardware single-stepping from EL1
Mitchell Horne [Mon, 1 Mar 2021 13:59:25 +0000 (09:59 -0400)]
arm64: fix hardware single-stepping from EL1

The main issue is that debug exceptions must to be disabled for the
entire duration that SS bit in MDSCR_EL1 is set. Otherwise, a
single-step exception will be generated immediately. This can occur
before returning from the debugger (when MDSCR is written to) or before
re-entering it after the single-step (when debug exceptions are unmasked
in the exception handler).

Solve this by delaying the unmask to C code for EL1, and avoid unmasking
at all while handling debug exceptions, thus avoiding any recursive
debug traps.

Reviewed by: markj, jhb
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28944

3 years agoFix ncurses bootstrap on macOS
Alex Richardson [Mon, 1 Mar 2021 13:21:35 +0000 (13:21 +0000)]
Fix ncurses bootstrap on macOS

Avoid including machine/console.h when bootstrapping on non-FreeBSD.

3 years agoMakefile.inc1 "Avoid duplicate script for target" warning
Alex Richardson [Mon, 1 Mar 2021 13:20:32 +0000 (13:20 +0000)]
Makefile.inc1 "Avoid duplicate script for target" warning

This happens if -DBOOTSTRAP_ALL_TOOLS or when building on non-FreeBSD.

3 years agopci_dw_mv: Don't enable unhandled interrupts.
Michal Meloun [Wed, 27 Jan 2021 11:45:32 +0000 (12:45 +0100)]
pci_dw_mv: Don't enable unhandled interrupts.

Mainly link errors interrupts should only be activated on fully linked port,
otherwise noise on lanes can cause livelock. But we don't have error
counters yet, so leave these interrupts disabled.

3 years agoriscv: Add a soft-float implementation of fabs()
Alex Richardson [Mon, 1 Mar 2021 12:46:30 +0000 (12:46 +0000)]
riscv: Add a soft-float implementation of fabs()

We could just use a C implementation using __builtin_fabs(), but using
this assembly version guarantees that there is no additional prolog/epilog
code. Additionally, clang generates worse code for masking off the top bit
than GCC: https://bugs.llvm.org/show_bug.cgi?id=49377.

This fixes the RISCV64 softfloat world build after cf97d2a1dab8. That commit
added -fno-builtin to the msun tests which resulted in the first references to
fabs (previously the compiler inlined all calls).

Reviewed By: dim
Reported by: mjg
Differential Revision: https://reviews.freebsd.org/D28994

3 years agotools/build/make.py: Don't call brew --prefix if --cross-bindir is set
Alex Richardson [Fri, 26 Feb 2021 17:49:03 +0000 (17:49 +0000)]
tools/build/make.py: Don't call brew --prefix if --cross-bindir is set

Also updated the logic to use subprocess.run() instead of the old
subprocess.getoutput() which also includes stderr and therefore
can trigger an exception inside Path().exists().

Reported by: gnn

3 years agoAlso use the musl scalbn code for ldexp()
Alex Richardson [Thu, 25 Feb 2021 14:29:44 +0000 (14:29 +0000)]
Also use the musl scalbn code for ldexp()

Instead of copying the code as 00646ca2047305fce32d99edc7a8e6dfd801f3b4
did, include the implementation with the function name re-defined.

3 years agoUpdate scalbn* functions to the musl versions
Alex Richardson [Wed, 24 Feb 2021 16:56:53 +0000 (16:56 +0000)]
Update scalbn* functions to the musl versions

The only diff compared to musl is a minor change to scalbnl() to replace
musl's union ldshape with union IEEEl2bits.
This fixes the scalbn tests on non-x86 (since x86 has an assembly version
that is used instead).

Musl commit messages:
commit 8c44a060243f04283ca68dad199aab90336141db
Author: Szabolcs Nagy <nsz@port70.net>
Date:   Mon Apr 3 02:38:13 2017 +0200

    fix scalbn when result is in the subnormal range

    in nearest rounding mode scalbn could introduce double rounding error
    when an intermediate value and the final result were both in the
    subnormal range e.g.

      scalbn(0x1.7ffffffffffffp-1, -1073)

    returned 0x1p-1073 instead of 0x1p-1074, because the intermediate
    computation got rounded to 0x1.8p-1023.

    with the fix an intermediate value can only be in the subnormal range
    if the final result is 0 which is correct even after double rounding.
    (there still can be two roundings so signals may be raised twice, but
    that's only observable with trapping exceptions which is not supported.)

commit 2eaed464e2080d8321d3903b71086a1ecfc4ee4a
Author: Szabolcs Nagy <nsz@port70.net>
Date:   Wed Sep 4 15:52:54 2013 +0000

    math: use float_t and double_t in scalbnf and scalbn

    remove STRICT_ASSIGN (c99 semantics is assumed) and use the conventional
    union to prepare the scaling factor (so libm.h is no longer needed)

commit 1b77b9072f374bd26eb0574b83a0d5f18d75ec60
Author: Szabolcs Nagy <nsz@port70.net>
Date:   Thu Aug 15 10:07:46 2013 +0000

    math: minor scalbn*.c simplification

commit c4359e01303da2755fe7e8033826b132eb3659b1
Author: Szabolcs Nagy <nsz@port70.net>
Date:   Tue Nov 13 10:55:35 2012 +0100

    math: excess precision fix modf, modff, scalbn, scalbnf

    old code was correct only if the result was stored (without the
    excess precision) or musl was compiled with -ffloat-store.
    now we use STRICT_ASSIGN to work around the issue.
    (see note 160 in c11 section 6.8.6.4)

commit 666271c105e4137bdfa195e217799d74143370d4
Author: Szabolcs Nagy <nsz@port70.net>
Date:   Tue Nov 13 10:30:40 2012 +0100

    math: fix scalbn and scalbnf on overflow/underflow

    old code was correct only if the result was stored (without the
    excess precision) or musl was compiled with -ffloat-store.
    (see note 160 in n1570.pdf section 6.8.6.4)

commit 8051e08e10d2b739fcfcbc6bc7466e8d77fa49f1
Author: nsz <nsz@port70.net>
Date:   Mon Mar 19 10:54:07 2012 +0100

    simplify scalbn*.c implementations

    The old scalbn.c was wrong and slow, the new one is just slow.
    (scalbn(0x1p+1023,-2097) should give 0x1p-1074, but the old code gave 0)

Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D28872

3 years agotests/sys/netpfil/pf: Add missing python3 requirements
Alex Richardson [Tue, 23 Feb 2021 19:04:01 +0000 (19:04 +0000)]
tests/sys/netpfil/pf: Add missing python3 requirements

This also fixes a typo in the dup test that caused the head function to
not be called. On my test system without python3 the tests are now
skipped instead of failing.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D28903

3 years agoxen: remove x86-ism from Xen common code
Elliott Mitchell [Mon, 1 Mar 2021 11:44:54 +0000 (12:44 +0100)]
xen: remove x86-ism from Xen common code

PAT_WRITE_BACK is x86-only, whereas sys/dev/xen could be shared
between multiple architectures.

Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D28831

3 years agokcsan: add atomic_interrupt_fence
Mateusz Guzik [Mon, 1 Mar 2021 07:42:15 +0000 (07:42 +0000)]
kcsan: add atomic_interrupt_fence

Unbreaks building GENERIC-KCSAN.

3 years ago[PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask().
Brandon Bergren [Mon, 1 Mar 2021 03:06:59 +0000 (21:06 -0600)]
[PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask().

Building R on powerpc64 exposed a problem in fpsetmask() whereby we
were not properly clamping the provided mask to the valid range.

This same issue affects powerpc and powerpcspe.

Properly limit the range of bits that can be set via fpsetmask().

While here, use the correct fp_except_t type instead of fp_rnd_t.

Reported by: pkubaj, jhibbits (in IRC)
Sponsored by: Tag1 Consulting, Inc.
MFC after: 1 week

3 years ago[PowerPC64] Fix multiple issues in fpsetmask().
Brandon Bergren [Mon, 1 Mar 2021 02:35:53 +0000 (20:35 -0600)]
[PowerPC64] Fix multiple issues in fpsetmask().

Building R exposed a problem in fpsetmask() whereby we were not properly
clamping the provided mask to the valid range.

R initilizes the mask by calling fpsetmask(~0) on FreeBSD. Since we
recently enabled precise exceptions, this was causing an immediate
SIGFPE because we were attempting to set invalid bits in the fpscr.

Properly limit the range of bits that can be set via fpsetmask().

While here, use the correct fp_except_t type instead of fp_rnd_t.

Reported by: pkubaj (in IRC)
MFC after: 1 week
Sponsored by: Tag1 Consulting, Inc.

3 years agoAdd VOP_READ_PGCACHE(9)
Konstantin Belousov [Sun, 28 Feb 2021 01:08:37 +0000 (03:08 +0200)]
Add VOP_READ_PGCACHE(9)

PR: 253894
Reviewed by: gbe, rwatson
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28980

3 years agonfsclient: add nfs node locking around uses of n_direofoffset
Rick Macklem [Sun, 28 Feb 2021 22:53:54 +0000 (14:53 -0800)]
nfsclient: add nfs node locking around uses of n_direofoffset

During code inspection I noticed that the n_direofoffset field
of the NFS node was being manipulated without any lock being
held to make it SMP safe.
This patch adds locking of the NFS node's mutex around
handling of n_direofoffset to make it SMP safe.

I have not seen any failure that could be attributed to n_direofoffset
being manipulated concurrently by multiple processors, but I think this
is possible, since directories are read with shared vnode
locking, plus locks only on individual buffer cache blocks.
However, there have been as yet unexplained issues w.r.t reading
large directories over NFS that could have conceivably been caused
by concurrent manipulation of n_direofoffset.

MFC after: 2 weeks

3 years agonewsyslog(8): Implement a new 'E' flag to not rotate empty log files
Juraj Lutter [Sun, 28 Feb 2021 22:07:14 +0000 (23:07 +0100)]
newsyslog(8): Implement a new 'E' flag to not rotate empty log files

Based on an idea from dvl's coworker, László DANIELISZ, implement
a new flag, 'E', that prevents newsyslog(8) from rotating the empty
log files. This 'E' flag ist mostly usable in conjunction with 'B'
flag that instructs newsyslog(8) to not insert an informational
message into the log file after rotation, keeping it still empty.

Reviewed by: markj, ian, manpages (rpokala)
Approved by: markj, ian, manpages (rpokala)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28940

3 years agonfsclient: add checks for a server returning the current directory
Rick Macklem [Sun, 28 Feb 2021 22:15:32 +0000 (14:15 -0800)]
nfsclient: add checks for a server returning the current directory

Commit 3fe2c68ba20f dealt with a panic in cache_enter_time() where
the vnode referred to the directory argument.
It would also be possible to get these panics if a broken
NFS server were to return the directory as an new object being
created within the directory or in a Lookup reply.

This patch adds checks to avoid the panics and logs
messages to indicate that the server is broken for the
file object creation cases.

Reviewd by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28987

3 years agolibifconfig: Add a function to get down reason
Ryan Moeller [Sun, 28 Feb 2021 09:34:30 +0000 (09:34 +0000)]
libifconfig: Add a function to get down reason

For use in ifconfig.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28991

3 years agosbin/ifconfig: Get groups with libifconfig
Ryan Moeller [Sat, 27 Feb 2021 08:17:04 +0000 (08:17 +0000)]
sbin/ifconfig: Get groups with libifconfig

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28965

3 years agosbin/ifconfig: Get bridge status with libifconfig
Ryan Moeller [Fri, 26 Feb 2021 23:04:38 +0000 (23:04 +0000)]
sbin/ifconfig: Get bridge status with libifconfig

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28954

3 years agoarmv8crypto: add missing newline
Elliott Mitchell [Sun, 28 Feb 2021 20:03:44 +0000 (16:03 -0400)]
armv8crypto: add missing newline

The missing newline mildly garbles boot-time messages and this can be
troublesome if you need those.

Fixes: a520f5ca580f ("armv8crypto: print a message on probe failure")
Reported by: Mike Karels (mike@karels.net)
Reviewed By: gonzo
Differential Revision: https://reviews.freebsd.org/D28988

3 years agonet80211: rx_stats add 160Mhz channel width.
Bjoern A. Zeeb [Sun, 28 Feb 2021 19:24:22 +0000 (19:24 +0000)]
net80211: rx_stats add 160Mhz channel width.

Add the missing receive stat(u)s flag for 160Mhz channel width.
While here correct the comment for c_phytype to reference the correct
flags.

MFC-after: 3 days
Sponsored-by: Rubicon Communications, LLC ("Netgate")

3 years agoImprove PRR initial transmission timing
Richard Scheffenegger [Sun, 28 Feb 2021 14:46:38 +0000 (15:46 +0100)]
Improve PRR initial transmission timing

Reviewed By: tuexen, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28953

3 years agoFix diroffdiroff, probably copy/paste bug.
Alexander Motin [Sun, 28 Feb 2021 14:07:13 +0000 (09:07 -0500)]
Fix diroffdiroff, probably copy/paste bug.

Too long name looks bad in `vmstat -m`.

MFC after: 1 week

3 years agosbin/ifconfig: Drop local name var in sfp_status
Ryan Moeller [Sun, 28 Feb 2021 02:15:11 +0000 (02:15 +0000)]
sbin/ifconfig: Drop local name var in sfp_status

There is already a globally defined name variable.

MFC after: 1 week

3 years agosbin/ifconfig: Get lagg status with libifconfig
Ryan Moeller [Sat, 27 Feb 2021 03:05:31 +0000 (03:05 +0000)]
sbin/ifconfig: Get lagg status with libifconfig

Also trimmed an unused block of code that never prints out LAGG_PROTOS.
Reviewed by: kp (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28961

3 years agosbin/ifconfig: Get carp status with libifconfig
Ryan Moeller [Fri, 26 Feb 2021 23:40:58 +0000 (23:40 +0000)]
sbin/ifconfig: Get carp status with libifconfig

A trivial change now that ifconfig is already using libifconfig.
Reviewed by: kp (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28955

3 years agonfsclient: fix panic in cache_enter_time()
Rick Macklem [Sun, 28 Feb 2021 01:54:05 +0000 (17:54 -0800)]
nfsclient: fix panic in cache_enter_time()

Juraj Lutter (otis@) reported a panic "dvp != vp not true" in
cache_enter_time() called from the NFS client's nfsrpc_readdirplus()
function.
This is specific to an NFSv3 mount with the "rdirplus" mount
option. Unlike NFSv4, NFSv3 replies to ReaddirPlus
includes entries for the current directory.

This trivial patch avoids doing a cache_enter_time()
call for the current directory to avoid the panic.

Reported by: otis
Tested by: otis
Reviewed by: mjg
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28969

3 years agoUse atomic_interrupt_fence() instead of bare __compiler_membar()
Konstantin Belousov [Fri, 26 Feb 2021 23:54:17 +0000 (01:54 +0200)]
Use atomic_interrupt_fence() instead of bare __compiler_membar()

for the which which definitely use membar to sync with interrupt handlers.

libc and rtld uses of __compiler_membar() seems to want compiler barriers
proper.

The barrier in sched_unpin_lite() after td_pinned decrement seems to be not
needed and removed, instead of convertion.

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

3 years agolibifconfig: Set error in ifconfig_get_groups
Ryan Moeller [Sat, 27 Feb 2021 08:07:21 +0000 (08:07 +0000)]
libifconfig: Set error in ifconfig_get_groups

This should return -1 with OTHER/ENOMEM set in the handle when malloc
fails, like everywhere else in libifconfig.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28964

3 years agozfs: add missing seqc write begin/end around zfs_acl_chown_setattr
Mateusz Guzik [Sat, 27 Feb 2021 22:26:20 +0000 (22:26 +0000)]
zfs: add missing seqc write begin/end around zfs_acl_chown_setattr

It happens to trip over an assert but does not matter for correctness at
this time. However, do it for future proofing.

Reported by: avg

3 years agocache: temporarily drop the assert that dvp != vp when adding an entry
Mateusz Guzik [Sat, 27 Feb 2021 22:23:23 +0000 (22:23 +0000)]
cache: temporarily drop the assert that dvp != vp when adding an entry

Historically it was allowed for any names, but arguably should never be
even attempted. Allow it again since there is a release pending and
allowing it is bug-compatible with previous behavior.

Reported by: otis

3 years agosctp: avoid integer overflow when starting the HB timer
Michael Tuexen [Sat, 27 Feb 2021 22:27:30 +0000 (23:27 +0100)]
sctp: avoid integer overflow when starting the HB timer

MFC after: 3 days
Reported by: syzbot+14b9d7c3c64208fae62f@syzkaller.appspotmail.com

3 years agobhyve/snapshot: rename and bump size of MAX_SNAPSHOT_VMNAME
Robert Wing [Sat, 27 Feb 2021 21:07:35 +0000 (12:07 -0900)]
bhyve/snapshot: rename and bump size of MAX_SNAPSHOT_VMNAME

MAX_SNAPSHOT_VMNAME is a macro used to set the size of a character
buffer that stores a filename or the path to a file - this file is used
by the save/restore feature.

Since the file doesn't have anything to do with a vm name, rename
MAX_SNAPSHOT_VMNAME to MAX_SNAPSHOT_FILENAME. Bump the size to PATH_MAX
while here.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28879

3 years agobhyvectl: reduce code duplication
Robert Wing [Sat, 27 Feb 2021 21:05:52 +0000 (12:05 -0900)]
bhyvectl: reduce code duplication

Combine send_start_checkpoint() and send_start_suspend() into a
single function named snapshot_request().

snapshot_request() is equivalent to send_start_checkpoint() and
send_start_suspend() except that it takes an additional argument. The
additional argument, enum ipc_opcode, is used to determine the type of
snapshot request being performed. Also, switch to using strlcpy instead
of strncpy.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28878

3 years agobhyve/snapshot: rename checkpoint_opcodes to be more generic
Robert Wing [Sat, 27 Feb 2021 21:03:03 +0000 (12:03 -0900)]
bhyve/snapshot: rename checkpoint_opcodes to be more generic

Generalize the naming here since the domain socket that uses these codes
might be used for purposes other than the save/restore feature.

- rename checkpoint_opcodes to ipc_opcode

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28877

3 years agoAdd Xrefs to the new VOP_SETLABEL(9) from mac(9) and vnode(9).
Robert Watson [Sat, 27 Feb 2021 16:53:53 +0000 (16:53 +0000)]
Add Xrefs to the new VOP_SETLABEL(9) from mac(9) and vnode(9).

MFC after: 3 days

3 years agoProvide a man page for VOP_SETLABEL(9).
Robert Watson [Sat, 27 Feb 2021 16:51:00 +0000 (16:51 +0000)]
Provide a man page for VOP_SETLABEL(9).

MFC after: 3 days

3 years agoAdd a comment on why the call to mac_vnode_relabel() might be in the wrong
Robert Watson [Sat, 27 Feb 2021 16:22:26 +0000 (16:22 +0000)]
Add a comment on why the call to mac_vnode_relabel() might be in the wrong
place -- in the VOP rather than vn_setexttr() -- and that it is for historic
reasons.  We might wish to relocate it in due course, but this way at least
we document the asymmetry.

3 years agoMicro-optimize OOA queue processing.
Alexander Motin [Sat, 27 Feb 2021 15:14:05 +0000 (10:14 -0500)]
Micro-optimize OOA queue processing.

- Move ctl_get_cmd_entry() calls from every OOA traversal to when
  the requests first inserted, storing seridx in struct ctl_scsiio.
- Move some checks out of the loop in ctl_check_ooa().
- Replace checks for errors that can not happen with asserts.
- Transpose ctl_serialize_table, so that any OOA traversal accessed
  only one row (cache line).  Compact it from enum to uint8_t.
- Optimize static branch predictions in hottest places.

Due to O(n) nature on deep LUN queues this can be the hottest code
path in CTL, and additional 20% of IOPS I see in some 4KB I/O tests
are good to have in reserve.  About 50% of CPU time here according
to the profiles is now spent in two memory accesses per traversed
request in OOA.

Sponsored by: iXsystems, Inc.
MFC after: 2 weeks

3 years agoloader: use display pixel density for font autoselection
Toomas Soome [Sat, 20 Feb 2021 08:51:28 +0000 (10:51 +0200)]
loader: use display pixel density for font autoselection

Calculate font size from 16 density independent pixels (dp) by using:
size = 16 * ppi/160 * display_factor

We are specifying font size 16dp, and assuming 1dp = 160ppi.
Also apply scaling factor 2 (display_factor).

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28849