]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agopf: Implement nvlist variant of DIOCGETRULE
Kristof Provost [Thu, 25 Mar 2021 09:39:14 +0000 (10:39 +0100)]
pf: Implement nvlist variant of DIOCGETRULE

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29559

3 years agopfctl: Move to DIOCADDRULENV
Kristof Provost [Fri, 12 Mar 2021 17:03:14 +0000 (18:03 +0100)]
pfctl: Move to DIOCADDRULENV

Start using the new nvlist based ioctl to add rules.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29558

3 years agopf: Introduce nvlist variant of DIOCADDRULE
Kristof Provost [Thu, 11 Mar 2021 15:21:23 +0000 (16:21 +0100)]
pf: Introduce nvlist variant of DIOCADDRULE

This will make future extensions of the API much easier.
The intent is to remove support for DIOCADDRULE in FreeBSD 14.

Reviewed by: markj (previous version), glebius (previous version)
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29557

3 years agoCross-reference camcontrol(8) and zonectl(8) man pages.
Edward Tomasz Napierala [Sat, 10 Apr 2021 09:13:29 +0000 (10:13 +0100)]
Cross-reference camcontrol(8) and zonectl(8) man pages.

3 years agorc: kldxref only needs to depend on rootfs, not FILESYSTEMS
Edward Tomasz Napierala [Sat, 10 Apr 2021 08:19:25 +0000 (09:19 +0100)]
rc: kldxref only needs to depend on rootfs, not FILESYSTEMS

This makes it run a bit earlier in the startup, which will
be useful for the linux rc script later on.

Reviewed By: imp (earlier version)
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29589

3 years agoRegen src.conf.5 after 9d178c925fb9
Ed Maste [Sat, 10 Apr 2021 02:22:05 +0000 (22:22 -0400)]
Regen src.conf.5 after 9d178c925fb9

3 years agoDrop 'Set to' from most src.conf(5) knobs
Ed Maste [Sat, 10 Apr 2021 02:23:03 +0000 (22:23 -0400)]
Drop 'Set to' from most src.conf(5) knobs

The description is clearly what effect the knob has when set, so the
additional text was unnecessary.

Reviewed by: jhb, se
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29583

3 years agoamd64: clear debug registers on execing 32bit Linux binary
Konstantin Belousov [Fri, 9 Apr 2021 23:25:06 +0000 (02:25 +0300)]
amd64: clear debug registers on execing 32bit Linux binary

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

3 years agoamd64: clear debug registers on execing 32bit native binary
Konstantin Belousov [Fri, 9 Apr 2021 23:23:54 +0000 (02:23 +0300)]
amd64: clear debug registers on execing 32bit native binary

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

3 years agoamd64 linux64: use x86_clear_dbregs()
Konstantin Belousov [Fri, 9 Apr 2021 23:22:48 +0000 (02:22 +0300)]
amd64 linux64: use x86_clear_dbregs()

instead of manually inlining it

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

3 years agox86: use x86_clear_dbregs() on fork
Konstantin Belousov [Fri, 9 Apr 2021 23:20:55 +0000 (02:20 +0300)]
x86: use x86_clear_dbregs() on fork

instead of manual zeroing of the debug registers file in pcb.
This centralizes the cleaning code, but the practical difference is
that PCB_DBREGS flag is cleared, saving some operations on context
switching.

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

3 years agox86: add x86_clear_dbregs() helper
Konstantin Belousov [Fri, 9 Apr 2021 23:19:23 +0000 (02:19 +0300)]
x86: add x86_clear_dbregs() helper

Move the code from exec_setregs() to reset debug registers state on exec,
to the x86_clear_dbregs() helper

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

3 years agoFix a typo in a comment: frame -> framework.
John Baldwin [Tue, 16 Mar 2021 22:33:20 +0000 (15:33 -0700)]
Fix a typo in a comment: frame -> framework.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agonlmrsa: Remove this deprecated driver.
John Baldwin [Tue, 16 Mar 2021 21:48:02 +0000 (14:48 -0700)]
nlmrsa: Remove this deprecated driver.

Relnotes: yes
Sponsored by: Chelsio Communications

3 years agoefivar: use bool for booleans
Warner Losh [Fri, 9 Apr 2021 22:35:50 +0000 (16:35 -0600)]
efivar: use bool for booleans

Rather than int flags we ++, use booleans for all command line args.
No functional change intended.

Reviewed by: markj@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29621

3 years agoefivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name
Warner Losh [Fri, 9 Apr 2021 22:35:17 +0000 (16:35 -0600)]
efivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name

Due to how we're parsing UUIDs, we were disallowing setting, printing or
deleting any UEFI variable with a '-' in it when you attempted to do that
operation with the exact name (wildcard reporting was unaffected). Fix the
parser to loop over all the dashes in the name and only give up when all
possible matches are exhausted.

Reviewed by: markj@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29620

3 years agoefivar: Add --quiet to not report errors
Warner Losh [Fri, 9 Apr 2021 22:35:08 +0000 (16:35 -0600)]
efivar: Add --quiet to not report errors

Add -q/--quiet flag to the command line. With it, errors are not reported at
all. Instead nothing is printed and the exit code is non-zero.

Reviewed by: markj
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29619

3 years agotcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer.
Gleb Smirnoff [Fri, 9 Apr 2021 15:39:40 +0000 (08:39 -0700)]
tcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer.
Not a functional change.

3 years agotcp_hostcache: style(9)
Gleb Smirnoff [Thu, 8 Apr 2021 21:23:23 +0000 (14:23 -0700)]
tcp_hostcache: style(9)

Reviewed by: rscheff

3 years agotcp_hostcache: remove extraneous check.
Gleb Smirnoff [Thu, 8 Apr 2021 21:17:39 +0000 (14:17 -0700)]
tcp_hostcache: remove extraneous check.
All paths leading here already checked this setting.

Reviewed by: rscheff

3 years agotcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update.
Gleb Smirnoff [Thu, 8 Apr 2021 21:15:42 +0000 (14:15 -0700)]
tcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update.
Locking changes are planned here, and without this change too
much copy-and-paste would be between these two functions.

Reviewed by: rscheff

3 years agortld: use _get_tp() in __tls_get_addr()
Konstantin Belousov [Wed, 7 Apr 2021 03:49:28 +0000 (06:49 +0300)]
rtld: use _get_tp() in __tls_get_addr()

This eliminates some non-trivial amount of code duplication, where done.
Only x86 and mips are handled right now.

Tested by:      bdragon (powerpc), mhorne (riscv)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld: avoid recursing on rtld_bind_lock for write
Konstantin Belousov [Tue, 6 Apr 2021 19:02:23 +0000 (22:02 +0300)]
rtld: avoid recursing on rtld_bind_lock for write

This fixes a regression in d36d6816151705907393889, where the call to
__tls_get_address() was performed under rtld_bind_lock write-locked.
Instead use tls_get_addr_slow() directly, with locked = true.

Reported by: jkim, many others
Tested by: jkim, bdragon (powerpc), mhorne (riscv)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked
Konstantin Belousov [Tue, 6 Apr 2021 18:56:58 +0000 (21:56 +0300)]
rtld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked

Explicit locked parameter is added

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

3 years agortld: style tls_get_addr_slow
Konstantin Belousov [Tue, 6 Apr 2021 18:55:10 +0000 (21:55 +0300)]
rtld: style tls_get_addr_slow

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

3 years agolibc dl_iterate_phdr(): dlpi_tls_data is wrong
Konstantin Belousov [Mon, 5 Apr 2021 03:38:07 +0000 (06:38 +0300)]
libc dl_iterate_phdr(): dlpi_tls_data is wrong

This is the same change as d36d681615170590, but for libc static implementaion
of dl_iterate_phdr().

Reported by: emacsray@gmail.com
PR: 254774
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agolibc: implement __tls_get_addr() for static binaries
Konstantin Belousov [Mon, 5 Apr 2021 03:29:47 +0000 (06:29 +0300)]
libc: implement __tls_get_addr() for static binaries

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

3 years agolibc: add _get_tp() private function
Konstantin Belousov [Mon, 5 Apr 2021 03:30:35 +0000 (06:30 +0300)]
libc: add _get_tp() private function

which returns pointer to tcb

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

3 years agortld: define TLS_DTV_OFFSET on all architectures
Konstantin Belousov [Wed, 7 Apr 2021 06:25:34 +0000 (09:25 +0300)]
rtld: define TLS_DTV_OFFSET on all architectures

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

3 years agolibc: include rtld.h into static implementations of rtld interface
Konstantin Belousov [Mon, 5 Apr 2021 03:41:46 +0000 (06:41 +0300)]
libc: include rtld.h into static implementations of rtld interface

and resolve naming conficts

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

3 years agolibc: constify dummy error message string for dlfcn
Konstantin Belousov [Mon, 5 Apr 2021 04:14:39 +0000 (07:14 +0300)]
libc: constify dummy error message string for dlfcn

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

3 years agortld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc
Konstantin Belousov [Mon, 5 Apr 2021 04:12:22 +0000 (07:12 +0300)]
rtld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc

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

3 years agortld/x86/reloc.c: style
Konstantin Belousov [Wed, 7 Apr 2021 06:12:10 +0000 (09:12 +0300)]
rtld/x86/reloc.c: style

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

3 years agortld_lock.h: remove tautological extern's
Konstantin Belousov [Mon, 5 Apr 2021 04:11:49 +0000 (07:11 +0300)]
rtld_lock.h: remove tautological extern's

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

3 years agoStop arming kqueue timers on knote owner suspend or terminate
Konstantin Belousov [Fri, 5 Mar 2021 23:29:08 +0000 (01:29 +0200)]
Stop arming kqueue timers on knote owner suspend or terminate

This way, even if the process specified very tight reschedule
intervals, it should be stoppable/killable.

Reported and reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoAdd helper for kqueue timers callout scheduling
Konstantin Belousov [Fri, 5 Mar 2021 23:31:20 +0000 (01:31 +0200)]
Add helper for kqueue timers callout scheduling

Reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoStop arming realtime posix process timers on suspend or terminate
Konstantin Belousov [Thu, 11 Mar 2021 08:16:51 +0000 (10:16 +0200)]
Stop arming realtime posix process timers on suspend or terminate

Reported and reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoStop arming periodic process timers on suspend or terminate
Konstantin Belousov [Fri, 5 Mar 2021 21:19:35 +0000 (23:19 +0200)]
Stop arming periodic process timers on suspend or terminate

Reported and reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoImplement better rebuild-delay fib algo policy.
Alexander V. Chernikov [Fri, 9 Apr 2021 20:25:47 +0000 (21:25 +0100)]
Implement better rebuild-delay fib algo policy.

The intent is to better handle time intervals with large amount of RIB
updates (e.g. BGP peer going up or down), while still keeping low sync
delay for the rest scenarios.

The implementation is the following: updates are bucketed into the
buckets of size 50ms. If the number of updates within a current bucket
 exceeds the threshold of 500 routes/sec (e.g. 10 updates per bucket
interval), the update is delayed for another 50ms. This can be repeated
 until the maximum update delay (1 sec) is reached.

All 3 variables are runtime tunables:

* net.route.algo.fib_max_sync_delay_ms: 1000
* net.route.algo.bucket_change_threshold_rate: 500
* net.route.algo.bucket_time_ms: 50

Differential Review: https://reviews.freebsd.org/D29588
MFC after: 2 weeks

3 years agonetmap: vtnet: remove unused variable
Vincenzo Maffione [Fri, 9 Apr 2021 19:26:23 +0000 (19:26 +0000)]
netmap: vtnet: remove unused variable

Reported by: bdragon

3 years agosysctl.conf(5): Mention sysctl.conf.local in the sysctl.conf(5) manual page
Gordon Bergling [Fri, 9 Apr 2021 15:28:18 +0000 (17:28 +0200)]
sysctl.conf(5): Mention sysctl.conf.local in the sysctl.conf(5) manual page

The possibility of using a sysctl.conf.local on a machine that has a shared
sysctl.conf(5) isn't documented. So mention the sysctl.conf.local in the
manual page.

PR: 254901
Submitted by: Jose Luis Duran <jlduran at gmail dot com>
Reported by: Jose Luis Duran <jlduran at gmail dot com>
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29673

3 years agoRemoved the reference to the deprecated splx API from ifnet(9).
Dmitry Chagin [Fri, 9 Apr 2021 14:22:12 +0000 (17:22 +0300)]
Removed the reference to the deprecated splx API from ifnet(9).

Reviewed by: emaste, markj
PR: 254880
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D29666

3 years agolpd(8): Mention the author of a paper in the SEE ALSO section
Gordon Bergling [Fri, 9 Apr 2021 09:29:18 +0000 (11:29 +0200)]
lpd(8): Mention the author of a paper in the SEE ALSO section

Obtained from: OpenBSD
MFC after: 1 week

3 years agoconfig(8): Mention the authors of a paper in the SEE ALSO section
Gordon Bergling [Fri, 9 Apr 2021 09:20:49 +0000 (11:20 +0200)]
config(8): Mention the authors of a paper in the SEE ALSO section

Obtained from: OpenBSD
MFC after: 1 week

3 years agoed(1): Add two references in the SEE ALSO section
Gordon Bergling [Fri, 9 Apr 2021 07:43:49 +0000 (09:43 +0200)]
ed(1): Add two references in the SEE ALSO section

Obtained from: OpenBSD
MFC after: 1 week

3 years agopci_dw: Trim ATU windows bigger than 4GB
Wojciech Macek [Fri, 9 Apr 2021 07:28:44 +0000 (09:28 +0200)]
pci_dw: Trim ATU windows bigger than 4GB

The size of the ATU MEM/IO windows is implicitly casted to uint32_t.
Because of that some window sizes were silently demoted to 0 and ignored.
Check the size if its too large, trim it to 4GB and print a warning message.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: mw
Obtained from: Semihalf
Sponsored by: Marvell
Differential revision: https://reviews.freebsd.org/D29625

3 years agoUPDATING: dereference portupgrade(8)
Glen Barber [Fri, 9 Apr 2021 00:26:41 +0000 (20:26 -0400)]
UPDATING: dereference portupgrade(8)

Make the UPDATING file less tool-specific regarding upgrading
third-party software.

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

3 years agostruct mount uppers: correct locking annotations
Konstantin Belousov [Thu, 8 Apr 2021 22:03:06 +0000 (01:03 +0300)]
struct mount uppers: correct locking annotations

It is all locked by the uppers' interlock.

Noted by: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agonfsd: fix replies from session cache for retried RPCs
Rick Macklem [Thu, 8 Apr 2021 21:04:22 +0000 (14:04 -0700)]
nfsd: fix replies from session cache for retried RPCs

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

The FreeBSD server failec to reply using the cached
reply in the session slot when an RPC was retried on
the session slot, as indicated by same slot sequence#.

This patch fixes this.  It should also fix a similar
failure for NFSv4.0 mounts, when the sequence# in
the open/lock_owner requires a reply be done from
an entry locked into the DRC.

This fix affects the fairly rare case where a NFSv4
client retries a non-idempotent RPC, such as a lock
operation.  Note that retries only occur after the
client has needed to create a new TCP connection.

MFC after: 2 weeks

3 years agoEnforce check for using the return result for ifa?_try_ref().
Alexander V. Chernikov [Tue, 30 Mar 2021 14:03:28 +0000 (15:03 +0100)]
Enforce check for using the return result for ifa?_try_ref().

Suggested by: hps
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29504

3 years agom4(1): Add a SEE ALSO section and reference an AT&T manual
Gordon Bergling [Thu, 8 Apr 2021 19:16:54 +0000 (21:16 +0200)]
m4(1): Add a SEE ALSO section and reference an AT&T manual

Obtained from: OpenBSD
MFC after: 1 week

3 years agosed(1): Add a reference for a 4.4BSD manual document
Gordon Bergling [Thu, 8 Apr 2021 18:57:14 +0000 (20:57 +0200)]
sed(1): Add a reference for a 4.4BSD manual document

Obtained from: OpenBSD
MFC after: 1 week

3 years agotcp: Use jenkins_hash32() in hostcache
Richard Scheffenegger [Thu, 8 Apr 2021 18:28:43 +0000 (20:28 +0200)]
tcp: Use jenkins_hash32() in hostcache

As other parts of the base tcp stack (eg.
tcp fastopen) already use jenkins_hash32,
and the properties appear reasonably good,
switching to use that.

Reviewed By: tuexen, #transport, ae
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29515

3 years agotcp_hostcache.c: remove unneeded includes.
Gleb Smirnoff [Mon, 22 Mar 2021 21:36:21 +0000 (14:36 -0700)]
tcp_hostcache.c: remove unneeded includes.

Reviewed by: rscheff

3 years agotcp_hostcache: add bool argument for tcp_hc_lookup() to tell are we
Gleb Smirnoff [Mon, 22 Mar 2021 20:51:42 +0000 (13:51 -0700)]
tcp_hostcache: add bool argument for tcp_hc_lookup() to tell are we
looking to only read from the result, or to update it as well.
For now doesn't affect locking, but allows to push stats and expire
update into single place.

Reviewed by: rscheff

3 years agotcp_hostcache: hide rmx_hits/rmx_updates under ifdef.
Gleb Smirnoff [Mon, 22 Mar 2021 20:35:25 +0000 (13:35 -0700)]
tcp_hostcache: hide rmx_hits/rmx_updates under ifdef.

They have little value unless you do some profiling investigations,
but they are performance bottleneck.

Reviewed by: rscheff

3 years agoRemove tcp_hostcache.h. Everything is private.
Gleb Smirnoff [Mon, 22 Mar 2021 18:45:29 +0000 (11:45 -0700)]
Remove tcp_hostcache.h.  Everything is private.

Reviewed by: rscheff

3 years agotcp: Prepare PRR to work with NewReno LossRecovery
Richard Scheffenegger [Thu, 8 Apr 2021 16:52:20 +0000 (18:52 +0200)]
tcp: Prepare PRR to work with NewReno LossRecovery

Add proper PRR vnet declarations for consistency.
Also add pointer to tcpopt struct to tcp_do_prr_ack, in preparation
for it to deal with non-SACK window reduction (after loss).

No functional change.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29440

3 years agoAvoid -pedantic warnings about using _Generic in __fp_type_select
Dimitry Andric [Thu, 8 Apr 2021 11:13:15 +0000 (13:13 +0200)]
Avoid -pedantic warnings about using _Generic in __fp_type_select

When compiling parts of math.h with clang using a C standard before C11,
and using -pedantic, it will result in warnings similar to:

bug254714.c:5:11: warning: '_Generic' is a C11 extension [-Wc11-extensions]
  return !isfinite(1.0);
          ^
/usr/include/math.h:111:21: note: expanded from macro 'isfinite'
                    ^
/usr/include/math.h:82:39: note: expanded from macro '__fp_type_select'
                                      ^

This is because the block that enables use of _Generic is conditional
not only on C11, but also on whether the compiler advertises support for
C generic selections via __has_extension(c_generic_selections).

To work around the warning without having to pessimize the code, use the
__extension__ keyword, which is supported by both clang and gcc. While
here, remove the check for __clang__, as _Generic has been supported for
a long time by gcc too now.

Reported by: yuri
PR: 254714
MFC after: 1 week

3 years agobhyve: fix regression in legacy virtio-9p config parsing
Roman Bogorodskiy [Thu, 8 Apr 2021 14:44:58 +0000 (18:44 +0400)]
bhyve: fix regression in legacy virtio-9p config parsing

Commit 621b5090487de9fed1b503769702a9a2a27cc7bb introduced a regression
in legacy virtio-9p config parsing by not initializing *sharename to
NULL. As a result, "sharename != NULL" check in the first iteration fails
and bhyve exits with "virtio-9p: more than one share name given".

Fix by adding NULL back.

Approved by: grehan

3 years ago[tcp] Fix ECN on finalizing sessions.
Richard Scheffenegger [Thu, 8 Apr 2021 12:50:34 +0000 (14:50 +0200)]
[tcp] Fix ECN on finalizing sessions.

A subtle oversight would subtly change new data packets
sent after a shutdown() or close() call, while the send
buffer is still draining.

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

3 years agoClean up the style in the arm64 bus.h
Andrew Turner [Thu, 8 Apr 2021 09:41:23 +0000 (09:41 +0000)]
Clean up the style in the arm64 bus.h

MFC after: 2 weeks
Sponsored by: Innovate UK

3 years agoarm64: clear debug register state on fork
Mitchell Horne [Wed, 7 Apr 2021 19:23:46 +0000 (16:23 -0300)]
arm64: clear debug register state on fork

Following the analogous change for amd64 and i386 in 8223717ce62c,
ensure that new processes start with these registers inactive.

PR: 254661
Reported by: Michał Górny
Reviewed by: kib, emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29630

3 years agopf: Remove unused variable rt_listid from struct pf_krule
Kristof Provost [Thu, 8 Apr 2021 09:08:33 +0000 (11:08 +0200)]
pf: Remove unused variable rt_listid from struct pf_krule

Reviewed by: donner
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29639

3 years agovfs: replace vfs_smr_quiesce with vfs_smr_synchronize
Mateusz Guzik [Thu, 8 Apr 2021 07:08:41 +0000 (07:08 +0000)]
vfs: replace vfs_smr_quiesce with vfs_smr_synchronize

This ends up using a smr specific method.

Suggested by: markj
Tested by: pho

3 years agoRemove the last users of ARM_TP_ADDRESS
Andrew Turner [Wed, 7 Apr 2021 10:29:03 +0000 (10:29 +0000)]
Remove the last users of ARM_TP_ADDRESS

This was only needed on 32-bit arm prior to ARMv6. As we only support
ARMv6 or later remove it.

Reviewed by: mannu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D29624

3 years agoarm64: Fix finding the pmc event ID
Andrew Turner [Thu, 1 Apr 2021 14:38:09 +0000 (14:38 +0000)]
arm64: Fix finding the pmc event ID

The lower pmc event bits were masked off to find the PMC event ID.
The doesn't work when there are more events. Switch it to use the
offser relative to the first event while also checking the ID is
in the expected range.

Reviewed by: gnn, ray
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D29600

3 years agoDiscard the arm64 VFP state before resetting it
Andrew Turner [Tue, 23 Mar 2021 18:23:47 +0000 (18:23 +0000)]
Discard the arm64 VFP state before resetting it

When resetting the VFP state we need to discard any old state so we don't
try to save it on a context switch. Move this first so resetting the pcb
is safe to perform outside a critical section.

Reviewed by: arichardson
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D29401

3 years agonetmap: vtnet: add support for netmap offsets
Vincenzo Maffione [Wed, 7 Apr 2021 21:32:20 +0000 (21:32 +0000)]
netmap: vtnet: add support for netmap offsets

Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998.
This change adds support for netmap offsets.

3 years agoipmi,smbios: move smbios_walk_table to smbios.h
Greg V [Wed, 7 Apr 2021 20:05:49 +0000 (15:05 -0500)]
ipmi,smbios: move smbios_walk_table to smbios.h

This function will be used for exposing DMI info as sysctls in the
smbios module (in an upcoming review).

While here, add __packed to the structs.

Reviewed by: dab
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29270

3 years agosmbios: support getting address from EFI
Greg V [Wed, 7 Apr 2021 19:46:29 +0000 (14:46 -0500)]
smbios: support getting address from EFI

On some systems (e.g. Lenovo ThinkPad X240, Apple MacBookPro12,1)
the SMBIOS entry point is not found in the <0xFFFFF space.

Follow the SMBIOS spec and use the EFI Configuration Table for
locating the entry point on EFI systems.

Reviewed by: rpokala, dab
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29276

3 years agoshared shadow vm object invalidation regression test
Ryan Libby [Wed, 7 Apr 2021 19:39:05 +0000 (12:39 -0700)]
shared shadow vm object invalidation regression test

Add a regression test for a scenario where a shadow vm object is shared
by multiple mappings.  If a page COW occurs through one of the mappings,
then the virtual-to-physical mapping may become invalidated.

This tests the scenario from CVE-2021-29626 which was fixed by
982693bb729badac4e65ecd59772979f2849a2b2.

Reviewed by: markj
Sponsored by: Dell EMC Isilon

3 years agofileargs: fix double caching of the same file
Mariusz Zaborski [Wed, 7 Apr 2021 19:12:52 +0000 (21:12 +0200)]
fileargs: fix double caching of the same file

In situations when the current file name wasn't the first element on
the list we were cleaning the current name too early.
This might cause us to pre-cache the same file twice.

3 years agoAdd IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers.
Alexander Motin [Wed, 7 Apr 2021 19:03:36 +0000 (15:03 -0400)]
Add IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers.

MFC after: 1 week

3 years agoLoader: support booting OS from memory disk (MD)
Yongbo Yao [Wed, 7 Apr 2021 18:33:22 +0000 (13:33 -0500)]
Loader: support booting OS from memory disk (MD)

Until now, the boot image can be embedded into the loader with
/sys/tools/embed_mfs.sh, and memory disk (MD) is already supported
in loader source. But due to memory disk (MD) driver isn't registered
to the loader yet, the boot image can't be boot from embedded memory
disk.

Reviewed by: dab, tsoome
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29512

3 years agoRemove more remnants of sio(4)
Mark Johnston [Wed, 7 Apr 2021 18:21:07 +0000 (14:21 -0400)]
Remove more remnants of sio(4)

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

3 years agocapsicum: Limit socket operations in capability mode
Mark Johnston [Wed, 7 Apr 2021 18:19:52 +0000 (14:19 -0400)]
capsicum: Limit socket operations in capability mode

Capsicum did not prevent certain privileged networking operations,
specifically creation of raw sockets and network configuration ioctls.
However, these facilities can be used to circumvent some of the
restrictions that capability mode is supposed to enforce.

Add capability mode checks to disallow network configuration ioctls and
creation of sockets other than PF_LOCAL and SOCK_DGRAM/STREAM/SEQPACKET
internet sockets.

Reviewed by: oshogbo
Discussed with: emaste
Reported by: manu
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29423

3 years agouefisign: handle empty sections
Eric van Gyzen [Tue, 6 Apr 2021 14:42:20 +0000 (09:42 -0500)]
uefisign: handle empty sections

loader.efi has an empty set_Xfic section.  Handle it correctly.

```
Sections:
Idx Name          Size      VMA               LMA               File off  Algn
[...]
3 set_Xcom      00000168  00000000000d4000  00000000000d4000  000d0e00  2**2
      CONTENTS, ALLOC, LOAD, DATA
4 set_Xfic      00000000  00000000000d4168  00000000000d4168  00000000  2**2
      ALLOC, LOAD, DATA
5 .sdata        00000448  00000000000d5000  00000000000d5000  000d1000  2**2
      CONTENTS, ALLOC, LOAD, DATA
[...]
```

Reviewed by: trasz, dab
Reported by: andy.y.liu@dell.com
Tested by: andy.y.liu@dell.com
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29606

3 years agoipfw: update man page example for nat show log
Roman Bogorodskiy [Wed, 7 Apr 2021 15:37:46 +0000 (15:37 +0000)]
ipfw: update man page example for nat show log

In d6164b77f8b779cd7357387dcfcd3407f1457579 the ability to show
ranges of nat log entries was removed.

PR: 254192
Reviewed by: allanjude

3 years agopf tests: Test multi-wan rdr
Kristof Provost [Tue, 6 Apr 2021 11:25:49 +0000 (13:25 +0200)]
pf tests: Test multi-wan rdr

This replicates an issue observed on pfSense: https://redmine.pfsense.org/issues/11436

In essence, reply-to is needed to ensure that connections always leave
the WAN interface they came in on, but this confused the state tracking.

MFC after: 2 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: Do not short-circuit processing for REPLY_TO
Kristof Provost [Wed, 7 Apr 2021 13:46:44 +0000 (15:46 +0200)]
pf: Do not short-circuit processing for REPLY_TO

When we find a state for packets that was created by a reply-to rule we
still need to process the packet. The state may require us to modify the
packet (e.g. in rdr or nat cases), which we won't do with the shortcut.

MFC after: 2 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agolibnv: Allow use in non-sleepable contexts
Kristof Provost [Thu, 25 Mar 2021 12:59:14 +0000 (13:59 +0100)]
libnv: Allow use in non-sleepable contexts

44c125c4cebc2fd87c6260b90eddae11201f5232 switched the nvlist allocations
to be M_WAITOK, but this precludes the use in non-sleepable contexts.
(E.g. with a nonsleepable lock held).

All callers for these allocation functions already cope with memory
alloation failures, so there's no reason to allow sleeping during
allocations.

Reviewed by: melifaro, oshogbo
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29556

3 years agopf tests: make synproxy and nat work correctly even if inetd is running
Kurosawa Takahiro [Wed, 7 Apr 2021 06:17:51 +0000 (08:17 +0200)]
pf tests: make synproxy and nat work correctly even if inetd is running

tests/sys/netfil/pf/synproxy fails if inetd has been running
outside of the jail because pidfile_open() fails with EEXIST.
tests/sys/netfil/pf/nat has the same problem but the test succeeds
because whether inetd is running is not so important.

Fix the problem by changing the pidfile path from the default
location.

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

3 years agoDocument vnode_pager_setsize(9)
Ka Ho Ng [Wed, 7 Apr 2021 11:00:31 +0000 (19:00 +0800)]
Document vnode_pager_setsize(9)

MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Reviewed by: bcr
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29408

3 years agolibarchive: Make test_read_append_filter_wrong_program pass again
Alex Richardson [Wed, 7 Apr 2021 10:35:10 +0000 (11:35 +0100)]
libarchive: Make test_read_append_filter_wrong_program pass again

libarchive: Apply upstream commit a1b7bf8013fb7a11a486794247daae592db6f5ae

This fixes the failing test_read_append_filter_wrong_program test in CI
which has been failing since 01-Dec-2020.

Commit message from https://github.com/libarchive/libarchive/commit/a1b7bf8013fb7a11a486794247daae592db6f5ae

    Silence stderr in test_read_append_filter_program

    When the FreeBSD testsuite runs the libarchive tests it checks that stderr
    is empty. Since #1382 this is no longer the case. This change restores
    the behaviour of silencing bunzip2 stderr but doesn't bring back the
    output text check.

    Partially reverts 2e7aa5d9

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29036

3 years agotests/sys/net/routing: XFAIL the two failing tests
Alex Richardson [Wed, 7 Apr 2021 09:33:21 +0000 (10:33 +0100)]
tests/sys/net/routing: XFAIL the two failing tests

They have been failing for 1.5 months and the patch to fix them is stuck
in review so mark them as XFAIL for now to get Jenkins back to green.

To be reverted when https://reviews.freebsd.org/D28886 (or similar) is
commited.

Reviewed By: kp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29528

3 years agoadd Xr to the rc.d script...
John-Mark Gurney [Tue, 6 Apr 2021 23:32:57 +0000 (16:32 -0700)]
add Xr to the rc.d script...

3 years agoIntroduce "soft" serseq variant.
Alexander Motin [Tue, 6 Apr 2021 21:27:16 +0000 (17:27 -0400)]
Introduce "soft" serseq variant.

With new ZFS prefetcher improvements it is no longer needed to fully
serialize reads to reach decent prediction hit rate.  Softer variant
only creates small time window to reduce races instead of completely
blocking following reads while previous is running.  It much less
hurts the performance in case of prediction miss.

MFC after: 1 month

3 years agocache: update an assert on CACHE_FPL_STATUS_ABORTED
Mateusz Guzik [Tue, 6 Apr 2021 20:31:48 +0000 (22:31 +0200)]
cache: update an assert on CACHE_FPL_STATUS_ABORTED

Since symlink support it can get upgraded to CACHE_FPL_STATUS_DESTROYED.

Reported by: bdrewery

3 years agoports(7): update instructions for git
Rene Ladan [Tue, 6 Apr 2021 20:24:12 +0000 (22:24 +0200)]
ports(7): update instructions for git

Reviewed by: gjb, imp, lwhsu, mat
Differential Revision: https://reviews.freebsd.org/D29502

3 years agomount: Disallow mounting over a jail root
Mark Johnston [Mon, 5 Apr 2021 21:19:15 +0000 (17:19 -0400)]
mount: Disallow mounting over a jail root

Discussed with: jamie
Approved by: so
Security: CVE-2020-25584
Security: FreeBSD-SA-21:10.jail_mount

3 years agovm_fault: Shoot down multiply mapped COW source page mappings
Mark Johnston [Mon, 15 Mar 2021 20:02:17 +0000 (16:02 -0400)]
vm_fault: Shoot down multiply mapped COW source page mappings

Reviewed by: kib, rlibby
Discussed with: alc
Approved by: so
Security: CVE-2021-29626
Security: FreeBSD-SA-21:08.vm

3 years agoAllocate extra inodes in makefs when leaving free space in UFS images.
Nathan Whitehorn [Tue, 6 Apr 2021 17:43:29 +0000 (13:43 -0400)]
Allocate extra inodes in makefs when leaving free space in UFS images.

By default, makefs(8) has very few spare inodes in its output images,
which is fine for static filesystems, but not so great for VM images
where many more files will be added. Make makefs(8) use the same
default settings as newfs(8) when creating images with free space --
there isn't much point to leaving free space on the image if you
can't put files there. If no free space is requested, use current
behavior of a minimal number of available inodes.

Reviewed by: manu
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D29492

3 years agouefisign: fix handling of errors from child proc
Eric van Gyzen [Tue, 6 Apr 2021 14:36:52 +0000 (09:36 -0500)]
uefisign: fix handling of errors from child proc

Close the unused pipe file descriptors so the parent will notice if
the child exits prematurely.  Previously, the parent would block
forever on a read from the pipe.

    $ uefisign -c foo.cert -k foo.key -o loader.efi loader.efi.unsigned
    uefisign: section points inside the headers
    load: 0.06  cmd: uefisign 4502 [piperd] 7.25r 0.00u 0.00s 0% 5968k
    ... _sleep+0x1be pipe_read+0x3d6 kern_readv+0x8c sys_read+0x83 ...

Reviewed by: trasz
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29605

3 years agopci_user: fix build for 32-bit platforms
Marcin Wojtas [Tue, 6 Apr 2021 16:50:36 +0000 (18:50 +0200)]
pci_user: fix build for 32-bit platforms

Commit: f2f1ab39c040 ("pci_user: call bus_translate_resource before BAR mmap")
broke build for 32-bit platforms due to rman_res_t and vm_paddr_t
incompatible types. Fix that.

3 years agopci_user: call bus_translate_resource before BAR mmap
Marcin Wojtas [Tue, 6 Apr 2021 15:10:04 +0000 (17:10 +0200)]
pci_user: call bus_translate_resource before BAR mmap

On some armv8 machines it is possible that the mapping between CPU
and PCI bus BAR base addresses is not 1:1. In case a BAR is allocated
in kernel using bus_alloc_resource_any this translation is handled in
ofw_pci_activate_resource.

Do the same in pci_user.c by calling bus_translate_resource devmethod.
This fixes mmaping BARs to userspace on Marvell SoCs (Armada 7k8k/CN913x)
and possibly many other platforms.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Marvell
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29604

3 years agopciconf: Use VM_MEMATTR_DEVICE on supported architectures
Marcin Wojtas [Tue, 6 Apr 2021 15:00:05 +0000 (17:00 +0200)]
pciconf: Use VM_MEMATTR_DEVICE on supported architectures

Some architectures - armv7, armv8 and riscv use VM_MEMATTR_DEVICE
when mapping device registers in kernel. Do the same in pciconf.
On armada8k SoC all reads from BARs mapped with hitherto attribute
(VM_MEMATTR_UNCACHEABLE) return 0xff's.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Marvell
Differential revision: https://reviews.freebsd.org/D29603

3 years agopci_dw: fix outbound I/O window configuration
Marcin Wojtas [Tue, 6 Apr 2021 12:31:39 +0000 (14:31 +0200)]
pci_dw: fix outbound I/O window configuration

Use viewport "2" instead of "0" and change window type from MEM to IO.
Without these changes the MEM ATU window can be overwritten with the IO one.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Marvell
Differential revision: https://reviews.freebsd.org/D29516

3 years agopowerpc64: add missing TLB invalidations to radix
Leandro Lupori [Tue, 6 Apr 2021 11:31:44 +0000 (08:31 -0300)]
powerpc64: add missing TLB invalidations to radix

Radix MMU code was missing TLB invalidations when some Level 3 PDEs were
modified. This caused TLB multi-hit machine check interrupts when
superpages were enabled.

Reviewed by: jhibbits
MFC after: 2 weeks
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D29511

3 years agoAdd Siemens SITOP UPS500S usb device
Poul-Henning Kamp [Tue, 6 Apr 2021 10:56:27 +0000 (10:56 +0000)]
Add Siemens SITOP UPS500S usb device