]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoioat(4): Remove Giant from ioat_test enable/disable.
Alexander Motin [Sat, 4 Sep 2021 19:53:28 +0000 (15:53 -0400)]
ioat(4): Remove Giant from ioat_test enable/disable.

MFC after: 1 month

3 years agoaltq: mark callouts as mpsafe
Kristof Provost [Sat, 4 Sep 2021 12:18:45 +0000 (14:18 +0200)]
altq: mark callouts as mpsafe

There's no reason to acquire the Giant lock while executing the ALTQ
callouts.

While here also remove a few backwards compatibility defines for long
obsolete FreeBSD versions.

Reviewed by: mav
Suggested by: mav
Differential Revision: https://reviews.freebsd.org/D31835

3 years agoSupport bootstrapping from Linux/ppc*
Justin Hibbits [Sat, 4 Sep 2021 16:45:56 +0000 (11:45 -0500)]
Support bootstrapping from Linux/ppc*

3 years agopowerpc: Fix typo in thread register copy
Justin Hibbits [Sat, 4 Sep 2021 16:43:17 +0000 (11:43 -0500)]
powerpc: Fix typo in thread register copy

Should be saving off td0's register's, not td's.

3 years ago[PowerPC] Fix outdated FP regs on fork(2) and friends
Brandon Bergren [Mon, 3 May 2021 02:12:18 +0000 (21:12 -0500)]
[PowerPC] Fix outdated FP regs on fork(2) and friends

Summary:
Failure to update the FP / vector state was causing daemon(3) to violate C ABI by failing to preserve nonvolatile registers.

This was causing a weird issue where moused was not working on PowerBook G4s when daemonizing, but was working fine when running it foreground.

Force saving off the same state that cpu_switch() does in cases where we are about to copy a thread.

MFC after: 1 week
Sponsored by: Tag1 Consulting, Inc.

Test Plan:
```
/*
 * Test for ABI violation due to side effects of daemon(3).
 *
 * NOTE: Compile with -O2 to see the effect.
 */
/* Allow compiling for Linux too. */

static double test = 1234.56f;

/*
 * This contrivance coerces clang to not bounce the double
 * off of memory again in main.
 */
void __attribute__((noinline))
print_double(int j1, int j2, double d)
{
printf("%f\n", d);
}

int
main(int argc, char *argv[])
{
print_double(0, 0, test);

if (daemon(0, 1)) {
}
/* Compiler assumes nonvolatile regs are intact... */
print_double(0, 0, test);
return(0);
}
```

Working output:
```
1234.560059
1234.560059
```

Output in broken case:
```
1234.560059
0.0
```

Reviewers: #powerpc

Subscribers: jhibbits, luporl, alfredo

Tags: #powerpc

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

3 years agoopenssh: update default version addendum in man pages
Ed Maste [Sat, 4 Sep 2021 15:33:13 +0000 (11:33 -0400)]
openssh: update default version addendum in man pages

Fixes: 2f513db72b03 ("Upgrade to OpenSSH 7.9p1.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agopfctl: print counters in decimal
Kristof Provost [Sat, 4 Sep 2021 14:07:59 +0000 (16:07 +0200)]
pfctl: print counters in decimal

795d78a46713 pfctl: Don't use PRIu64 mistakenly changed these to be
printed as hexadecimal numbers.

Reported by: Florian Smeets
MFC after: 4 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agocrypto(4): Fix a few typos in camellia.c
Gordon Bergling [Sat, 4 Sep 2021 11:02:11 +0000 (13:02 +0200)]
crypto(4): Fix a few typos in camellia.c

 - s/valiables/variables/

Obtained from: NetBSD
MFC after: 3 days

3 years agoFix a common typo in source code comments
Gordon Bergling [Sat, 4 Sep 2021 10:56:57 +0000 (12:56 +0200)]
Fix a common typo in source code comments

- s/existant/existent/

MFC after: 3 days

3 years agonet80211: add func/line information to IEEE80211_DISCARD* macros
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:24:51 +0000 (09:24 +0000)]
net80211: add func/line information to IEEE80211_DISCARD* macros

While debugging is very good in net80211, some log messages are
repeated in multiple places 1:1.  In order to distinguish where the
discard happened and to speed up analysis, add __func__:__LINE__
information to all these messages.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agonet80211: comments and whitespace
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:16:25 +0000 (09:16 +0000)]
net80211: comments and whitespace

Add a missing '.', fix spelling of "failed" and unwrap a closing );
No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agocaroot: update root store
Kyle Evans [Sat, 4 Sep 2021 07:26:32 +0000 (02:26 -0500)]
caroot: update root store

- Four (4) added
- Two (2) removed

3 years agoUnify console output.
Alexander Motin [Sat, 4 Sep 2021 03:13:42 +0000 (23:13 -0400)]
Unify console output.

Without this change when virtual console enabled depending on buffer
presence and state different parts of output go to different consoles.

MFC after: 1 month

3 years agoRe-implement virtual console (constty).
Alexander Motin [Sat, 4 Sep 2021 02:18:51 +0000 (22:18 -0400)]
Re-implement virtual console (constty).

Protect conscallout with tty lock instead of Giant.  In addition to
Giant removal it also closes race on console unset.

Introduce additional lock to protect against concurrent console sets.

Remove consbuf free on console unset as unsafe, making impossible to
change buffer size after first allocation.  Instead increase default
buffer size from 8KB to 64KB and processing rate from 5Hz to 10-15Hz
to make the output more smooth.

MFC after: 1 month

3 years agort(4): Replace Giant callout+task with timeout_task.
Alexander Motin [Fri, 3 Sep 2021 22:08:29 +0000 (18:08 -0400)]
rt(4): Replace Giant callout+task with timeout_task.

3 years agoopenssh: remove login class restrictions leftovers
Ed Maste [Thu, 2 Sep 2021 21:13:29 +0000 (17:13 -0400)]
openssh: remove login class restrictions leftovers

MFC after: 2 weeks
Fixes: 27ceebbc2402 ("openssh: simplify login class...")
Sponsored by: The FreeBSD Foundation

3 years agoopenssh: restore local change to gssapi include logic
Ed Maste [Thu, 2 Sep 2021 20:43:59 +0000 (16:43 -0400)]
openssh: restore local change to gssapi include logic

/usr/include/gssapi.h claims that it is deprecated, and gssapi/gssapi.h
should be used instead.  So, test HAVE_GSSAPI_GSSAPI_H first falling
back to HAVE_GSSAPI_H.

This will be submitted upstream.

Fixes: 6eac665c8126 ("openssh: diff reduction against...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31810

3 years agovt(4): Mark callouts MP-safe.
Alexander Motin [Fri, 3 Sep 2021 19:42:46 +0000 (15:42 -0400)]
vt(4): Mark callouts MP-safe.

The code explicitly takes Giant when it accesses keyboard, and I see
no reason to take it globally by callout(9).

MFC after: 1 month

3 years agopcib(4): Switch from callout to timeout_task.
Alexander Motin [Fri, 3 Sep 2021 19:00:21 +0000 (15:00 -0400)]
pcib(4): Switch from callout to timeout_task.

This allows to avoid blocking on Giant in callout context, moving to
already existing dedicated taskqueue_pci_hp thread.

MFC after: 1 month

3 years agomprotect.2: Remove legacy BSD text
Brooks Davis [Fri, 3 Sep 2021 18:30:23 +0000 (19:30 +0100)]
mprotect.2: Remove legacy BSD text

This text dates to the BSD 4.4 import and is misleading.  The mprotect
syscall acts on page granularity and breaks up mappings as required to
do so.

Note that with the addition of non-transparent superpages (aka
largepages) the size of a page at a given address may vary.  This
commit does not attempt to address the lack of documentation of this
feature.

Sponsored by: DARPA

Reviewed by: alc, mckusick, imp, kib, markj
Differential Revision: https://reviews.freebsd.org/D31776

3 years agobnxt(4): Mark sysctls MP-safe.
Alexander Motin [Fri, 3 Sep 2021 17:51:08 +0000 (13:51 -0400)]
bnxt(4):  Mark sysctls MP-safe.

MFC after: 1 month

3 years agobxe(4): Mark sysctls and callout MP-safe.
Alexander Motin [Fri, 3 Sep 2021 16:25:32 +0000 (12:25 -0400)]
bxe(4): Mark sysctls and callout MP-safe.

MFC after: 1 month

3 years agomge(4): Mark sysctls and callout MP-safe.
Alexander Motin [Fri, 3 Sep 2021 16:13:56 +0000 (12:13 -0400)]
mge(4): Mark sysctls and callout MP-safe.

MFC after: 1 month

3 years agollvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLo...
Alfredo Dal'Ava Junior [Thu, 2 Sep 2021 17:54:31 +0000 (14:54 -0300)]
llvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount."

Reverts llvm commit 42eaf4fe0adef3344adfd9fbccd49f325cb549ef, pointed
from bisect as source of regression that causes liblzma to compress/
uncompress incorrectly. It's know to affect powerpc64 BE only.

The patch unbreaks FreeBSD powerpc64 installation media, since
bsdinstall can't uncompress the *.txz produced by FreeBSD CI. It's
probably miscompiling other software bas well.

Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=51714

Reviewed by: dim
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D31804

3 years agowpa: Enable RSN Preauthentication
Cy Schubert [Fri, 3 Sep 2021 13:14:59 +0000 (06:14 -0700)]
wpa: Enable RSN Preauthentication

RSN Preauthentication allows a station autnetnicate to an AP that
it is not associated with yet while associated with a different AP.
This allows athentication to multiple APs simulteneously.

Tested by: philip
MFC after: 2 months

3 years agowpa: Enable MBO
Cy Schubert [Fri, 3 Sep 2021 13:14:01 +0000 (06:14 -0700)]
wpa: Enable MBO

Enable WiFi 6 MBO (Multi Band Operation). MBO is a prereq to 802.11ax.

MBO allows the efficient use of multiple frequency bands (channels).

To facilitate MBO, WNM (Wireless Network Monitoring) is a prerequisite.
It is required to build.

Tested by: philip
MFC after: 2 months

3 years agowpa: Import wpa_supplicant/hostapd commits up to b4f7506ff
Cy Schubert [Fri, 3 Sep 2021 13:07:19 +0000 (06:07 -0700)]
wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff

Merge vendor commits 40c7ff83e74eabba5a7e2caefeea12372b2d3f9a,
efec8223892b3e677acb46eae84ec3534989971f, and
2f6c3ea9600b494d24cac5a38c1cea0ac192245e.

Tested by: philip
MFC after: 2 months

3 years agopf: ensure states passed to pf_free_state() are always unlinked
Kristof Provost [Fri, 3 Sep 2021 07:36:19 +0000 (09:36 +0200)]
pf: ensure states passed to pf_free_state() are always unlinked

In pf_create_state() we can end up deleting the state immediately. This
can happen if we fail to map the relevant addresses or fail
normalization or fail to insert it into the state table.
If that happens we delete the state again with pf_free_state(). However,
this asserts that the state must be unlinked.

It's correct to simply set the state to PFTM_UNLINKED because we've not
yet linked it.

Submitted by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed by: scottl
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31752

3 years agotcp: document TCP Fast Open (RFC 7413) in tcp(4)
Philip Paeps [Fri, 3 Sep 2021 02:33:12 +0000 (10:33 +0800)]
tcp: document TCP Fast Open (RFC 7413) in tcp(4)

Adds documentation for the TCP_FASTOPEN socket option
and related MIB variables to the tcp(4) manual page.

PR: 257907
Reviewed by: gbe
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31764

3 years agoMissed line from 7af4475a6e31.
Alexander Motin [Fri, 3 Sep 2021 02:25:16 +0000 (22:25 -0400)]
Missed line from 7af4475a6e31.

MFC after: 2 weeks

3 years agocallout(9): Allow spin locks use with callout_init_mtx().
Alexander Motin [Fri, 3 Sep 2021 01:16:46 +0000 (21:16 -0400)]
callout(9): Allow spin locks use with callout_init_mtx().

Implement lock_spin()/unlock_spin() lock class methods, moving the
assertion to _sleep() instead.  Change assertions in callout(9) to
allow spin locks for both regular and C_DIRECT_EXEC cases. In case of
C_DIRECT_EXEC callouts spin locks are the only locks allowed actually.

As the first use case allow taskqueue_enqueue_timeout() use on fast
task queues.  It actually becomes more efficient due to avoided extra
context switches in callout(9) thanks to C_DIRECT_EXEC.

MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D31778

3 years agovmd(4): Major driver refactoring
Alexander Motin [Fri, 3 Sep 2021 00:58:02 +0000 (20:58 -0400)]
vmd(4): Major driver refactoring

 - Re-implement pcib interface to use standard pci bus driver on top of
vmd(4) instead of custom one.
 - Re-implement memory/bus resource allocation to properly handle even
complicated configurations.
 - Re-implement interrupt handling to evenly distribute children's MSI/
MSI-X interrupts between available vmd(4) MSI-X vectors and setup them
to be handled by standard OS mechanisms with minimal overhead, except
sharing when unavoidable.

Successfully tested on Dell XPS 13 laptop with Core i7-1185G7 CPU (VMD
device ID 0x9a0b) and single NVMe SSD, dual-booting with Windows 10.

Successfully tested on Supermicro X11DPI-NT motherboard with Xeon(R)
Gold 6242R CPUs (VMD device ID 0x201d), simultaneously handling NVMe
SSD on one PCIe port and PLX bridge with 3 NVMe and 1 AHCI SSDs on
another.  Handles SSD hot-plug (except Optane 905p for some reason,
which are not detected until manual bus rescan) and enabled IOMMU
(directly connected SSDs work, but ones connected to the PLX fail
without errors from IOMMU).

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential revision: https://reviews.freebsd.org/D31762

3 years agobnxt(4): Fix bugs in WOL support.
Alexander Motin [Thu, 2 Sep 2021 22:11:58 +0000 (18:11 -0400)]
bnxt(4): Fix bugs in WOL support.

Before this change driver reported IFCAP_WOL_MAGIC enabled, but not
supported.  It caused errors on some SIOCSIFCAP calls.  Instead
report the support if hardware supports WOL, and enabled status if
it has such filter installed on boot.

Also bnxt_wol_config() should check WOL status in if_getcapenable(),
not in if_getcapabilities() to get current one.

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

3 years agoloader.efi: fix console output after BS off
Toomas Soome [Thu, 2 Sep 2021 21:17:32 +0000 (00:17 +0300)]
loader.efi: fix console output after BS off

When Boot Services (BS) are switched off, we can not use BS
functions any more. Since drawn console does implement our own
Blt(), we can use it to draw the console.

However, SimpleTextOutput protocol based console output must be
blocked.

Tested by inserting printf() after ExitBootServices() call.

MFC after: 1 week

3 years agoses: Guard the elm_type_names declaration by _KERNEL
Alan Somers [Mon, 30 Aug 2021 20:45:13 +0000 (14:45 -0600)]
ses: Guard the elm_type_names declaration by _KERNEL

MFC after: 2 weeks
Sponsored by: Axcient

3 years agoses: Correct spelling of "Temperature Sensor"
Alan Somers [Mon, 30 Aug 2021 19:59:32 +0000 (13:59 -0600)]
ses: Correct spelling of "Temperature Sensor"

According to SES 4 revision 2 table 71, it should be singular.

MFC after: 2 weeks
Sponsored by: Axcient

3 years agohmt(4): Add support for touchpads with no "button type" or
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:51 +0000 (22:33 +0300)]
hmt(4): Add support for touchpads with no "button type" or

"maximum number of contacts" usages.

Assume touchpad to be a clickpad if it has only internal button.
Set number of contacts to 5 for touchpads and to 10 for touchscreens.
Check for fetched report length to avoid reading of stalled data.
Fixes Dell Precision 7550 laptop.

Tested by: Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
PR: 257992
MFC after: 2 week

3 years agohpen(4): Add support for legacy MS-compatible single touch protocol
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:24 +0000 (22:33 +0300)]
hpen(4): Add support for legacy MS-compatible single touch protocol

It is used by many pre- and post- 2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 2 week

3 years agohidbus(4): Add routine to check presence of collection of given usage
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:57 +0000 (22:32 +0300)]
hidbus(4): Add routine to check presence of collection of given usage

MFC after: 2 week

3 years agohidmap: Do not forget to initialize bitmap items to unset state
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:14 +0000 (22:32 +0300)]
hidmap: Do not forget to initialize bitmap items to unset state

MFC after: 2 week

3 years agohidmap: Implement forbidden flag for hidmap item.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:51 +0000 (22:31 +0300)]
hidmap: Implement forbidden flag for hidmap item.

If HID usage is mapped to evdev event by hidmap item marked with this
flag than entire driver attachment is blocked.

MFC after: 2 week

3 years agohmt(4): Add support for serial packet reporting mode
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:17 +0000 (22:31 +0300)]
hmt(4): Add support for serial packet reporting mode

In Serial mode, each packet contains information that describes a
single physical contact point. Multiple contacts are streamed
serially. In this mode, devices report all contact information in a
series of packets. The device sends a separate packet for each
concurrent contact.

Serial packet reporting mode is used by post-2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 2 weeks

3 years agopsm: Use evdev autorelease feature for Synaptics and Elantech drivers
Vladimir Kondratyev [Thu, 2 Sep 2021 19:30:29 +0000 (22:30 +0300)]
psm: Use evdev autorelease feature for Synaptics and Elantech drivers

MFC after: 2 weeks

3 years agopsm: Enable touch-tracking for late Synaptics PS/2 touchpads.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:29:49 +0000 (22:29 +0300)]
psm: Enable touch-tracking for late Synaptics PS/2 touchpads.

They are true multitouch internally but Synaptics PS/2 protocol
limitations do not all allow to export touch identificators.

MFC after: 2 weeks

3 years agoevdev: Do not export multitouch functions which are unused outside evdev
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:34 +0000 (22:28 +0300)]
evdev: Do not export multitouch functions which are unused outside evdev

3 years agocyapa(4): Adapt to recent evdev KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:05 +0000 (22:28 +0300)]
cyapa(4): Adapt to recent evdev KPI changes

MFC after: 2 weeks

3 years agowmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:27:02 +0000 (22:27 +0300)]
wmt(4): Adapt to recent KPI changes

MFC after: 2 weeks

3 years agohmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:25:27 +0000 (22:25 +0300)]
hmt(4): Adapt to recent KPI changes

MFC after: 2 weeks

3 years agoopenssh: diff reduction against upstream 7.9p1
Ed Maste [Thu, 2 Sep 2021 17:38:30 +0000 (13:38 -0400)]
openssh: diff reduction against upstream 7.9p1

Clean up whitespace and nonfunctional differences, and unused functions.

3 years agocluster_write(): do not access buffer after it is released
Konstantin Belousov [Thu, 2 Sep 2021 04:04:23 +0000 (07:04 +0300)]
cluster_write(): do not access buffer after it is released

The 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.

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

3 years agovmem: disable debug.vmem_check by default
Mateusz Guzik [Thu, 2 Sep 2021 09:49:39 +0000 (11:49 +0200)]
vmem: disable debug.vmem_check by default

It has a prohibitive performance impact when running real workloads.

Note this only affects kernels with DIAGNOSTIC.

Reviewed by: markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31784

3 years agogetdelim(3): Fix losing data on [EAGAIN]
Bryan Drewery [Wed, 25 Aug 2021 18:37:11 +0000 (11:37 -0700)]
getdelim(3): Fix losing data on [EAGAIN]

Currently when an [EAGAIN] is encountered we return a partial result
that does not contain the delimeter.  On the next (successful) read we
were returning the next part of the line without the preceding string
from the first failed call.

Fix this by using the same mechanism as ungetc(3) does.  For the buffered
case we could simply set fp->_r and fp->_p back to their values before
sappend() is ran but for simplicity ungetc(3) is done in there as well.

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

3 years agoopenssh: regenerate freebsd-namespace.h
Ed Maste [Thu, 2 Sep 2021 01:54:57 +0000 (21:54 -0400)]
openssh: regenerate freebsd-namespace.h

For some reason poly64 was omitted when this file was last generated
(perhaps it was inlined by the Clang version then in use).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoopenssh: tag generated file with @generated
Ed Maste [Thu, 2 Sep 2021 01:49:44 +0000 (21:49 -0400)]
openssh: tag generated file with @generated

Tools like Phabricator use the @generated tag to identify files that
may be excluded from review by default.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agodtrace: fix ipfw_rule_info_t translator
Andrey V. Elsukov [Thu, 2 Sep 2021 13:35:01 +0000 (16:35 +0300)]
dtrace: fix ipfw_rule_info_t translator

322e5efda8578b has changed field names in the struct ip_fw.
Use correct names in ipfw_rule_info_t translator in the ipfw.d script.

Reported by: Keith White <kwhite uottawa at gmail>
MFC after: 1 week

3 years agoSymbol.map: Remove an extra space before _Fork
Ka Ho Ng [Thu, 2 Sep 2021 13:07:08 +0000 (21:07 +0800)]
Symbol.map: Remove an extra space before _Fork

Make it consistent with all other entries.

Sponsored by: The FreeBSD Foundation

3 years agoman: A trailing space cleanup in man9's Makefile
Ka Ho Ng [Thu, 2 Sep 2021 13:04:01 +0000 (21:04 +0800)]
man: A trailing space cleanup in man9's Makefile

Sponsored by: The FreeBSD Foundation

3 years agopfctl: Don't use PRIu64
Kristof Provost [Wed, 1 Sep 2021 16:18:26 +0000 (18:18 +0200)]
pfctl: Don't use PRIu64

Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

MFC after: 1 week
Suggested by: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agostress2: Update test to new working of option nomtime
Peter Holm [Thu, 2 Sep 2021 07:12:58 +0000 (07:12 +0000)]
stress2: Update test to new working of option nomtime

3 years agostress2: Added timeout for looping mdnsd
Peter Holm [Thu, 2 Sep 2021 07:11:01 +0000 (07:11 +0000)]
stress2: Added timeout for looping mdnsd

3 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:09:39 +0000 (07:09 +0000)]
stress2: Fix cleanup

3 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:08:58 +0000 (07:08 +0000)]
stress2: Fix cleanup

3 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:07:44 +0000 (07:07 +0000)]
stress2: Fix cleanup

3 years agostress2: Make test less verbose
Peter Holm [Thu, 2 Sep 2021 07:06:55 +0000 (07:06 +0000)]
stress2: Make test less verbose

3 years agoopenssh: regenerate config.h
Ed Maste [Thu, 2 Sep 2021 00:35:45 +0000 (20:35 -0400)]
openssh: regenerate config.h

Since config.h was last regenerated FreeBSD has added (a stub) libdl,
and has removed sys/dir.h.  Regenerate config.h to avoid spurious
additional changes when OpenSSH is next updated.

There should be no issue if this change is MFC'd, but I don't plan to do
so.  Although configure checks for libdl HAVE_LIBDL isn't even used, and
sys/dir.h was non-functional before being removed.  The state of these
two config.h settings should make no difference in the built OpenSSH.

Sponsored by: The FreeBSD Foundation

3 years agoopenssh: disable libwrap (TCP wrappers) at configure time
Ed Maste [Thu, 2 Sep 2021 00:30:05 +0000 (20:30 -0400)]
openssh: disable libwrap (TCP wrappers) at configure time

We define LIBWRAP at build time in secure/usr.sbin/sshd/Makefile if
WITH_TCPWRAPPERS is in effect, so it should not be set in config.h.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoopenssh: clarify krb5 use in freebsd-configure
Ed Maste [Thu, 2 Sep 2021 00:23:40 +0000 (20:23 -0400)]
openssh: clarify krb5 use in freebsd-configure

freebsd-configure.sh runs configure twice, --with-kerberos5 and
--without-kerberos5, in order to build a config.h that defaults to
kerberos5 disabled, and a small config file that represents the
differences.

Rename config.h.orig to config.h.kerberos5 to clarify the intent of this
script.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoena: Update driver version to v2.4.1
Michal Krawczyk [Thu, 12 Aug 2021 08:34:30 +0000 (10:34 +0200)]
ena: Update driver version to v2.4.1

Some of the changes in this release:
* Hardware RSS hash key reconfiguration and indirection table
reconfiguration support.
* Full kernel RSS support.
* Extra statistic counters.
* Netmap support for ENAv3.
* Locking assertions.
* Extra log messages.
* Reset handling fixes.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Implement full RSS reconfiguration
Artur Rojek [Thu, 12 Aug 2021 08:34:29 +0000 (10:34 +0200)]
ena: Implement full RSS reconfiguration

Bind RX/TX queues and MSI-X vectors to matching CPUs based on the RSS
bucket entries.

Introduce sysctls for the following RSS functionality:
- rss.indir_table:      indirection table mapping
- rss.indir_table_size: indirection table size
- rss.key:              RSS hash key (if Toeplitz used)

Said sysctls are only available when compiled without `option RSS`, as
kernel-side RSS support currently doesn't offer RSS reconfiguration.

Migrate the hash algorithm from CRC32 to Toeplitz and change the initial
hash value to 0x0 in order to match the standard Toeplitz implementation.
Provide helpers for hash key inversion required for HW operations.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Add missing statistics
Artur Rojek [Thu, 12 Aug 2021 08:34:29 +0000 (10:34 +0200)]
ena: Add missing statistics

Provide the following sysctl statistics in order to stay aligned with
the Linux driver:
* rx_ring.csum_good
* tx_ring.unmask_interrupt_num

Also rename the 'bad_csum' statistic name to 'csum_bad' for alignment.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Share ena_global_lock between driver instances
Artur Rojek [Thu, 12 Aug 2021 08:34:28 +0000 (10:34 +0200)]
ena: Share ena_global_lock between driver instances

In order to use `ena_global_lock` in sysctl context, it must be kept
outside the driver instance's software context, as sysctls can be called
before attach and after detach, leading to lock use before sx_init and
after sx_destroy otherwise.
Solve this issue by turning `ena_global_lock` into a file scope
variable, shared between all instances of the driver and associated
sysctl context, and in turn initialized/destroyed in dedicated
SYSINIT/SYSUNINIT functions.
As a side effect, this change also fixes existing race in the reset
routine, when simultaneously accessing sysctl exposed properties.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Disable meta descriptor caching for netmap
Artur Rojek [Thu, 12 Aug 2021 08:34:28 +0000 (10:34 +0200)]
ena: Disable meta descriptor caching for netmap

If LLQ is being used, `ena_tx_ctx.meta_valid` must stay enabled. This
fixes netmap support on latest generation ENA HW and aligns it with the
core driver behavior.

As netmap doesn't support any csum offloads, the
`adapter->disable_meta_caching` value can be simply passed to the HW.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Move RSS logic into its own source files
Artur Rojek [Thu, 12 Aug 2021 08:34:27 +0000 (10:34 +0200)]
ena: Move RSS logic into its own source files

Delegate RSS related functionality into separate .c/.h files in
preparation for the full RSS support.

While at it, reorder functions and remove prototypes for ones with
internal linkage.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Add locking assertions
Artur Rojek [Thu, 12 Aug 2021 08:34:26 +0000 (10:34 +0200)]
ena: Add locking assertions

ENA silently assumed that ena_up, ena_down and ena_start_xmit routines
should be called within locked context. Driver's logic heavily assumes
on concurrent access to those routines, so for safety and better
documentation about this assumption, the locking assertions were added
to the above functions.

The assertion was added only for the main steps (skipping the helper
functions) which can be called from multiple places including the kernel
and the driver itself.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Add extra log messages
Artur Rojek [Thu, 12 Aug 2021 08:34:26 +0000 (10:34 +0200)]
ena: Add extra log messages

Stay aligned with the Linux driver by adding the following logs:
* inform the user about retrying queue creation
* warn on non-empty ena_tx_buffer.mbuf prior to ena_tx_map_mbuf

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Prevent reset after device destruction
Artur Rojek [Thu, 12 Aug 2021 08:34:25 +0000 (10:34 +0200)]
ena: Prevent reset after device destruction

Check for ENA_FLAG_TRIGGER_RESET inside a locked context in order to
avoid potential race conditions with ena_destroy_device. This aligns the
reset task logic with the Linux driver.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Trigger reset on ena_com_prepare_tx failure
Artur Rojek [Thu, 12 Aug 2021 08:34:24 +0000 (10:34 +0200)]
ena: Trigger reset on ena_com_prepare_tx failure

All ena_com_prepare_tx errors other than ENA_COM_NO_MEM are fatal and
require device reset.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agoena: Avoid unnecessary mbuf collapses for LLQ condition
Artur Rojek [Thu, 12 Aug 2021 08:34:17 +0000 (10:34 +0200)]
ena: Avoid unnecessary mbuf collapses for LLQ condition

In case of Low-latency Queue, one small enough descriptor can be pushed
directly to the ENA hw, thus saving one fragment. Check for this
condition before performing collapse.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

3 years agosyscalls.master: correct formatting issues
Brooks Davis [Wed, 1 Sep 2021 20:54:38 +0000 (21:54 +0100)]
syscalls.master: correct formatting issues

Reviewed by: kevans, emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31351

3 years agosyscalls.master: switch to CAPENABLED flags
Brooks Davis [Wed, 1 Sep 2021 20:54:38 +0000 (21:54 +0100)]
syscalls.master: switch to CAPENABLED flags

Switch the main syscall table to use CAPENABLED flags rather than
capabilities.conf.  This avoid synchronization issues between
syscalls.master and capabilities.conf (e.g. when renaming a syscall
during development).

For now, move capabilities.conf to sys/compat/freebsd32 and use it
there.  Use of sys/compat/freebsd32/syscalls.master should be replaced
by makesyscalls.lua enhancements to allow the main one to be used.

This change results in no changes to generated files after running
`make sysent`.

Reviewed by: kevans, emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31350

3 years agomakesyscalls.lua: add a CAPENABLED flag
Brooks Davis [Wed, 1 Sep 2021 20:54:38 +0000 (21:54 +0100)]
makesyscalls.lua: add a CAPENABLED flag

The CAPENABLED flag indicates that the syscall can be used in capsicum
capability mode.  It is intended to replace capabilities.conf.

Reviewed by: kevans, emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31349

3 years agoRevert "arm: Bump KSTACK_PAGES default to match i386/amd64"
Kevin Bowling [Wed, 1 Sep 2021 20:06:27 +0000 (13:06 -0700)]
Revert "arm: Bump KSTACK_PAGES default to match i386/amd64"

This reverts commit b684d812fcb04b2997fd755405a92c36b9f6e30e.

It causes an issue on a pfsense routing workload where memory
fragmentation prevents the necessary consecutive pages from being
readily available.

Reported by: pfsense (mjg, scottl)
Approved by: ian
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D31244

3 years agoppbus: Set the lock for pps interface, update to latest api
Warner Losh [Wed, 1 Sep 2021 19:37:27 +0000 (13:37 -0600)]
ppbus: Set the lock for pps interface, update to latest api

Since we take a lock when we enter the ioctl, we need to set driver_mtx
in the pps structure so it can be dropped while sleeping during a call
to timepps_fetch() with a non-zero timeout (PPS_CANWAIT feature).

MFC After: 5 days
Sponsored by: Netflix
Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D31763

3 years agoopenssh: update note about class-based login restrictions
Ed Maste [Wed, 1 Sep 2021 20:09:56 +0000 (16:09 -0400)]
openssh: update note about class-based login restrictions

3 years agoopenssh: simplify login class restrictions
Ed Maste [Tue, 31 Aug 2021 19:30:50 +0000 (15:30 -0400)]
openssh: simplify login class restrictions

Login class-based restrictions were introduced in 5b400a39b8ad.  The
code was adapted for sshd's Capsicum sandbox and received many changes
over time, including at least fc3c19a9fceebd393de91cc3, and
e8c56fba2926.

During an attempt to upstream the work a much simpler approach was
suggested.  Adopt it now in the in-tree OpenSSH to reduce conflicts with
future updates.

Submitted by: Yuchiro Naito (against OpenSSH-portable on GitHub)
Obtained from: https://github.com/openssh/openssh-portable/pull/262
Reviewed by: allanjude, kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31760

3 years agokevent: Fix races between timer detach and kqtimer_proc_continue()
Mark Johnston [Wed, 1 Sep 2021 18:18:58 +0000 (14:18 -0400)]
kevent: Fix races between timer detach and kqtimer_proc_continue()

- When detaching a knote, we need to double check the enqueued flag
  after acquiring the process lock, as kqtimer_proc_continue() may have
  toggled it.
- kqtimer_proc_continue() could in principle reschedule a stopped
  callout after filt_timerdetach() drains the callout.  So, we need to
  re-check.

Reported by: syzbot+4a4cebb3ec07892cb040@syzkaller.appspotmail.com
Reported by: syzbot+a9c04bc76078a3b7dd8d@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31772

3 years agopf tests: altq:codel_bridge requires if_bridge
Kristof Provost [Wed, 1 Sep 2021 14:09:14 +0000 (16:09 +0200)]
pf tests: altq:codel_bridge requires if_bridge

Check that the bridge module is loaded before running this test.
It likely will be (as a result of running the bridge tests), but if it's
not we'll get spurious failures.

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

3 years agounionfs: style
Jason A. Harmening [Tue, 31 Aug 2021 01:55:42 +0000 (18:55 -0700)]
unionfs: style

Fix the more egregious style(9) violations in unionfs.
No functional change intended.

3 years agounionfs: rework pathname handling
Jason A. Harmening [Sun, 29 Aug 2021 21:36:15 +0000 (14:36 -0700)]
unionfs: rework pathname handling

Running stress2 unionfs tests reliably produces a namei_zone corruption
panic due to unionfs_relookup() attempting to NUL-terminate a newly-
allocate pathname buffer without first validating the buffer length.

Instead, avoid allocating new pathname buffers in unionfs entirely,
using already-provided buffers while ensuring the the correct flags
are set in struct componentname to prevent freeing or manipulation
of those buffers at lower layers.

While here, also compute and store the path length once in the unionfs
node instead of constantly invoking strlen() on it.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D31728

3 years agosctp: Always check for a vanishing inpcb when processing COOKIE-ECHO
Mark Johnston [Wed, 1 Sep 2021 14:28:17 +0000 (10:28 -0400)]
sctp: Always check for a vanishing inpcb when processing COOKIE-ECHO

We previously did this only in the normal case where no association
exists yet.  However, it is not safe to process COOKIE-ECHO even if an
association exists, as sctp_process_cookie_existing() may dereference
the socket pointer.

See also commit 0c7dc84076b64ef74c24f04400d572f75ef61bb4.

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

3 years agosctp: Hold association locks across socket wakeups when freeing
Mark Johnston [Wed, 1 Sep 2021 14:27:51 +0000 (10:27 -0400)]
sctp: Hold association locks across socket wakeups when freeing

At this point we do not hold the inpcb lock, so the only thing holding
the socket reference live is the TCB lock, which needs to be acquired by
sctp_inpcb_free() in order to destroy associations.  Defer the unlock to
until after we dereference the socket reference.

Reported by: syzbot+1d0f2c4675de76a4cf1e@syzkaller.appspotmail.com
Reported by: syzbot+fabee77954fe69d3a5ad@syzkaller.appspotmail.com
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31754

3 years agosctp: Release the socket reference when detaching an association
Mark Johnston [Wed, 1 Sep 2021 14:27:31 +0000 (10:27 -0400)]
sctp: Release the socket reference when detaching an association

Later in sctp_free_assoc(), when we clean up chunk lists,
sctp_free_spbufspace() is used to reset the byte count in the socket
send buffer.  However, if the PCB is going away, the socket may already
have been detached from the PCB, in which case this becomes a use-after
free.  Clear the socket reference from the association before detaching
it from the PCB, if the PCB has already lost its socket reference.

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

3 years agosctp: Implement sctp_inpcb_bind_locked()
Mark Johnston [Wed, 1 Sep 2021 14:04:47 +0000 (10:04 -0400)]
sctp: Implement sctp_inpcb_bind_locked()

This will be used by sctp_listen() to avoid dropping locks when
performing an implicit bind.  No functional change intended.

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

3 years agosctp: Add macros to assert on inp info lock state
Mark Johnston [Wed, 1 Sep 2021 14:06:02 +0000 (10:06 -0400)]
sctp: Add macros to assert on inp info lock state

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

3 years agovfs: Use file_cred for VOP_DEALLOCATE in vn_deallocate if non-NULL
Ka Ho Ng [Wed, 1 Sep 2021 12:18:24 +0000 (20:18 +0800)]
vfs: Use file_cred for VOP_DEALLOCATE in vn_deallocate if non-NULL

This changes vn_deallocate() to match the behavior of vn_rdwr() when
picking which ucred to use. That is, vn_deallocate() uses file_cred for
making VOP call if it is non-NULL, or use active_cred otherwise.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31712

3 years agoif_cdce: Add support for setting RX filtering
Kornel Duleba [Tue, 31 Aug 2021 12:22:30 +0000 (14:22 +0200)]
if_cdce: Add support for setting RX filtering

We can now set promisc and allmulti modes.
Filtering of given multicast addresses is not supported.
Changing the mode is done by sending a command described in:
"USB CDC Subclass Specification for Ethernet Devices v1.2, section 6.2.4".
This means that at least in theory this feature should work with all
modems that are using this driver.

This fixes Huawei E3372h-320 running new firmware in "HiLink" mode.
Previously it would reset a few seconds after its mode was changed
with "usb_modeswitch".
Setting RX filter to default value at the end of attach function
fixed that.

Sponsored by: Stormshield
Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D31766
MFC after: 2 weeks
Reviewed by: hps

3 years agopf: import pf_set_protostate() from OpenBSD
Kristof Provost [Tue, 20 Jul 2021 16:38:16 +0000 (18:38 +0200)]
pf: import pf_set_protostate() from OpenBSD

to change a state's state (that term is overloaded in pf, protocol state
like ESTABLISHED for tcp here), don't do it directly, but go through a newly
introduced pf_set_protostate()

Reviewed by: kbowling
Obtainted from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31729

3 years agopf: Add counters for syncookies
Kristof Provost [Sun, 29 Aug 2021 13:54:50 +0000 (15:54 +0200)]
pf: Add counters for syncookies

Count when we send a syncookie, receive a valid syncookie or detect a
synflood.

Reviewed by: kbowling
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31713

3 years agocam: revert second half of 75b5caa08ef
Edward Tomasz Napierala [Wed, 1 Sep 2021 09:34:27 +0000 (09:34 +0000)]
cam: revert second half of 75b5caa08ef

This turns debugging printf() into a KASSERT().

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31523

3 years agorouting: Disallow zero nexthop weights in nexthop groups.
Alexander V. Chernikov [Mon, 30 Aug 2021 21:49:00 +0000 (21:49 +0000)]
routing: Disallow zero nexthop weights in nexthop groups.

Adding such nexthops breaks calc_min_mpath_slots() assumptions,
 thus resulting in the incorrect nexthop group creation and
 eventually leading to panic.
Reported by: avg
MFC after: 1 week