]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agopms(4): Do not return CAM_REQ_CMP on errors.
Alexander Motin [Fri, 16 Apr 2021 19:16:09 +0000 (15:16 -0400)]
pms(4): Do not return CAM_REQ_CMP on errors.

It is a direct request for data corruptions, one report of which we
have received.  I am very surprised that only one.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agolinux: support AT_EMPTY_PATH flag in fchownat(2)
Edward Tomasz Napierala [Fri, 16 Apr 2021 15:26:43 +0000 (16:26 +0100)]
linux: support AT_EMPTY_PATH flag in fchownat(2)

This fixes rsyslog package installation scripts in Bionic.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29108

3 years agolinux: make fstatat(2) handle AT_EMPTY_PATH
Edward Tomasz Napierala [Fri, 16 Apr 2021 07:52:59 +0000 (08:52 +0100)]
linux: make fstatat(2) handle AT_EMPTY_PATH

Without it, Qt5 apps from Focal fail to start, being unable to load
their plugins.  It's also necessary for glibc 2.33, as found in recent
Arch snapshots.

PR: 254112
Reviewed By: kib
Sponsored by: The FreeBSD Foundation, EPSRC
Differential Revision: https://reviews.freebsd.org/D28192

3 years agoipfw: do not use sleepable malloc in callout context.
Andrey V. Elsukov [Fri, 16 Apr 2021 07:22:44 +0000 (10:22 +0300)]
ipfw: do not use sleepable malloc in callout context.

Use M_NOWAIT flag when hash growing is called from callout.

PR:             255041
Reviewed by: kevans
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D29772

3 years agoifconfig: Reuse media state in ifmedia_getstate
Ryan Moeller [Fri, 16 Apr 2021 02:32:25 +0000 (22:32 -0400)]
ifconfig: Reuse media state in ifmedia_getstate

This restores behavior lost in code cleanup, fixing a regression after
2803fa471e77dc8f227fe00bbf075de7feb10022 where changing media options
only applies some of the changes, not all.

Reported by: np
Reviewed by: donner
MFC after: immediately
Differential Revision: https://reviews.freebsd.org/D29741

3 years agomodules: remove stale if_wg reference
Kyle Evans [Fri, 16 Apr 2021 00:59:13 +0000 (19:59 -0500)]
modules: remove stale if_wg reference

This variable isn't being used anywhere, remove it.

3 years agofwip(4): fixing kernel panic when receiving unicast packet
Tai-hwa Liang [Thu, 15 Apr 2021 14:24:14 +0000 (14:24 +0000)]
fwip(4): fixing kernel panic when receiving unicast packet

Wrapping fwip_unicast_input() with NET_EPOCH_{ENTER,EXIT} to avoid a
NET_EPOCH_ASSERT() in netisr_dispatch().

Reviewed by: hselasky
MFC after: 2 weeks

3 years agosyncache.4: fix mandoc in cb8d7c44d6a
Gleb Smirnoff [Thu, 15 Apr 2021 22:50:01 +0000 (15:50 -0700)]
syncache.4: fix mandoc in cb8d7c44d6a

Noticed by: brueffer

3 years agotcp_syncache: add net.inet.tcp.syncache.see_other sysctl
Gleb Smirnoff [Fri, 19 Mar 2021 07:22:36 +0000 (00:22 -0700)]
tcp_syncache: add net.inet.tcp.syncache.see_other sysctl

A security feature from c06f087ccb12 appeared to be a huge bottleneck
under SYN flood. To mitigate that add a sysctl that would make
syncache(4) globally visible, ignoring UID/GID, jail(2) and mac(4)
checks. When turned on, we won't need to call crhold() on the listening
socket credential for every incoming SYN packet.

Reviewed by: bz

3 years agoRevert "nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661"
Rick Macklem [Thu, 15 Apr 2021 21:08:40 +0000 (14:08 -0700)]
Revert "nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661"

This reverts commit 9edaceca8165e2864267547311daf145bb520270.

It turns out that the Linux client intentionally does an NFSv4.1
RPC with only a Sequence operation in it and with "seqid + 1"
for the slot.  This is used to re-synchronize the slot's seqid
and the client expects the NFS4ERR_SEQ_MISORDERED error reply.

As such, revert the patch, so that the server remains RFC5661
compliant.

3 years agoAdd batched update support for the fib algo.
Alexander V. Chernikov [Fri, 9 Apr 2021 21:30:10 +0000 (22:30 +0100)]
Add batched update support for the fib algo.

Initial fib algo implementation was build on a very simple set of
 principles w.r.t updates:

1) algorithm is ether able to apply the change synchronously (DIR24-8)
 or requires full rebuild (bsearch, lradix).
2) framework falls back to rebuild on every error (memory allocation,
 nhg limit, other internal algo errors, etc).

This changes brings the new "intermediate" concept - batched updates.
Algotirhm can indicate that the particular update has to be handled in
 batched fashion (FLM_BATCH).
The framework will write this update and other updates to the temporary
 buffer instead of pushing them to the algo callback.
Depending on the update rate, the framework will batch 50..1024 ms of updates
 and submit them to a different algo callback.

This functionality is handy for the slow-to-rebuild algorithms like DXR.

Differential Revision: https://reviews.freebsd.org/D29588
Reviewed by: zec
MFC after: 2 weeks

3 years agoe1000: Restore VF interface random MAC
Kevin Bowling [Thu, 15 Apr 2021 18:45:02 +0000 (11:45 -0700)]
e1000: Restore VF interface random MAC

Restore 525e07418c77 after the iflib conversion of igb(4). This
reenables random MAC address generation when attaching to a VF with a
zeroed MAC.

PR: 253535
Reported by: Balaev PA <mail@void.so>
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29785

3 years agoe1000: fix em_mac_min and 82547 packet buffer
Kevin Bowling [Thu, 15 Apr 2021 16:58:36 +0000 (09:58 -0700)]
e1000: fix em_mac_min and 82547 packet buffer

The boundary differentiating "lem" vs "em" class devices was wrong
after the iflib conversion of lem(4).

The Packet Buffer size for 82547 class chips was not set correctly
after the iflib conversion of lem(4).

These changes restore functionality on an 82547 for the submitter.

PR: 236119
Reported by: Jeff Gibbons <jgibbons@protogate.com>
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29766

3 years agoe1000: disable hw.em.sbp debug setting
Kevin Bowling [Thu, 15 Apr 2021 16:48:41 +0000 (09:48 -0700)]
e1000: disable hw.em.sbp debug setting

This is a debugging tunable that shouldn't have retained this setting
after the initial iflib conversion of the driver

PR: 248934
Reported by: Franco Fichtner <franco@opnsense.org>
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29768

3 years agoRemove XFAIL from tests/lib/msun/lround_test:main
Alex Richardson [Thu, 15 Apr 2021 15:07:58 +0000 (16:07 +0100)]
Remove XFAIL from tests/lib/msun/lround_test:main

This test no longer fails after 3b00222f156dca5700c839d73e36daf479fa640c.

PR: 205451
MFC after: 1 week

3 years agoRemove amd64 XFAIL from tests/lib/msun/fma_test:infinities
Alex Richardson [Thu, 15 Apr 2021 15:04:19 +0000 (16:04 +0100)]
Remove amd64 XFAIL from tests/lib/msun/fma_test:infinities

This test no longer fails after 3b00222f156dca5700c839d73e36daf479fa640c.

PR: 205448
MFC after: 1 week

3 years agolib/msun: Exclude ignored-pragmas from -Werror
Alex Richardson [Thu, 15 Apr 2021 15:27:52 +0000 (16:27 +0100)]
lib/msun: Exclude ignored-pragmas from -Werror

This avoids build failures due to the clang 12 warning:
    '#pragma FENV_ACCESS' is not supported on this target - ignored

Clang 12 currently emits this warning for all non-x86 architectures.
While this can result in incorrect code generation (e.g. on AArch64 some
exceptions are not raised as expected), this is a pre-existing issue and
we should not fail the build due to this warning.

Reviewed By: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29743

3 years agolinux: implement O_PATH
Edward Tomasz Napierala [Thu, 15 Apr 2021 14:24:51 +0000 (15:24 +0100)]
linux: implement O_PATH

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29773

3 years agong_ubt: Block attachment of uninitialized Intel Wireless 7265
Vladimir Kondratyev [Thu, 15 Apr 2021 14:26:32 +0000 (17:26 +0300)]
ng_ubt: Block attachment of uninitialized Intel Wireless 7265

As this controller requires firmware patch downloading to operate.
"Intel Wireless 7265" support in iwmbtfw(8) is yet to be done.

Tested by: arrowd et al
PR: 228787
MFC after: 2 weeks

3 years agong_ubt: Use DEFINE_CLASS_1 macro for kobj inheritance.
Vladimir Kondratyev [Thu, 15 Apr 2021 14:25:50 +0000 (17:25 +0300)]
ng_ubt: Use DEFINE_CLASS_1 macro for kobj inheritance.

MFC after: 2 weeks

3 years agong_ubt: Do not clear stall before receiving of HCI command response.
Vladimir Kondratyev [Thu, 15 Apr 2021 14:25:00 +0000 (17:25 +0300)]
ng_ubt: Do not clear stall before receiving of HCI command response.

Unconditional execution of "clear feature" request at SETUP stage was
workaround for probe failures on ng_ubt.ko re-kldloading which is
unnecessary now.

Reviewed by: hselasky
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29775

3 years agolinux: extend the LINUX_O_ constants to make room for O_PATH
Edward Tomasz Napierala [Thu, 15 Apr 2021 13:38:58 +0000 (14:38 +0100)]
linux: extend the LINUX_O_ constants to make room for O_PATH

No functional changes.

Sponsored By: EPSRC

3 years agoAdd some regression tests for O_PATH and AT_EMPTY_PATH
Mark Johnston [Thu, 15 Apr 2021 13:40:57 +0000 (09:40 -0400)]
Add some regression tests for O_PATH and AT_EMPTY_PATH

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29719

3 years agob_vflags update requries bufobj lock
Konstantin Belousov [Tue, 13 Apr 2021 10:22:56 +0000 (13:22 +0300)]
b_vflags update requries bufobj lock

The trunc_dependencies() issue was reported by Alexander Lochmann
<alexander.lochmann@tu-dortmund.de>, who found the problem by performing
lock analysis using LockDoc, see https://doi.org/10.1145/3302424.3303948.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agolpd: Update SYNOPSIS with new flag
Chris Rees [Thu, 15 Apr 2021 12:26:10 +0000 (13:26 +0100)]
lpd: Update SYNOPSIS with new flag

Reported by: 0mp

3 years agoFix build with WITHOUT_AUDIT=yes in src.conf
Emmanuel Vadot [Thu, 15 Apr 2021 12:11:13 +0000 (14:11 +0200)]
Fix build with WITHOUT_AUDIT=yes in src.conf

Always install the audit related includes are some part of the source
always requires them.

Reported by: many
Fixes: 8c3eaf244a417a4

3 years agolpd.8: Chase Dd-- took old value when merging
Chris Rees [Thu, 15 Apr 2021 11:40:16 +0000 (12:40 +0100)]
lpd.8: Chase Dd-- took old value when merging

3 years agolpd: Add -F flag to prevent daemonizing
Chris Rees [Sat, 3 Apr 2021 17:51:56 +0000 (18:51 +0100)]
lpd: Add -F flag to prevent daemonizing

This is necessary for use with supervision, e.g. runit.

I chose -F simply because that is what the folks at LPRng use.

Approved by: pfg, gad, ngie
Differential Revision: https://reviews.freebsd.org/D29566

3 years agoO_PATH: allow vnode kevent filter on such files
Konstantin Belousov [Wed, 7 Apr 2021 18:31:48 +0000 (21:31 +0300)]
O_PATH: allow vnode kevent filter on such files

if VREAD access is checked as allowed during open

Requested by: wulf
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29323

3 years agoO_PATH: Allow to open symlink
Konstantin Belousov [Wed, 7 Apr 2021 03:23:25 +0000 (06:23 +0300)]
O_PATH: Allow to open symlink

When O_NOFOLLOW is specified, namei() returns the symlink itself.  In
this case, open(O_PATH) should be allowed, to denote the location of symlink
itself.

Prevent O_EXEC in this case, execve(2) code is not ready to try to execute
symlinks.

Reported by: wulf
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29323

3 years agoMake files opened with O_PATH to not block non-forced unmount
Konstantin Belousov [Sat, 3 Apr 2021 18:55:11 +0000 (21:55 +0300)]
Make files opened with O_PATH to not block non-forced unmount

by only keeping hold count on the vnode, instead of the use count.

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

3 years agoopen(2): Implement O_PATH
Konstantin Belousov [Thu, 18 Mar 2021 10:41:47 +0000 (12:41 +0200)]
open(2): Implement O_PATH

Reviewed by: markj
Tested by: pho
Discussed with: walker.aj325_gmail.com, wulf
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29323

3 years agoAdd AT_EMPTY_PATH for several *at(2) syscalls
Konstantin Belousov [Sun, 7 Mar 2021 14:29:09 +0000 (16:29 +0200)]
Add AT_EMPTY_PATH for several *at(2) syscalls

It is currently allowed to fchownat(2), fchmodat(2), fchflagsat(2),
utimensat(2), fstatat(2), and linkat(2).

For linkat(2), PRIV_VFS_FHOPEN privilege is required to exercise the flag.
It allows to link any open file.

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

3 years agoAT_RESOLVE_BENEATH is bsd-specific
Konstantin Belousov [Thu, 11 Mar 2021 15:07:02 +0000 (17:07 +0200)]
AT_RESOLVE_BENEATH is bsd-specific

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

3 years agovfs_vnops.c: Make vn_statfile() non-static
Konstantin Belousov [Thu, 18 Mar 2021 10:41:07 +0000 (12:41 +0200)]
vfs_vnops.c: Make vn_statfile() non-static

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

3 years agoStyle.
Konstantin Belousov [Thu, 18 Mar 2021 10:40:20 +0000 (12:40 +0200)]
Style.

Add missed spaces, wrap long lines.

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

3 years agolink(2): correct descriptor name in AT_RESOLVE_BENEATH description
Konstantin Belousov [Tue, 30 Mar 2021 21:56:28 +0000 (00:56 +0300)]
link(2): correct descriptor name in AT_RESOLVE_BENEATH description

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D29111

3 years agocache: extend mismatch vnode assert print to include the name
Mateusz Guzik [Thu, 15 Apr 2021 07:55:43 +0000 (07:55 +0000)]
cache: extend mismatch vnode assert print to include the name

3 years agobhyve: implement rdmsr for MSR_IA32_FEATURE_CONTROL
Corvin Köhne [Thu, 15 Apr 2021 03:49:19 +0000 (13:49 +1000)]
bhyve: implement rdmsr for MSR_IA32_FEATURE_CONTROL

Without the -w option, Windows guests crash on boot. This is caused by a rdmsr
of MSR_IA32_FEATURE_CONTROL. Windows checks this MSR to determine enabled VMX
features. This MSR isn't emulated in bhyve, so a #GP exception is injected
which causes Windows to crash.

Fix by returning a rdmsr of MSR_IA32_FEATURE_CONTROL with Lock Bit set and
VMX disabled to informWindows that VMX isn't available.

Reviewed by: jhb, grehan (bhyve)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29665

3 years agoEnsure that the mount command shows "with quotas" when quotas are enabled.
Kirk McKusick [Wed, 14 Apr 2021 22:22:12 +0000 (15:22 -0700)]
Ensure that the mount command shows "with quotas" when quotas are enabled.

When quotas are enabled with the quotaon(8) command, it sets the
MNT_QUOTA flag in the mount structure mnt_flag field. The mount
structure holds a cached copy of the filesystem statfs structure
in mnt_stat that includes a copy of the mnt_flag field in
mnt_stat.f_flags. The mnt_stat structure may not be updated for
hours. Since the mount command requests mount details using the
MNT_NOWAIT option, it gets the mount's mnt_stat statfs structure
whose f_flags field does not yet show the MNT_QUOTA flag being set
in mnt_flag.

The fix is to have quotaon(8) set the MNT_QUOTA flag in both mnt_flag
and in mnt_stat.f_flags so that it will be immediately visible to
callers of statfs(2).

Reported by:  Christos Chatzaras
Tested by:    Christos Chatzaras
PR:           254682
MFC after:    3 days
Sponsored by: Netflix

3 years agohidmap: add missing opt_hid.h to module Makefile
Vladimir Kondratyev [Wed, 14 Apr 2021 19:55:52 +0000 (22:55 +0300)]
hidmap: add missing opt_hid.h to module Makefile

Reported by: pstef
MFC after: 2 weeks

3 years agoRevert "config(8): Correct the mentioned paper in the SEE ALSO section"
Gordon Bergling [Wed, 14 Apr 2021 18:22:48 +0000 (20:22 +0200)]
Revert "config(8): Correct the mentioned paper in the SEE ALSO section"

config(8) was first imported from 4.4BSD.

Reported by: rgrimes

This reverts commit e6ab1e365c06559e964667d2f5a6de856fa28be6.

3 years agouma: Introduce per-domain reclamation functions
Mark Johnston [Wed, 14 Apr 2021 16:57:24 +0000 (12:57 -0400)]
uma: Introduce per-domain reclamation functions

Make it possible to reclaim items from a specific NUMA domain.

- Add uma_zone_reclaim_domain() and uma_reclaim_domain().
- Permit parallel reclamations.  Use a counter instead of a flag to
  synchronize with zone_dtor().
- Use the zone lock to protect cache_shrink() now that parallel reclaims
  can happen.
- Add a sysctl that can be used to trigger reclamation from a specific
  domain.

Currently the new KPIs are unused, so there should be no functional
change.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29685

3 years agouma: Split bucket_cache_drain() to permit per-domain reclamation
Mark Johnston [Fri, 9 Apr 2021 13:47:09 +0000 (09:47 -0400)]
uma: Split bucket_cache_drain() to permit per-domain reclamation

Note that the per-domain variant does not shrink the target bucket size.

No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agodomainset: Define additional global policies
Mark Johnston [Wed, 14 Apr 2021 16:56:39 +0000 (12:56 -0400)]
domainset: Define additional global policies

Add global definitions for first-touch and interleave policies.  The
former may be useful for UMA, which implements a similar policy without
using domainset iterators.

No functional change intended.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29104

3 years agoossl(4): Install the man page also for arm64
Gordon Bergling [Wed, 14 Apr 2021 16:32:56 +0000 (18:32 +0200)]
ossl(4): Install the man page also for arm64

In 22bd0c9731d7 ossl(4) was ported to arm64. The manual page was
adapted, but never installed since the ossl(4) manual page was
i386 / amd64 only.

Reviewed by: mhorne
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29762

3 years agoexpand @TPUT@ in ncurses manpages
Yuri Pankov [Wed, 14 Apr 2021 15:16:59 +0000 (18:16 +0300)]
expand @TPUT@ in ncurses manpages

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29761

3 years agoarm: Add no-cftconvert for sdma-imx6 files
Emmanuel Vadot [Wed, 14 Apr 2021 13:43:37 +0000 (15:43 +0200)]
arm: Add no-cftconvert for sdma-imx6 files

Fixes a warning when building kernel:
ctfconvert: file.c: Couldn't read ehdr: Invalid argument

MFC after: 3 days

3 years agopf tests: Test clearing rules counters
Kristof Provost [Mon, 12 Apr 2021 15:29:19 +0000 (17:29 +0200)]
pf tests: Test clearing rules counters

This was briefly broken, so ensure that we can read and clear rules
counters.

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

3 years agopfctl: Fix clearing rules counters
Kristof Provost [Mon, 12 Apr 2021 15:23:33 +0000 (17:23 +0200)]
pfctl: Fix clearing rules counters

After the migration to libpfctl for rule retrieval we accidentally lost
support for clearing the rules counters.

Introduce a get_clear variant of pfctl_get_rule() which allows rules
counters to be cleared.

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

3 years agozfs: merge openzfs/zfs@3522f57b6 (master)
Martin Matuska [Wed, 14 Apr 2021 10:49:10 +0000 (12:49 +0200)]
zfs: merge openzfs/zfs@3522f57b6 (master)

Notable upstream pull request merges:
  #11742 When specifying raidz vdev name, parity count should match
  #11744 Use a helper function to clarify gang block size
  #11771 Support running FreeBSD buildworld on Arm-based macOS hosts

This is the last update that will be MFCed into stable/13.

From now on, the tracking of OpenZFS branches will be different:
- main continues tracking openzfs/zfs/master
- stable/13 is going to track openzfs/zfs/zfs-2.1-release

Obtained from: OpenZFS
MFC after: 1 week

3 years agopchtherm: Add IDs for CannonLake-H, CometLake and Lewisburg controllers
Vladimir Kondratyev [Wed, 14 Apr 2021 10:03:18 +0000 (13:03 +0300)]
pchtherm: Add IDs for CannonLake-H, CometLake and Lewisburg controllers

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

3 years agofilt_timerexpire: avoid process lock recursion
Konstantin Belousov [Tue, 13 Apr 2021 14:25:11 +0000 (17:25 +0300)]
filt_timerexpire: avoid process lock recursion

Found by: syzkaller
Reported and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29746

3 years agorealtimer_expire: avoid proc lock recursion when called from itimer_proc_continue()
Konstantin Belousov [Tue, 13 Apr 2021 13:47:24 +0000 (16:47 +0300)]
realtimer_expire: avoid proc lock recursion when called from itimer_proc_continue()

It is fine to drop the process lock there, process cannot exit until its
timers are cleared.

Found by: syzkaller
Reported and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29746

3 years agopseudofs: limit writes to 1M
Konstantin Belousov [Tue, 13 Apr 2021 19:48:44 +0000 (22:48 +0300)]
pseudofs: limit writes to 1M

Noted and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29752

3 years agosbuf_uionew(): sbuf_new() takes int as length
Konstantin Belousov [Tue, 13 Apr 2021 19:12:19 +0000 (22:12 +0300)]
sbuf_uionew(): sbuf_new() takes int as length

and length should be not less than SBUF_MINSIZE

Reported and tested by: pho
Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29752

3 years agoUpdate vendor/openzfs to openzfs/zfs/master@3522f57b6
Martin Matuska [Wed, 14 Apr 2021 06:03:07 +0000 (08:03 +0200)]
Update vendor/openzfs to openzfs/zfs/master@3522f57b6

Notable upstream pull request merges:
  #11742 When specifying raidz vdev name, parity count should match
  #11744 Use a helper function to clarify gang block size
  #11771 Support running FreeBSD buildworld on Arm-based macOS hosts

3 years agoichsmb: Add PCI ID for Intel Gemini Lake SMBus controller
Vladimir Kondratyev [Tue, 13 Apr 2021 22:10:13 +0000 (01:10 +0300)]
ichsmb: Add PCI ID for Intel Gemini Lake SMBus controller

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

3 years agocxgbe(4): RSS hash for VXLAN traffic is computed from the inner frame.
Navdeep Parhar [Tue, 13 Apr 2021 23:50:12 +0000 (16:50 -0700)]
cxgbe(4): RSS hash for VXLAN traffic is computed from the inner frame.

Sponsored by: Chelsio Communications

3 years agoTOE: Use a read lock on the PCB for syncache_add().
John Baldwin [Tue, 13 Apr 2021 23:31:04 +0000 (16:31 -0700)]
TOE: Use a read lock on the PCB for syncache_add().

Reviewed by: np, glebius
Fixes: 08d9c9202755a30f97617758595214a530afcaea
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29739

3 years agoarp(8): fixing the deletion failure of IEEE1394 associated addresses
Tai-hwa Liang [Mon, 12 Apr 2021 06:27:03 +0000 (06:27 +0000)]
arp(8): fixing the deletion failure of IEEE1394 associated addresses

Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error:

arp: delete: cannot locate 10.0.0.71

Reviewed by: glebius
MFC after: 2 weeks

3 years agoif_firewire: fixing panic upon packet reception for VNET build
Tai-hwa Liang [Sat, 10 Apr 2021 15:32:27 +0000 (15:32 +0000)]
if_firewire: fixing panic upon packet reception for VNET build

netisr_dispatch_src() needs valid VNET pointer or firewire_input() will panic
when receiving a packet.

Reviewed by: glebius
MFC after: 2 weeks

3 years agocaroot: reroll the remaining certs
Kyle Evans [Tue, 13 Apr 2021 21:51:47 +0000 (16:51 -0500)]
caroot: reroll the remaining certs

This adds a specific note that these are explicitly trusted for
server auth.

MFC after: 3 days

3 years agocaroot: remove certs distrusted for server auth
Kyle Evans [Tue, 30 Mar 2021 03:01:05 +0000 (22:01 -0500)]
caroot: remove certs distrusted for server auth

- Fifteen (15) removed

MFC after: 3 days

3 years agocaroot: update CA bundle processor
Kyle Evans [Tue, 30 Mar 2021 03:05:38 +0000 (22:05 -0500)]
caroot: update CA bundle processor

Our current processor was identified as trusting cert not explicitly
marked for SERVER_AUTH, as well as certs that were tagged with
DISTRUST_AFTER.

Update the script to handle both scenarios. This patch was originally
authored by mandree@ for ports, and it was subsequently ported to base
caroot.

MFC after: 3 days

3 years agocaroot: routine cert update
Kyle Evans [Tue, 30 Mar 2021 02:56:40 +0000 (21:56 -0500)]
caroot: routine cert update

- Three (3) added
- Two (2) removed

MFC after: 3 days

3 years agomalloc: Add state transitions for KASAN
Mark Johnston [Tue, 13 Apr 2021 21:40:27 +0000 (17:40 -0400)]
malloc: Add state transitions for KASAN

- Reuse some REDZONE bits to keep track of the requested and allocated
  sizes, and use that to provide red zones.
- As in UMA, disable memory trashing to avoid unnecessary CPU overhead.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29461

3 years agoexecve: Mark exec argument buffers
Mark Johnston [Tue, 13 Apr 2021 21:40:19 +0000 (17:40 -0400)]
execve: Mark exec argument buffers

We cache mapped execve argument buffers to avoid the overhead of TLB
shootdowns.  Mark them invalid when they are freed to the cache.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29460

3 years agovfs: Add KASAN state transitions for vnodes
Mark Johnston [Tue, 13 Apr 2021 21:40:11 +0000 (17:40 -0400)]
vfs: Add KASAN state transitions for vnodes

vnodes are a bit special in that they may exist on per-CPU lists even
while free.  Add a KASAN-only destructor that poisons regions of each
vnode that are not expected to be accessed after a free.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29459

3 years agokmem: Add KASAN state transitions
Mark Johnston [Tue, 13 Apr 2021 21:40:01 +0000 (17:40 -0400)]
kmem: Add KASAN state transitions

Memory allocated with kmem_* is unmapped upon free, so KASAN doesn't
provide a lot of benefit, but since allocations are always a multiple of
the page size we can create a redzone when the allocation request size
is not a multiple of the page size.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29458

3 years agokstack: Add KASAN state transitions
Mark Johnston [Tue, 13 Apr 2021 21:39:55 +0000 (17:39 -0400)]
kstack: Add KASAN state transitions

We allocate kernel stacks using a UMA cache zone.  Cache zones have
KASAN disabled by default, but in this case it makes sense to enable it.

Reviewed by: andrew
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29457

3 years agouma: Add KASAN state transitions
Mark Johnston [Tue, 13 Apr 2021 21:39:50 +0000 (17:39 -0400)]
uma: Add KASAN state transitions

- Add a UMA_ZONE_NOKASAN flag to indicate that items from a particular
  zone should not be sanitized.  This is applied implicitly for NOFREE
  and cache zones.
- Add KASAN call backs which get invoked:
  1) when a slab is imported into a keg
  2) when an item is allocated from a zone
  3) when an item is freed to a zone
  4) when a slab is freed back to the VM

  In state transitions 1 and 3, memory is poisoned so that accesses will
  trigger a panic.  In state transitions 2 and 4, memory is marked
  valid.
- Disable trashing if KASAN is enabled.  It just adds extra CPU overhead
  to catch problems that are detected by KASAN.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29456

3 years agoamd64: Add MD bits for KASAN
Mark Johnston [Tue, 13 Apr 2021 21:39:35 +0000 (17:39 -0400)]
amd64: Add MD bits for KASAN

- Initialize KASAN before executing SYSINITs.
- Add a GENERIC-KASAN kernel config, akin to GENERIC-KCSAN.
- Increase the kernel stack size if KASAN is enabled.  Some of the
  ASAN instrumentation increases stack usage and it's enough to
  trigger stack overflows in ZFS.
- Mark the trapframe as valid in interrupt handlers if it is
  assigned to td_intr_frame.  Otherwise, an interrupt in a function
  which creates a poisoned alloca region can trigger false positives.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29455

3 years agoamd64: Implement a KASAN shadow map
Mark Johnston [Tue, 13 Apr 2021 20:30:05 +0000 (16:30 -0400)]
amd64: Implement a KASAN shadow map

The idea behind KASAN is to use a region of memory to track the validity
of buffers in the kernel map.  This region is the shadow map.  The
compiler inserts calls to the KASAN runtime for every emitted load
and store, and the runtime uses the shadow map to decide whether the
access is valid.  Various kernel allocators call kasan_mark() to update
the shadow map.

Since the shadow map tracks only accesses to the kernel map, accesses to
other kernel maps are not validated by KASAN.  UMA_MD_SMALL_ALLOC is
disabled when KASAN is configured to reduce usage of the direct map.
Currently we have no mechanism to completely eliminate uses of the
direct map, so KASAN's coverage is not comprehensive.

The shadow map uses one byte per eight bytes in the kernel map.  In
pmap_bootstrap() we create an initial set of page tables for the kernel
and preloaded data.

When pmap_growkernel() is called, we call kasan_shadow_map() to extend
the shadow map.  kasan_shadow_map() uses pmap_kasan_enter() to allocate
memory for the shadow region and map it.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29417

3 years agoAdd the KASAN runtime
Mark Johnston [Tue, 13 Apr 2021 21:39:19 +0000 (17:39 -0400)]
Add the KASAN runtime

KASAN enables the use of LLVM's AddressSanitizer in the kernel.  This
feature makes use of compiler instrumentation to validate memory
accesses in the kernel and detect several types of bugs, including
use-after-frees and out-of-bounds accesses.  It is particularly
effective when combined with test suites or syzkaller.  KASAN has high
CPU and memory usage overhead and so is not suited for production
environments.

The runtime and pmap maintain a shadow of the kernel map to store
information about the validity of memory mapped at a given kernel
address.

The runtime implements a number of functions defined by the compiler
ABI.  These are prefixed by __asan.  The compiler emits calls to
__asan_load*() and __asan_store*() around memory accesses, and the
runtime consults the shadow map to determine whether a given access is
valid.

kasan_mark() is called by various kernel allocators to update state in
the shadow map.  Updates to those allocators will come in subsequent
commits.

The runtime also defines various interceptors.  Some low-level routines
are implemented in assembly and are thus not amenable to compiler
instrumentation.  To handle this, the runtime implements these routines
on behalf of the rest of the kernel.  The sanitizer implementation
validates memory accesses manually before handing off to the real
implementation.

The sanitizer in a KASAN-configured kernel can be disabled by setting
the loader tunable debug.kasan.disable=1.

Obtained from: NetBSD
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29416

3 years agoAdd a KASAN option to the kernel build
Mark Johnston [Tue, 13 Apr 2021 20:29:47 +0000 (16:29 -0400)]
Add a KASAN option to the kernel build

LLVM support for enabling KASAN has not yet landed so the option is not
yet usable, but hopefully this will change soon.

Reviewed by: imp, andrew
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29454

3 years agoRemove reference to the pfctlinput2() from domain(9) after 237c1f932b.
Dmitry Chagin [Tue, 13 Apr 2021 21:40:20 +0000 (00:40 +0300)]
Remove reference to the pfctlinput2() from domain(9) after 237c1f932b.

Reviewed by: glebius
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D29751

3 years agoarm64: adjust comments in dbg_monitor_exit()
Mitchell Horne [Tue, 13 Apr 2021 17:34:58 +0000 (14:34 -0300)]
arm64: adjust comments in dbg_monitor_exit()

These comments were copied from dbg_monitor_enter(), but the intended
modifications weren't made. Update them to reflect what this code
actually does.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoarm64: clear debug registers after execve(2)
Mitchell Horne [Fri, 9 Apr 2021 14:13:21 +0000 (11:13 -0300)]
arm64: clear debug registers after execve(2)

This is both intuitive and required, as any previous breakpoint settings
may not be applicable to the new process.

Reported by: arichardson
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29672

3 years agoFix race in case of device destruction.
Alexander Motin [Tue, 13 Apr 2021 15:19:10 +0000 (11:19 -0400)]
Fix race in case of device destruction.

During device destruction it is possible that open() succeed, but
fdevname() return NULL, that can't be assigned to string variable.
Fix that by adding explicit NULL check.

Also while there switch from fdevname() to fdevname_r().

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

3 years agonfs client: depend on xdr
Konstantin Belousov [Tue, 13 Apr 2021 11:47:20 +0000 (14:47 +0300)]
nfs client: depend on xdr

Since 7763814fc9c27 nfsrpc_setclient() uses mem_alloc() that is macro
around malloc(M_RPC).  M_RPC is provided by xdr.ko.

Reviewed by: rmacklem
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

3 years agolinux: adjust ordering of Linux auxv and add dummy AT_HWCAP2
Edward Tomasz Napierala [Tue, 13 Apr 2021 11:38:37 +0000 (12:38 +0100)]
linux: adjust ordering of Linux auxv and add dummy AT_HWCAP2

This should be a no-op; the purpose of this is to reduce
a spurious difference between Linuxulator and Linux, to make
debugging core dumps slightly easier.

Note that AT_HWCAP2 we pass to Linux binaries is always 0,
instead of being equal to 'cpu_feature2'.  This matches what
I've observed under Ubuntu Focal VM.

Reviewed By: chuck, dchagin
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29609

3 years agoRemove history.immutable from .arcconfig
Alex Richardson [Tue, 13 Apr 2021 11:36:24 +0000 (12:36 +0100)]
Remove history.immutable from .arcconfig

The `history.immutable` setting prevents arcanist from updating
the commit messages with the Differential URL and therefore
makes updating patches awkward with a rebase workflow.

In case this new behaviour is not wanted the old one can be restored
by running `arc set-config --local history.immutable true`.

Test Plan: `arc diff --create HEAD^` adds the metadata now.

Reviewed By: #phabric-admin, imp, lwhsu
Differential Revision: https://reviews.freebsd.org/D27971

3 years agopf: Implement the NAT source port selection of MAP-E Customer Edge
Kurosawa Takahiro [Tue, 13 Apr 2021 08:50:00 +0000 (10:50 +0200)]
pf: Implement the NAT source port selection of MAP-E Customer Edge

MAP-E (RFC 7597) requires special care for selecting source ports
in NAT operation on the Customer Edge because a part of bits of the port
numbers are used by the Border Relay to distinguish another side of the
IPv4-over-IPv6 tunnel.

PR: 254577
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D29468

3 years agoconfig(8): Correct the mentioned paper in the SEE ALSO section
Gordon Bergling [Tue, 13 Apr 2021 04:49:00 +0000 (06:49 +0200)]
config(8): Correct the mentioned paper in the SEE ALSO section

FreeBSD's version of the config(8) utility is based on 4.3BSD not
4.4BSD. So correct the mentioned paper in the SEE ALSO section.

Reported by: imp
Reviewed by: imp
X-MFC-with: 2b59392cb0da804e825c63469beb1934ec4267db
Differential Revision: https://reviews.freebsd.org/D29701

3 years agoroute(8): Add an example how to print the routing tables
Gordon Bergling [Tue, 13 Apr 2021 04:44:04 +0000 (06:44 +0200)]
route(8): Add an example how to print the routing tables

The manual page currently doesn't show an example how to print
the routing table, so add one and .Xr netstat while here.

PR: 231579
Reported by: Pekka Järvinen <pekka dot jarvinen at gmail dot com>
Reviewed by: debdrup
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D29702

3 years agoSpellcheck.
John Baldwin [Mon, 12 Apr 2021 22:12:19 +0000 (15:12 -0700)]
Spellcheck.

Reported by: 0mp

3 years agocxgbe: Ignore doomed virtual interfaces when updating the clip table.
John Baldwin [Mon, 12 Apr 2021 21:36:40 +0000 (14:36 -0700)]
cxgbe: Ignore doomed virtual interfaces when updating the clip table.

A doomed VI does not have a valid ifnet.

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29662

3 years agoRELNOTES: Document removal of asym crypto from OCF.
John Baldwin [Mon, 12 Apr 2021 21:34:23 +0000 (14:34 -0700)]
RELNOTES: Document removal of asym crypto from OCF.

Sponsored by: Chelsio Communications

3 years agoOCF: Remove support for asymmetric cryptographic operations.
John Baldwin [Mon, 12 Apr 2021 21:27:42 +0000 (14:27 -0700)]
OCF: Remove support for asymmetric cryptographic operations.

There haven't been any non-obscure drivers that supported this
functionality and it has been impossible to test to ensure that it
still works.  The only known consumer of this interface was the engine
in OpenSSL < 1.1.  Modern OpenSSL versions do not include support for
this interface as it was not well-documented.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29736

3 years agoiscsi: Kick threads out of iscsi_ioctl() during unload.
John Baldwin [Mon, 12 Apr 2021 20:56:16 +0000 (13:56 -0700)]
iscsi: Kick threads out of iscsi_ioctl() during unload.

iscsid can be sleeping in iscsi_ioctl() causing the destroy_dev() to
sleep forever if iscsi.ko is unloaded while iscsid is running.

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: mav
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29688

3 years agocxgbe: Add counters for iSCSI PDUs transmitted via TOE.
John Baldwin [Mon, 12 Apr 2021 20:56:04 +0000 (13:56 -0700)]
cxgbe: Add counters for iSCSI PDUs transmitted via TOE.

Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29297

3 years agohptrr: Move to using .o files
Warner Losh [Mon, 12 Apr 2021 19:41:25 +0000 (13:41 -0600)]
hptrr: Move to using .o files

Use .o files directly. Replace the .o.uu files that we uudecode with .o files.
Adjust the kernel and module build to cope.

Suggestions by: markj@, emaste@
Sposnored by:           Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29636

3 years agohptmv: use .o files directly
Warner Losh [Mon, 12 Apr 2021 19:41:20 +0000 (13:41 -0600)]
hptmv: use .o files directly

uudecode the .o.uu files and commit directly to the tree. Adjust the build
infrastructure to cope with the new location, both for the kernel and modules.

Sposnored by:           Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29635

3 years agohpt27xx: store the .o files directly in the tree
Warner Losh [Mon, 12 Apr 2021 19:41:14 +0000 (13:41 -0600)]
hpt27xx: store the .o files directly in the tree

Store the .o files directly in the tree. We no longer need to play uuencode
games like we did in the CVS days. Adjust the build infrastructure to match.

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

3 years agohptnr: Store the .o files directly in the repo
Warner Losh [Mon, 12 Apr 2021 19:40:43 +0000 (13:40 -0600)]
hptnr: Store the .o files directly in the repo

We no longer need to use uuencode to uuencode files in our tree.  Store the .o
file directly instead. Adjust the build to cope with the new arrangement.

Suggestions by: emaste, bz, donner
Reviewed by: markm
Sposnored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29632

3 years agobhyve: Move the gdb_active check to gdb_cpu_suspend().
John Baldwin [Mon, 12 Apr 2021 18:43:34 +0000 (11:43 -0700)]
bhyve: Move the gdb_active check to gdb_cpu_suspend().

The check needs to be in the public routine (gdb_cpu_suspend()), not
in the internal routine called from various places
(_gdb_cpu_suspend()).  All the other callers of _gdb_cpu_suspend()
already check gdb_active, and this breaks the use of snapshots when
the debug server is not enabled since gdb_cpu_suspend() tries to lock
an uninitialized mutex.

Reported by: Darius Mihai, Elena Mihailescu
Reviewed by: elenamihailescu22_gmail.com
Fixes: 621b5090487de9fed1b503769702a9a2a27cc7bb
Differential Revision: https://reviews.freebsd.org/D29538

3 years agopfctl, libpfctl: introduce pfctl_pool
Kurosawa Takahiro [Mon, 12 Apr 2021 14:03:40 +0000 (16:03 +0200)]
pfctl, libpfctl: introduce pfctl_pool

Introduce pfctl_pool to be able to extend the pool part of the pf rule
without breaking the ABI.

Reviewed by: kp
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D29721

3 years agoMerge commit 'd0e943077d94e6266ece9856789c5d5313676e38'
Mark Johnston [Mon, 12 Apr 2021 15:29:47 +0000 (11:29 -0400)]
Merge commit 'd0e943077d94e6266ece9856789c5d5313676e38'

3 years agosyncache: simplify syncache_add() KPI to return struct socket pointer
Gleb Smirnoff [Fri, 19 Mar 2021 05:05:22 +0000 (22:05 -0700)]
syncache: simplify syncache_add() KPI to return struct socket pointer
directly, not overwriting the listen socket pointer argument.
Not a functional change.