]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoAvoid code duplicaiton by using ipi_selected().
mav [Tue, 21 Jul 2020 17:18:38 +0000 (17:18 +0000)]
Avoid code duplicaiton by using ipi_selected().

MFC after: 2 weeks

3 years ago[skip ci] document close_range(2) as async-signal-safe
asomers [Tue, 21 Jul 2020 16:46:40 +0000 (16:46 +0000)]
[skip ci] document close_range(2) as async-signal-safe

Reviewed by: bcr (manpages)
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25513

3 years agoFix style and comment around concave/convex regions in TCP cubic.
rscheff [Tue, 21 Jul 2020 16:21:52 +0000 (16:21 +0000)]
Fix style and comment around concave/convex regions in TCP cubic.

In cubic, the concave region is when snd_cwnd starts growing slower
towards max_cwnd (cwnd at the time of the congestion event), and
the convex region is when snd_cwnd starts to grow faster and
eventually appearing like slow-start like growth.

PR: 238478
Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24657

3 years agonetstat(1): Add EXAMPLES section
fernape [Tue, 21 Jul 2020 16:17:23 +0000 (16:17 +0000)]
netstat(1): Add EXAMPLES section

* Add small EXAMPLES section
* Fix warning reported by mandoc (./netstat.1:747:2: WARNING: skipping paragraph
  macro: Pp before Ss)

Approved by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D25212

3 years agotraceroute6: Fix most warnings at the default WARNS level.
markj [Tue, 21 Jul 2020 15:03:36 +0000 (15:03 +0000)]
traceroute6: Fix most warnings at the default WARNS level.

Fix some style issues as well.  Leave -Wno-cast-aligned set for now, as
most of the warnings come casts of CMSG_DATA(), which does provide
sufficient alignment in practice.

Submitted by: Shubh Gupta <shubh@freebsd.org>
Sponsored by: Google (GSOC 2020)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25603

3 years agolockmgr: denote recursion with a bit in lock value
mjg [Tue, 21 Jul 2020 14:42:22 +0000 (14:42 +0000)]
lockmgr: denote recursion with a bit in lock value

This reduces excessive reads from the lock.

Tested by: pho

3 years agolockmgr: rewrite upgrade to stop always dropping the lock
mjg [Tue, 21 Jul 2020 14:41:25 +0000 (14:41 +0000)]
lockmgr: rewrite upgrade to stop always dropping the lock

This matches rw and sx locks.

3 years agolockmgr: add a helper for reading the lock value
mjg [Tue, 21 Jul 2020 14:39:20 +0000 (14:39 +0000)]
lockmgr: add a helper for reading the lock value

3 years agoOnly write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1
andrew [Tue, 21 Jul 2020 14:25:36 +0000 (14:25 +0000)]
Only write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1

This register is only defined for the legacy v1 interface so only write
to it when interacting with a legacy device.

Sponsored by: Innovate UK

3 years agoMove sys/iommu.h to dev/iommu/ as a part of generic IOMMU busdma backend.
br [Tue, 21 Jul 2020 13:50:10 +0000 (13:50 +0000)]
Move sys/iommu.h to dev/iommu/ as a part of generic IOMMU busdma backend.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25750

3 years agoMove the Intel DMAR busdma backend to a generic place so
br [Tue, 21 Jul 2020 10:38:51 +0000 (10:38 +0000)]
Move the Intel DMAR busdma backend to a generic place so
it can be used on other IOMMU systems.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25720

3 years agodtrace/fbt: fix return probe arguments on arm
avg [Tue, 21 Jul 2020 07:41:36 +0000 (07:41 +0000)]
dtrace/fbt: fix return probe arguments on arm

arg0 should be an offset of the return point within the function, arg1
should be the return value.  Previously the return probe had arguments as
if for the entry probe.

Tested on armv7.

andrew noted that the same problem seems to be present on arm64, mips,
and riscv.
I am not sure if I will get around to fixing those.  So, platform users
or anyone looking to make a contribution please be aware of this
opportunity.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25685

3 years agogpioiic: never drive lines active high
avg [Tue, 21 Jul 2020 07:35:03 +0000 (07:35 +0000)]
gpioiic: never drive lines active high

I2C communication is done by a combination of driving a line low or
letting it float, so that it is either pulled up or driven low by
another party.

r355276 besides the stated goal of the change -- using the new GPIO API
-- also changed the logic, so that active state is signaled by actively
driving a line.

That worked with iicbb prior to r362042, but stopped working after that
commit on at least some hardware.  My guess that the breakage was
related to getting an ACK bit.  A device expected to be able to drive
SDA actively low, but controller was actively driving it high for some
time.

Anyway, this change seems to fix the problem.
Tested using gpioiic on Orange Pi PC Plus with HTU21 sensor.

Reported by: Nick Kostirya <nikolay.kostirya@i11.co>
Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25684

3 years agoFix some regressions with the zgrep(1) wrapper.
leres [Mon, 20 Jul 2020 23:57:53 +0000 (23:57 +0000)]
Fix some regressions with the zgrep(1) wrapper.

 - Handle whitespace with long flags that take arguments:

echo 'foo bar' > test
zgrep --regexp='foo bar' test

 - Do not hang reading from stdin with patterns in a file:

echo foobar > test
echo foo > pattern
zgrep -f pattern test
zgrep --file=pattern test

 - Handle any flags after -e:

echo foobar > test
zgrep -e foo --ignore-case < test

These two are still outstanding problems:

 - Does not handle flags that take an argument if there is no
   whitespace:

zgrep -enfs /etc/rpc

 - When more than one -e pattern used matching should occur for all
   patterns (similar to multiple patterns supplied with -f file).
   Instead only the last pattern is used for matching:

zgrep -e rex -e nfs /etc/rpc

   (This problem is masked in the unpatched version by the "any
   flags after -e" problem.)

Add tests for the above problems.

Update the mange and add references to gzip(1) and zstd(1) and also
document the remaining known problems.

PR: 247126
Approved by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25613

3 years agoAdd MODULE_VERSION to TCP loadable congestion control modules.
rscheff [Mon, 20 Jul 2020 23:47:27 +0000 (23:47 +0000)]
Add MODULE_VERSION to TCP loadable congestion control modules.

Without versioning information, using preexisting loader /
linker code is not easily possible when another module may
have dependencies on pre-loaded modules, and also doesn't
allow the automatic loading of dependent modules.

No functional change of the actual modules.

Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D25744

3 years agoDon't dynamically allocate data structures for KTLS crypto requests.
jhb [Mon, 20 Jul 2020 22:32:39 +0000 (22:32 +0000)]
Don't dynamically allocate data structures for KTLS crypto requests.

Allocate iovec arrays and struct cryptop and struct ocf_operation
objects on the stack to reduce avoid the overhead of malloc().

These structures are all small enough to fit on the stack of the KTLS
worker threads.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25692

3 years agoiflib: initialize netmap with the correct number of descriptors
vmaffione [Mon, 20 Jul 2020 21:08:56 +0000 (21:08 +0000)]
iflib: initialize netmap with the correct number of descriptors

In case the network device has a RX or TX control queue, the correct
number of TX/RX descriptors is contained in the second entry of the
isc_ntxd (or isc_nrxd) array, rather than in the first entry.
This case is correctly handled by iflib_device_register() and
iflib_pseudo_register(), but not by iflib_netmap_attach().
If the first entry is larger than the second, this can result in a
panic. This change fixes the bug by introducing two helper functions
that also lead to some code simplification.

PR: 247647
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25541

3 years agoadd a few tests for sendfile.
chs [Mon, 20 Jul 2020 20:36:32 +0000 (20:36 +0000)]
add a few tests for sendfile.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25431

3 years agolibdwarf: Hide SHT_NOBITS sections.
markj [Mon, 20 Jul 2020 18:22:38 +0000 (18:22 +0000)]
libdwarf: Hide SHT_NOBITS sections.

gnu_debuglink external debug files will contain an .eh_frame section of
type SHT_NOBITS.  libdwarf does not handle such sections (or rather, it
expects all debug sections to not have type SHT_NOBITS).  Avoid loading
SHT_NOBITS sections, to be consistent with SGI libdwarf's handling of
this case.

PR: 239516
Diagnosed by: Paco Pascal <me@pacopascal.com>
Reviewed by: emaste (previous version)
Event: July 2020 Bugathon
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25626

3 years agocrypto(9): Stop checking for failures from malloc(M_WAITOK).
markj [Mon, 20 Jul 2020 17:44:13 +0000 (17:44 +0000)]
crypto(9): Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: cem, delphij, jhb
MFC after: 1 week
Event: July 2020 Bugathon

3 years agoFix a memory leak in dsl_scan_visitbp().
markj [Mon, 20 Jul 2020 17:05:44 +0000 (17:05 +0000)]
Fix a memory leak in dsl_scan_visitbp().

This should be triggered only if arc_read() fails, i.e., quite rarely.
The same logic is already present in OpenZFS.

PR: 247445
Submitted by: jdolecek@NetBSD.org
MFC after: 1 week

3 years agopadlock: fix Via Padlock with 192-bit keys
asomers [Mon, 20 Jul 2020 16:12:14 +0000 (16:12 +0000)]
padlock: fix Via Padlock with 192-bit keys

It's been broken since a typo in r359374

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25710

3 years agoext2fs: Stop checking for failures from malloc(M_WAITOK).
markj [Mon, 20 Jul 2020 14:28:26 +0000 (14:28 +0000)]
ext2fs: Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: fsu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25707

3 years agogeli(8): Add an example on how to use geli(8) with a file as encrypted storage
gbe [Mon, 20 Jul 2020 13:24:50 +0000 (13:24 +0000)]
geli(8): Add an example on how to use geli(8) with a file as encrypted storage

Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25741

3 years agozpool(8): Fix a few typos regarding 'inverval' -> 'interval'
gbe [Mon, 20 Jul 2020 13:01:19 +0000 (13:01 +0000)]
zpool(8): Fix a few typos regarding 'inverval' -> 'interval'

PR: 248068
Submitted by: PauAmma <pauamma at gundo dot com>
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D25719

3 years agotests/sys/opencrypto: use python3
asomers [Mon, 20 Jul 2020 12:47:15 +0000 (12:47 +0000)]
tests/sys/opencrypto: use python3

python2 will be EOL soon

Reviewed by: lwhsu, jmg
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25682

3 years agoFix indent for if clause.
delphij [Mon, 20 Jul 2020 01:55:19 +0000 (01:55 +0000)]
Fix indent for if clause.

MFC after: 2 weeks

3 years agoRevert that!
sjg [Sun, 19 Jul 2020 23:56:19 +0000 (23:56 +0000)]
Revert that!

3 years agoOops missed Makefile.config
sjg [Sun, 19 Jul 2020 23:54:00 +0000 (23:54 +0000)]
Oops missed Makefile.config

3 years agoriscv: look for bootargs in FDT
mhorne [Sun, 19 Jul 2020 23:34:52 +0000 (23:34 +0000)]
riscv: look for bootargs in FDT

The FDT may contain a short /chosen/bootargs string which we should pass
to boot_parse_cmdline. Notably, this allows the use of qemu's -append
option to pass things like -s to boot to single user mode.

Submitted by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25544

3 years agoMake efirt module dependent on MK_EFI
mhorne [Sun, 19 Jul 2020 23:19:09 +0000 (23:19 +0000)]
Make efirt module dependent on MK_EFI

MK_EFI was added to kern.opts.mk in r331099, but is currently unused.
Take advantage of that fact and gate the build of efirt behind it.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D24673

3 years agoThe ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed,
ian [Sun, 19 Jul 2020 18:53:19 +0000 (18:53 +0000)]
The ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed,
flip them so that times in the 20:00:00 to 23:59:59 range read correctly.

Reported by: Dr. Rolf Jansen <freebsd-rj@obsigna.com>
Pointy hat: ian@

3 years agoSimplify non-pti syscall entry on amd64.
kib [Sun, 19 Jul 2020 17:47:55 +0000 (17:47 +0000)]
Simplify non-pti syscall entry on amd64.

Limit manipulations to use %rax as scratch to the pti portion of the
syscall entry code.

Submitted by: alc
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25722

3 years ago[if_an] unbreak!
adrian [Sun, 19 Jul 2020 17:27:48 +0000 (17:27 +0000)]
[if_an] unbreak!

.. I missed this when checking drivers.

Differential Revision: https://reviews.freebsd.org/D25723

3 years ago[net80211] missing from last commit, le whoops
adrian [Sun, 19 Jul 2020 16:07:51 +0000 (16:07 +0000)]
[net80211] missing from last commit, le whoops

Differential Revision:https://reviews.freebsd.org/D25630

3 years ago[net80211] Add new privileges; restrict what can be done in a jail.
adrian [Sun, 19 Jul 2020 15:16:27 +0000 (15:16 +0000)]
[net80211] Add new privileges; restrict what can be done in a jail.

Split the MANAGE privilege into MANAGE, SETMAC and CREATE_VAP.

+ VAP_MANAGE is everything but setting the MAC and creating a VAP.
+ VAP_SETMAC is setting the MAC address of the VAP.
  Typically you wouldn't want the jail to be able to modify this.
+ CREATE_VAP is to create a new VAP. Again, you don't want to be doing
  this in a jail, but this DOES stop being able to run some corner
  cases like Dynamic WDS (DWDS) AP in a jail/vnet. We can figure this
  bit out later.

This allows me to run wpa_supplicant in a jail after transferring
a STA VAP into it. I unfortunately can't currently set the wlan
debugging inside the jail; that would be super useful!

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D25630

3 years agoat(1): Markup environment variables with proper macros
allanjude [Sun, 19 Jul 2020 14:42:13 +0000 (14:42 +0000)]
at(1): Markup environment variables with proper macros

Submitted by: debdrup
Reported by: 0mp
Reviewed by: imp
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25721

3 years agoAdd reference counts for inp/stcb/net when timers are running.
tuexen [Sun, 19 Jul 2020 12:34:19 +0000 (12:34 +0000)]
Add reference counts for inp/stcb/net when timers are running.
This avoids a use-after-free reported for the userland stack.
Thanks to Taylor Brandstetter for suggesting a patch for
the userland stack.

MFC after: 1 week

3 years agoMake linux(4) support the BLKPBSZGET ioctl. Oracle uses it.
trasz [Sun, 19 Jul 2020 12:25:03 +0000 (12:25 +0000)]
Make linux(4) support the BLKPBSZGET ioctl.  Oracle uses it.

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

3 years agoAdd missing bitset(9) MLINKS.
trasz [Sun, 19 Jul 2020 12:22:32 +0000 (12:22 +0000)]
Add missing bitset(9) MLINKS.

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

3 years agoTemporarly revert r363319 to unbreak the build.
melifaro [Sun, 19 Jul 2020 10:53:15 +0000 (10:53 +0000)]
Temporarly revert r363319 to unbreak the build.

Reported by: CI
Pointy hat to: melifaro

3 years agoTransition from rtrequest1_fib() to rib_action().
melifaro [Sun, 19 Jul 2020 09:29:27 +0000 (09:29 +0000)]
Transition from rtrequest1_fib() to rib_action().

Remove all variations of rtrequest <rtrequest1_fib, rtrequest_fib,
 in6_rtrequest, rtrequest_fib> and their uses and switch to
to rib_action(). This is part of the new routing KPI.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D25546

3 years agoloader: cstyle cleanup
tsoome [Sun, 19 Jul 2020 06:59:09 +0000 (06:59 +0000)]
loader: cstyle cleanup

No functional changes intended.

Sponsored by: Netflix, Klara Inc.

3 years agoamd64 pmap: microoptimize local shootdowns for PCID PTI configurations
kib [Sat, 18 Jul 2020 18:19:57 +0000 (18:19 +0000)]
amd64 pmap: microoptimize local shootdowns for PCID PTI configurations

When pmap operates in PTI mode, we must reload %cr3 on return to
userspace.  In non-PCID mode the reload always flushes all non-global
TLB entries and we take advantage of it by only invalidating the KPT
TLB entries (there is no cached UPT entries at all).

In PCID mode, we flush both KPT and UPT TLB explicitly, but we can
take advantage of the fact that PCID mode command to reload %cr3
includes a flag to flush/not flush target TLB.  In particular, we can
avoid the flush for UPT, instead record that load of pc_ucr3 into %cr3
on return to usermode should be flushing.  This is done by providing
either all-1s or ~CR3_PCID_MASK in pc_ucr3_load_mask.  The mask is
automatically reset to all-1s on return to usermode.

Similarly, we can avoid flushing UPT TLB on context switch, replacing
it by setting pc_ucr3_load_mask.  This unifies INVPCID and non-INVPCID
PTI ifunc, leaving only 4 cases instead of 6.  This trick is also
applicable both to the TLB shootdown IPI handlers, since handlers
interrupt the target thread.

But then we need to check pc_curpmap in handlers, and this would
reopen the same race for INVPCID machines as was fixed in r306350 for
non-INVPCID.  To not introduce the same bug, unconditionally do
spinlock_enter() in pmap_activate().

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

3 years agoo Move iommu_test_boundary() to sys/iommu.h
br [Sat, 18 Jul 2020 13:10:31 +0000 (13:10 +0000)]
o Move iommu_test_boundary() to sys/iommu.h
o Rename DMAR -> IOMMU in comments
o Add IOMMU_PAGE_SIZE / IOMMU_PAGE_MASK macroses
o x86 only: dmar_quirks_pre_use() / dmar_instantiate_rmrr_ctxs()

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25665

3 years agoRemove code which is not needed.
tuexen [Sat, 18 Jul 2020 13:10:02 +0000 (13:10 +0000)]
Remove code which is not needed.

MFC after: 1 week

3 years agobridge: Don't sleep during epoch
kp [Sat, 18 Jul 2020 12:43:11 +0000 (12:43 +0000)]
bridge: Don't sleep during epoch

While it doesn't trigger INVARIANTS or WITNESS on head it does in stable/12.
There's also no reason for it, as we can easily report the out of memory error
to the caller (i.e. userspace). All of these can already fail.

PR: 248046
MFC after: 3 days

3 years agoMake linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
trasz [Sat, 18 Jul 2020 12:21:08 +0000 (12:21 +0000)]
Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
as documented in the man page.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoBump the default linux version from 3.2.0 to 3.10.0, which corresponds
trasz [Sat, 18 Jul 2020 11:37:30 +0000 (11:37 +0000)]
Bump the default linux version from 3.2.0 to 3.10.0, which corresponds
to RHEL 7.  Required for DB2.

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

3 years agoRegen after r363304.
trasz [Sat, 18 Jul 2020 11:31:31 +0000 (11:31 +0000)]
Regen after r363304.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoAdd a trivial linux(4) splice(2) implementation, which simply
trasz [Sat, 18 Jul 2020 11:28:40 +0000 (11:28 +0000)]
Add a trivial linux(4) splice(2) implementation, which simply
returns EINVAL.  Fixes grep (grep-3.1-2build1).

PR: kern/218699
Reported by: avos
Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25636

3 years agoAdd missing SysV IPC stats to linprocfs(4). Fixes 'ipcs -l',
trasz [Sat, 18 Jul 2020 10:56:04 +0000 (10:56 +0000)]
Add missing SysV IPC stats to linprocfs(4).  Fixes 'ipcs -l',
and also helps Oracle.

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

3 years agoFix bogomips calculation. Previously it was off by half. This was
trasz [Sat, 18 Jul 2020 10:53:56 +0000 (10:53 +0000)]
Fix bogomips calculation.  Previously it was off by half.  This was
verified under VMWare Fusion, comparing to what's reported under CentOS,
and by comparing numbers reported by linuxulator on T420 with a googled
up Linux cpuinfo (https://lkml.org/lkml/2011/11/29/116).

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

3 years agoFix two typos in flag names in /proc/cpuinfo.
trasz [Sat, 18 Jul 2020 10:49:17 +0000 (10:49 +0000)]
Fix two typos in flag names in /proc/cpuinfo.

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

3 years agoMFV: r363292
jkim [Sat, 18 Jul 2020 07:35:34 +0000 (07:35 +0000)]
MFV: r363292

Merge ACPICA 20200717.

3 years agoShort-circuit tdfind when looking for the calling thread.
mjg [Sat, 18 Jul 2020 00:14:43 +0000 (00:14 +0000)]
Short-circuit tdfind when looking for the calling thread.

Common occurence with cpuset and other places.

3 years agoFix vnode_pager handling of read ahead/behind pages when a disk read fails.
chs [Fri, 17 Jul 2020 23:10:35 +0000 (23:10 +0000)]
Fix vnode_pager handling of read ahead/behind pages when a disk read fails.
Rather than marking the read ahead/behind pages valid even though they were
not initialized, free them using the new function vm_page_free_invalid().

Reviewed by: markj, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25430

3 years agoAdd a new function vm_page_free_invalid() for freeing invalid pages
chs [Fri, 17 Jul 2020 23:09:36 +0000 (23:09 +0000)]
Add a new function vm_page_free_invalid() for freeing invalid pages
that might be wired.  If the page is wired then it cannot be freed now,
but the thread that eventually unwires it will free it at that point.

Reviewed by: markj, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25430

3 years agoRevert my change from r361855 in favor of a better fix.
chs [Fri, 17 Jul 2020 23:08:01 +0000 (23:08 +0000)]
Revert my change from r361855 in favor of a better fix.

Reviewed by: markj, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25430

3 years agodevstat(9): Update the man page to reflect the current implementation
gbe [Fri, 17 Jul 2020 22:15:02 +0000 (22:15 +0000)]
devstat(9): Update the man page to reflect the current implementation

- Rename devstat_add_entry to devstat_new_entry
- Update the description of devstat_trans_flags
- Add manpage aliases for devstat_start_transaction_bio and devstat_end_transaction_bio

PR: 157316
Submitted by: novel
Reviewed by: cem, bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25677

3 years agomount_nfs(8): document alternate form of the gssname option
gbe [Fri, 17 Jul 2020 21:55:24 +0000 (21:55 +0000)]
mount_nfs(8): document alternate form of the gssname option

PR: 238506
Submitted by: Greg Veldman <freebsd at gregv dot net>
Reviewed by: 0mp, bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25667

3 years agoiwm(4): Document limitations of the driver
gbe [Fri, 17 Jul 2020 21:47:06 +0000 (21:47 +0000)]
iwm(4): Document limitations of the driver

Document that iwm(4) currently doesn't support 802.11n and 802.11ac.

PR: 247874
Submitted by: Charles Ross <cwr at sdf dot org>
Reviewed by: brueffer, markj
Approved by: brueffer
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25666

3 years agoat(1): Fix location of at(1) crontab
allanjude [Fri, 17 Jul 2020 20:43:00 +0000 (20:43 +0000)]
at(1): Fix location of at(1) crontab

With r318443, atrun was moved from /etc/crontab to /etc/cron.d/at,
but the man-page was unfortunately not updated to reflect this.

PR: 248048
Submitted by: debdrup
Reported by: yoitsmeremember+fbsd at gmail.com
Reviewed by: Pau Amma <pauamma at gundo.com>
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25709

3 years agoFix incorrect byte order in ipfstat -f output.
cy [Fri, 17 Jul 2020 19:07:59 +0000 (19:07 +0000)]
Fix incorrect byte order in ipfstat -f output.
- make sure frag is initialized to 0
- initialize ipfr_p field

NetBSD PR: 55137
Submitted by: christos@NetBSD.org
Reported by: christos@NetBSD.org
Obtained from: NetBSD fil.c r1.32, ip_frag.c r1.8
MFC after: 2 weeks

3 years agopfil_run_hooks() can be called recursively, so we have to
cy [Fri, 17 Jul 2020 19:07:56 +0000 (19:07 +0000)]
pfil_run_hooks() can be called recursively, so we have to
define FASTROUTE_RECURSION in fil.c

Submitted by: christos@NetBSD.org
Reported by: christos@NetBSD.org
Obtained from: NetBSD r1.31
MFC after: 2 weeks

3 years ago-4 and -6 only make sense with -i, -o, and -t.
cy [Fri, 17 Jul 2020 19:07:53 +0000 (19:07 +0000)]
-4 and -6 only make sense with -i, -o, and -t.

PR: 247952
MFC after: 1 week

3 years agoThe output from usage() need not contain usage for -t when STATETOP
cy [Fri, 17 Jul 2020 19:07:50 +0000 (19:07 +0000)]
The output from usage() need not contain usage for -t when STATETOP
is not compiled in.

PR: 247952
MFC after: 1 week

3 years agoMake ipfstat -t header generic when IPv4 and IPv6 output are
cy [Fri, 17 Jul 2020 19:07:47 +0000 (19:07 +0000)]
Make ipfstat -t header generic when IPv4 and IPv6 output are
displayed in the same display.

PR: 247952
MFC after: 1 week

3 years agoipfstat -t defaults to IPv4 output. Make consistent with ipfstat -i
cy [Fri, 17 Jul 2020 19:07:44 +0000 (19:07 +0000)]
ipfstat -t defaults to IPv4 output. Make consistent with ipfstat -i
and ipfstat -o where without an argument IPv4 and IPv6 states are
shown. Use -4 and -6 to limit the display to IPv4 or IPv6 respectively.

PR: 247952
MFC after: 1 week

3 years agoHistorically ipfstat listings and stats only listed IPv4 or IPv6 output.
cy [Fri, 17 Jul 2020 19:07:40 +0000 (19:07 +0000)]
Historically ipfstat listings and stats only listed IPv4 or IPv6 output.
ipfstat would list IPv4 outputs by default while -6 would produce IPv6
outputs. This commit combines the ipfstat -i and -o outputs into one
listing of IPv4 and IPv6 rules. The -4 option lists only IPv4 rules
(as the default before) while -6 continues to list only rules that affect
IPv6.

PR: 247952
Reported by: joeb1@a1poweruser.com
MFC after: 1 week

3 years agofr_family (the protocol family) must be AF_INET or AF_INET6, as in
cy [Fri, 17 Jul 2020 19:07:37 +0000 (19:07 +0000)]
fr_family (the protocol family) must be AF_INET or AF_INET6, as in
the kernel, not an arbitrary 4 or 6.

This only affected printing ipfilter stats and rules from a kernel
dump. (This is currently undocumented.)

PR: 247952
MFC after: 1 week

3 years agoOnly use the use_inet6 variable when INET6 is a build option.
cy [Fri, 17 Jul 2020 19:07:34 +0000 (19:07 +0000)]
Only use the use_inet6 variable when INET6 is a build option.

This is a prerequisite to upcoming argument processing cleanups which
will resolve consistency as was done with ippool previously.

PR: 247952
MFC after: 1 week

3 years agoFix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU.
takawata [Fri, 17 Jul 2020 15:50:03 +0000 (15:50 +0000)]
Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU.

ACL packet boundary flag should be 0 instead of 2 for LE PDU.
Some HCI will drop LE packet with PB flag is 2, and if sent,
some target may reject the packet.

PR: 248024
Reported by: Greg V
Reviewed by: Greg V, emax
Differential Revision: https://reviews.freebsd.org/D25704

3 years agoImprove the locking of address lists by adding some asserts and
tuexen [Fri, 17 Jul 2020 15:09:49 +0000 (15:09 +0000)]
Improve the locking of address lists by adding some asserts and
rearranging the addition of address such that the lock is not
given up during checking and adding.

MFC after: 1 week

3 years agoAdd acpi_iort_map_pci_smmuv3().
br [Fri, 17 Jul 2020 14:51:51 +0000 (14:51 +0000)]
Add acpi_iort_map_pci_smmuv3().

This new function allows us to find the SMMU instance assigned
for a particular PCI RID.

Reviewed by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D25687

3 years agoClean up crypto_init().
markj [Fri, 17 Jul 2020 14:45:16 +0000 (14:45 +0000)]
Clean up crypto_init().

The function is called from a KLD load handler, so it may sleep.

- Stop checking for errors from uma_zcreate(), they don't happen.
- Convert M_NOWAIT allocations to M_WAITOK.
- Remove error handling for existing M_WAITOK allocations.
- Fix style.

Reviewed by: cem, delphij, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25696

3 years agoDon't overflow the trap frame when accessing lr or xzr.
andrew [Fri, 17 Jul 2020 14:39:07 +0000 (14:39 +0000)]
Don't overflow the trap frame when accessing lr or xzr.

When emulating a load pair or store pair in dtrace on arm64 we need to
copy the data between the stack and trap frame. When the registers are
either the link register or the zero register we will access memory
past the end of the trap frame as these are encoded as registers 30 and
31 respectively while the array they access only has 30 entries.

Fix this by creating 2 helper functions to perform the operation with
special cases for these registers.

Sponsored by: Innovate UK

3 years agoPromote use of unprivileged users for building ports by documenting SU_CMD.
pstef [Fri, 17 Jul 2020 06:33:20 +0000 (06:33 +0000)]
Promote use of unprivileged users for building ports by documenting SU_CMD.
Phrasing by Daniel O'Connor.

Reviewed by: 0mp
MFC after: 14 days
Differential Revision: https://reviews.freebsd.org/D25433

3 years agoRevert r240317 to prevent leaking pmap entries
cem [Thu, 16 Jul 2020 23:29:26 +0000 (23:29 +0000)]
Revert r240317 to prevent leaking pmap entries

Subsequent to r240317, kmem_free() was replaced with kva_free() (r254025).
kva_free() releases the KVA allocation for the mapped region, but no longer
clears the pmap (pagetable) entries.

An affected pmap_unmapdev operation would leave the still-pmap'd VA space
free for allocation by other KVA consumers.  However, this bug easily
avoided notice for ~7 years because most devices (1) never call
pmap_unmapdev and (2) on amd64, mostly fit within the DMAP and do not need
KVA allocations.  Other affected arch are less popular: i386, MIPS, and
PowerPC.  Arm64, arm32, and riscv are not affected.

Reported by: Don Morris <dgmorris AT earthlink.net>
Submitted by: Don Morris (amd64 part)
Reviewed by: kib, markj, Don (!amd64 parts)
MFC after: I don't intend to, but you might want to
Sponsored by: Dell Isilon
Differential Revision: https://reviews.freebsd.org/D25689

3 years agoadd script to help figure out what man pages need MLINKS updated...
jmg [Thu, 16 Jul 2020 23:05:18 +0000 (23:05 +0000)]
add script to help figure out what man pages need MLINKS updated...

3 years agoInclude FreeBSD ABI tag note in the ELF runtime loader.
jhb [Thu, 16 Jul 2020 22:01:01 +0000 (22:01 +0000)]
Include FreeBSD ABI tag note in the ELF runtime loader.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25306

3 years agoInclude ABI note tag in shared libraries.
jhb [Thu, 16 Jul 2020 21:58:43 +0000 (21:58 +0000)]
Include ABI note tag in shared libraries.

Split the ELF feature note into a separate file that is linked into
*crt1.o the same as crtbrand.S was before.  crtbrand.o is now linked
into crti.o on all platforms in addition to *crt1.o.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25304

3 years agoAdd crypto_initreq() and crypto_destroyreq().
jhb [Thu, 16 Jul 2020 21:30:46 +0000 (21:30 +0000)]
Add crypto_initreq() and crypto_destroyreq().

These routines are similar to crypto_getreq() and crypto_freereq() but
operate on caller-supplied storage instead of allocating crypto
requests from a UMA zone.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25691

3 years agoHold the mutex when releasing a callout.
ken [Thu, 16 Jul 2020 20:43:28 +0000 (20:43 +0000)]
Hold the mutex when releasing a callout.

In xpt_release_device(), callout_stop() was being called without
holding the mutex (send_mtx) that is used to protect the callout.

So, move the mtx_unlock() call so that it is protected.

MFC after: 1 week
Sponsored by: Spectra Logic

3 years ago(Re)-allow 0.0.0.0 to be used as an address in connect() for TCP
tuexen [Thu, 16 Jul 2020 16:46:24 +0000 (16:46 +0000)]
(Re)-allow 0.0.0.0 to be used as an address in connect() for TCP
In r361752 an error handling was introduced for using 0.0.0.0 or
255.255.255.255 as the address in connect() for TCP, since both
addresses can't be used. However, the stack maps 0.0.0.0 implicitly
to a local address and at least two regressions were reported.
Therefore, re-allow the usage of 0.0.0.0.
While there, change the error indicated when using 255.255.255.255
from EAFNOSUPPORT to EACCES as mentioned in the man-page of connect().

Reviewed by: rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D25401

3 years agoAdd VIRTIO_BLK_T_DISCARD support to the virtio-blk driver
allanjude [Thu, 16 Jul 2020 16:32:16 +0000 (16:32 +0000)]
Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver

If the hypervisor advertises support for the DISCARD command then the
guest can perform TRIM commands, freeing space on the backing store.

If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE

Tested with FreeBSD guests on bhyve and KVM

Reviewed by: jhb
Tested by: freqlabs
MFC after: 1 month
Relnotes: yes
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D21708

3 years agoAdd a RELNOTES entry for r363253.
markj [Thu, 16 Jul 2020 15:12:52 +0000 (15:12 +0000)]
Add a RELNOTES entry for r363253.

Sponsored by: The FreeBSD Foundation

3 years agoSwitch from SCTP to SCTP_SUPPORT in GENERIC configs.
markj [Thu, 16 Jul 2020 15:09:04 +0000 (15:09 +0000)]
Switch from SCTP to SCTP_SUPPORT in GENERIC configs.

This removes SCTP from in-tree kernel configuration files.  Now, SCTP
can be enabled by simply loading the module, as discussed on
freebsd-net@.

Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25611

3 years agotuntap: drop redundant if_mtu assignment in tuncreate
kevans [Thu, 16 Jul 2020 15:02:11 +0000 (15:02 +0000)]
tuntap: drop redundant if_mtu assignment in tuncreate

ether_ifattach will immediately clobber if_mtu with ETHERMTU anyways, just
let it happen.

MFC after: 1 week

3 years agosafexcel(4): Silence an integer truncation warning.
markj [Thu, 16 Jul 2020 14:21:55 +0000 (14:21 +0000)]
safexcel(4): Silence an integer truncation warning.

In practice overflow is not possible, but we might as well use the right
type for DMA ring sizes.

CID: 1430468
MFC after: 1 week

3 years agoRelax the rule against declaring variables in nested scopes and for
imp [Thu, 16 Jul 2020 14:12:54 +0000 (14:12 +0000)]
Relax the rule against declaring variables in nested scopes and for
initializations.

Relax some overly perscriptive rules against declarations: they may be at the
start of any blocks, even if things aren't super complicated. Allow more
initializations (those that call simple functions, like accessor functions for
newbus are fine). Allow the common idiom of declaring the loop variable in a for
loop.

This tries to codify what common exceptions are today, as well as give
some guidance on when it's best to do these things.

Reviewed by: tsoome, kp, markm, allanjude, jiles, cem, rpokala
(earlier versions: seanc, melifaro, bapt, pjd, bz, pstef, arichards,
 jhibits, vangyzen, jmallet, ian, glebius, jhb, dab, adrian,
 sef, gnn)
Differential Revision: https://reviews.freebsd.org/D25312

3 years agovfs: fix vn_poll performance with either MAC or AUDIT
mjg [Thu, 16 Jul 2020 14:09:18 +0000 (14:09 +0000)]
vfs: fix vn_poll performance with either MAC or AUDIT

The code would unconditionally lock the vnode to audit or call the
mac hoook, even if neither want to do anything. Pre-check the state
to avoid locking in the common case of nothing to do.

Note this code should not be normally executed anyway as vnodes are
always return ready. However, poll1/2 from will-it-scale use regular
files for benchmarking, presumably to focus on the interface itself
as the vnode handler is not supposed to do almost anything.

This in particular fixes poll2 which passes 128 fds.

$ ./poll2_processes -s 10
before: 134411
after:  271572

3 years agoRemove old devd rules for ActiveWire and Entrega Serial DB25
0mp [Thu, 16 Jul 2020 14:04:29 +0000 (14:04 +0000)]
Remove old devd rules for ActiveWire and Entrega Serial DB25

Those rules have been broken at least since 8-STABLE, when the port
providing the ezdownload binary was removed (misc/ezload).

Reviewed by: kevans, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25686

3 years agovfs: fix MAC/AUDIT mismatch in vn_poll
mjg [Thu, 16 Jul 2020 14:04:28 +0000 (14:04 +0000)]
vfs: fix MAC/AUDIT mismatch in vn_poll

Auditing would not be performed without MAC compiled in.

3 years agoether_ifattach: set mtu before calling if_attach()
kevans [Thu, 16 Jul 2020 13:37:32 +0000 (13:37 +0000)]
ether_ifattach: set mtu before calling if_attach()

if_attach() -> if_attach_internal() will call if_attachdomain1(ifp) any time
an ethernet interface is setup *after*
SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_FIRST.  This eventually leads to
nd6_ifattach() -> nd6_setmtu0() stashing off ifp->if_mtu in ndi->maxmtu
*before* ifp->if_mtu has been properly set in some scenarios, e.g., USB
ethernet adapter plugged in later on.

For interfaces that are created in early boot, we don't have this issue as
domains aren't constructed enough for them to attach and thus it gets
deferred to domainifattach at SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_SECOND
*after* the mtu has been set earlier in ether_ifattach().

PR: 248005
Submitted by: Mathew <mjanelle blackberry com>
MFC after: 1 week

3 years agoamd64: patch ffsl to use the compiler builtin
mjg [Thu, 16 Jul 2020 11:28:24 +0000 (11:28 +0000)]
amd64: patch ffsl to use the compiler builtin

This shortens fdalloc by over 60 bytes. Correctness verified by running both
variants at the same time and comparing the result of each call.

Note someone(tm) should make a pass at converting everything else feasible.

3 years agoefibootmgr: typo in long option name
tsoome [Thu, 16 Jul 2020 10:20:35 +0000 (10:20 +0000)]
efibootmgr: typo in long option name

del-timout should be del-timeout

Reported by: mjg
MFC after: 1 week

3 years ago[ar71xx] fix watchdog to work on subsequent SoCs
adrian [Wed, 15 Jul 2020 19:34:19 +0000 (19:34 +0000)]
[ar71xx] fix watchdog to work on subsequent SoCs

The AR9341 AHB runs at 225MHz, much faster than the 33MHz of the
AR71xx AHB.  So not only is the math going to do weird things, it
will also wrap rather than being clamped.

So:

* clamp! don't wrap!
* tidy up some debugging
* add an option to throw an NMI rather than reset!

Tested:

* AR9341 SoC (TP-Link TL-WDR4300), patting/not patting the watchdog!

3 years agoopenssh: refer to OpenSSL not SSLeay, part 2
emaste [Wed, 15 Jul 2020 18:49:00 +0000 (18:49 +0000)]
openssh: refer to OpenSSL not SSLeay, part 2

This change was made upstream between 7.9p1 and 8.0p1.  We've made local
changes in the same places for handling the version_addendum; apply the
SSLeay_version to OpenSSL_version change in advance of importing 8.0p1.
This should have been part of r363225.

Obtained from: OpenSSH-portable a65784c9f9c5
MFC with: r363225
Sponsored by: The FreeBSD Foundation

3 years agoNote the merge of sendmail 8.16.1 from vendor "branch"
gshapiro [Wed, 15 Jul 2020 18:32:09 +0000 (18:32 +0000)]
Note the merge of sendmail 8.16.1 from vendor "branch"