]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUpdate .clang-format with style(9) header-sorting
Conrad Meyer [Wed, 24 Jun 2020 18:40:43 +0000 (18:40 +0000)]
Update .clang-format with style(9) header-sorting

Thanks to work done in the NetBSD clang-format project.  No functional change.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25428

3 years agoAlways compile the brand and ignore init ELF notes standalone.
John Baldwin [Wed, 24 Jun 2020 17:54:24 +0000 (17:54 +0000)]
Always compile the brand and ignore init ELF notes standalone.

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

3 years agoRegenerate src.conf.5 after r362587
Conrad Meyer [Wed, 24 Jun 2020 17:31:21 +0000 (17:31 +0000)]
Regenerate src.conf.5 after r362587

3 years agoAdd WITH_CLANG_FORMAT option
Conrad Meyer [Wed, 24 Jun 2020 17:03:42 +0000 (17:03 +0000)]
Add WITH_CLANG_FORMAT option

clang-format is enabled conditional on either WITH_CLANG_EXTRAS or
WITH_CLANG_FORMAT.  Some sources in libclang are build conditional on
either rule, and obviously the clang-format binary itself depends on the
rule.

clang-format could still use a manual page.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D25427

3 years agoipfw(4): make O_IPVER/ipversion match IPv4 or 6, not just IPv4.
Mark Johnston [Wed, 24 Jun 2020 15:46:33 +0000 (15:46 +0000)]
ipfw(4): make O_IPVER/ipversion match IPv4 or 6, not just IPv4.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Reviewed by: Lutz Donnerhacke
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25227

3 years agoOnly invalidate the early DTB mapping if it exists
Mitchell Horne [Wed, 24 Jun 2020 15:21:12 +0000 (15:21 +0000)]
Only invalidate the early DTB mapping if it exists

This temporary mapping will become optional. Booting via loader(8)
means that the DTB will have already been copied into the kernel's
staging area, and is therefore covered by the early KVA mappings.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D24911

3 years agoHandle load from loader(8)
Mitchell Horne [Wed, 24 Jun 2020 15:20:00 +0000 (15:20 +0000)]
Handle load from loader(8)

In locore, we must detect and handle different arguments passed by
loader(8) compared to what we recieve when booting directly via SBI
firmware. Currently we receive the hart ID in a0 and a pointer to the
device tree blob in a1. loader(8) provides only a pointer to its
metadata in a0.

The solution to this is to add an additional entry point, _alt_start.
This will be placed first in the .text section, so SBI firmware will
enter here, and jump to the common pagetable setup shortly after. Since
loader(8) understands our ELF kernel, it will enter at the ELF's entry
address, which points to _start. This approach leads to very little
guesswork as to which way we booted.

Fix-up initriscv() to parse the loader's metadata, continuing to use
fake_preload_metadata() in the SBI direct boot case.

Reviewed by: markj, jrtc27 (asm portion)
Differential Revision: https://reviews.freebsd.org/D24912

3 years agoipfw(8): In fill_ip6(), use a single statement for both "me" and "me6".
Mark Johnston [Wed, 24 Jun 2020 15:05:42 +0000 (15:05 +0000)]
ipfw(8): In fill_ip6(), use a single statement for both "me" and "me6".

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Reviewed by: rgrimes, Lutz Donnerhacke
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24403

3 years agoFix the acconting for fragmented unordered messages when using
Michael Tuexen [Wed, 24 Jun 2020 14:47:51 +0000 (14:47 +0000)]
Fix the acconting for fragmented unordered messages when using
interleaving.
This was reported for the userland stack in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19321

MFC after: 1 week

3 years agoTCP: fix cubic RTO reaction.
Richard Scheffenegger [Wed, 24 Jun 2020 13:52:53 +0000 (13:52 +0000)]
TCP: fix cubic RTO reaction.

Proper TCP Cubic operation requires the knowledge
of the maximum congestion window prior to the
last congestion event.

This restores and improves a bugfix previously added
by jtl@ but subsequently removed due to a revert.

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

3 years agoTCP: make after-idle work for transactional sessions.
Richard Scheffenegger [Wed, 24 Jun 2020 13:42:42 +0000 (13:42 +0000)]
TCP: make after-idle work for transactional sessions.

The use of t_rcvtime as proxy for the last transmission
fails for transactional IO, where the client requests
data before the server can respond with a bulk transfer.

Set aside a dedicated variable to actually track the last
locally sent segment going forward.

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

3 years agoEnable long double tests on RISC-V
Mitchell Horne [Wed, 24 Jun 2020 13:11:19 +0000 (13:11 +0000)]
Enable long double tests on RISC-V

Some of the NetBSD contributed tests are gated behind the
__HAVE_LONG_DOUBLE flag. This flag seems to be defined only for
platforms whose long double is larger than their double. I could not
find this explicitly documented anywhere, but it is implied by the
definitions in NetBSD's sys/arch/${arch}/include/math.h headers, and the
following assertion from the UBSAN code:

  #ifdef __HAVE_LONG_DOUBLE
      long double LD;
      ASSERT(sizeof(LD) > sizeof(uint64_t));
  #endif

RISC-V has 128-bit long doubles, so enable the tests on this platform,
and update the comments to better explain the purpose of this flag.

Reviewed by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25419

3 years agoMake sys.auditpipe depend on /dev/auditpipe. This fixes a few failures
Edward Tomasz Napierala [Wed, 24 Jun 2020 12:17:40 +0000 (12:17 +0000)]
Make sys.auditpipe depend on /dev/auditpipe.  This fixes a few failures
on armv7.

MFC after: 2 weeks
Sponsored by: DARPA

3 years agoFix AccessWidth and BitWidth parsing in SPCR table
Marcin Wojtas [Wed, 24 Jun 2020 12:15:27 +0000 (12:15 +0000)]
Fix AccessWidth and BitWidth parsing in SPCR table

The ACPI Specification defines a Generic Address Structure (GAS),
which is used to describe UART controller register layout in the
SPCR table. The driver responsible for parsing it (uart_cpu_acpi)
wrongly associates the Access Size field to the uart_bas's regshft
and the register BitWidth to the regiowidth - according to
the definitions it should be opposite.

This problem remained hidden most likely because the majority of platforms
use 32-bit registers (BitWidth) which are accessed with the according
size (Dword). However on Marvell Armada 8k / Cn913x platforms,
the 32-bit registers should be accessed with Byte granulity, which
unveiled the issue.

This patch fixes above by proper values assignment and slightly improved
parsing.

Note that handling of the AccessWidth set to EFI_ACPI_6_0_UNDEFINED is
needed to work around a buggy SPCR table on EC2 x86 "bare metal" instances.

Reviewed by: manu, imp, cperciva, greg_unrelenting.technology
Obtained from: Semihalf
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25373

3 years agoTemporarily skip unstable sys.geom.class.gate.ggate_test.ggated on i386 in CI
Li-Wen Hsu [Wed, 24 Jun 2020 07:25:54 +0000 (07:25 +0000)]
Temporarily skip unstable sys.geom.class.gate.ggate_test.ggated on i386 in CI

PR: 244737
Sponsored by: The FreeBSD Foundation

3 years agoFix build with recent byacc.
Jung-uk Kim [Wed, 24 Jun 2020 02:08:08 +0000 (02:08 +0000)]
Fix build with recent byacc.

3 years agoMFV r362565:
Cy Schubert [Wed, 24 Jun 2020 01:51:05 +0000 (01:51 +0000)]
MFV r362565:

Update 4.2.8p14 --> 4.2.8p15

Summary: Systems that use a CMAC algorithm in ntp.keys will not release
a bit of memory on each packet that uses a CMAC keyid, eventually causing
ntpd to run out of memory and fail. The CMAC cleanup from
https://bugs.ntp.org/3447, part of ntp-4.2.8p11, introduced a bug whereby
the CMAC data structure was no longer completely removed.

MFC after: 3 days
Security: NTP Bug 3661

3 years agoImport ntp-4.2.8p15.
Cy Schubert [Wed, 24 Jun 2020 00:20:45 +0000 (00:20 +0000)]
Import ntp-4.2.8p15.

Security: ntp bug 3661

3 years agostand: remove redundant declarations
Kyle Evans [Tue, 23 Jun 2020 23:52:43 +0000 (23:52 +0000)]
stand: remove redundant declarations

These are picked out by the amd64-gcc6 build; time() is declared in <time.h>
and delay() is declared in <bootstrap.h>. These are the correct places for
these in stand/, so remove the duplicate declarations and make sure the
delay() consumer in libefi that depended on the extra delay() declaration
includes <bootstrap.h>.

MFC after: 1 week

3 years agoFix alignment issue manifesting in the userland stack.
Michael Tuexen [Tue, 23 Jun 2020 23:05:05 +0000 (23:05 +0000)]
Fix alignment issue manifesting in the userland stack.

MFC after: 1 wwek

3 years agoIn r362552, RB_SET_PARENT is defined, and use in parens in
Doug Moore [Tue, 23 Jun 2020 22:47:54 +0000 (22:47 +0000)]
In r362552, RB_SET_PARENT is defined, and use in parens in
RB_CLEAR_NODE.  But it is not an expression, and ought not to be
enclosed in parens.  Remove them.

Approved by: markj
Differential Revision: https://reviews.freebsd.org/D25421

3 years agoOptimize g_journal's superblock update by noting that the summary
Kirk McKusick [Tue, 23 Jun 2020 21:44:00 +0000 (21:44 +0000)]
Optimize g_journal's superblock update by noting that the summary
information is neither read nor written so it need not be written
out when updating the superblock.

PR:           247425
Sponsored by: Netflix

3 years agoCorrectly describe the return values for the libufs library sbget()
Kirk McKusick [Tue, 23 Jun 2020 21:37:12 +0000 (21:37 +0000)]
Correctly describe the return values for the libufs library sbget()
and sbput() functions that respectively read and write the superblock.

PR:           247425
Sponsored by: Netflix

3 years agoThe libufs library needs to track and free the new fs_si structure
Kirk McKusick [Tue, 23 Jun 2020 21:28:26 +0000 (21:28 +0000)]
The libufs library needs to track and free the new fs_si structure
in addition to the fs_csp structure that it references.

PR:           247425
Sponsored by: Netflix

3 years agoAlign comments in struct uufsd structure. No semantic change.
Kirk McKusick [Tue, 23 Jun 2020 21:17:13 +0000 (21:17 +0000)]
Align comments in struct uufsd structure. No semantic change.

Sponsored by: Netflix

3 years agoClean up some function and variable names.
Colin Percival [Tue, 23 Jun 2020 21:11:40 +0000 (21:11 +0000)]
Clean up some function and variable names.

The change from "slave" processes to "minion" processes to "worker"
processes left some less-than-coherent names:
1. "enslave" turned into the ungrammatical "enworker".
2. "slp" (SLave Pointer) turned into "mlp" (Minion [L] Pointer?).

Convert "enworker" to "create_workers" (the function in question forks
off 3 worker processes), and replace "mlp" with "wp" (Worker Pointer)
and "tmlp" with "twp" (Temporary Worker Pointer).

Reviewed by: imp, cem, danfe
Differential Revision: https://reviews.freebsd.org/D25403

3 years agoiflib: netmap: fix rsync index overrun
Vincenzo Maffione [Tue, 23 Jun 2020 20:23:56 +0000 (20:23 +0000)]
iflib: netmap: fix rsync index overrun

In the current iflib_netmap_rxsync, there is nothing that prevents
kring->nr_hwtail to overrun kring->nr_hwcur during the descriptor
import phase. This may cause errors in netmap applications, such as:

em1 RX0: fail 'head < kring->nr_hwcur || head > kring->nr_hwtail'
    h 795 c 795 t 282 rh 795 rc 795 rt 282 hc 282 ht 282

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25252

3 years agoDefine RB_SET_PARENT to do all assignments to rb parent
Doug Moore [Tue, 23 Jun 2020 20:02:55 +0000 (20:02 +0000)]
Define RB_SET_PARENT to do all assignments to rb parent
pointers. Define RB_SWAP_CHILD to replace the child of a parent with
its twin, and use it in 4 places. Use RB_SET in rb_link_node to remove
the only linuxkpi reference to color, and then drop color- and
parent-related definitions that are defined and used only in rbtree.h.

This is intended to be entirely cosmetic, with no impact on program
behavior, and leave RB_PARENT and RB_SET_PARENT as the only ways to
read and write rb parent pointers.

Reviewed by: markj, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25264

3 years agoRevert r362390, those tests are fixed by r362418
Li-Wen Hsu [Tue, 23 Jun 2020 19:14:38 +0000 (19:14 +0000)]
Revert r362390, those tests are fixed by r362418

PR: 247425
Sponsored by: The FreeBSD Foundation

3 years agoRemove ldconfig_paths_aout from rc.conf after r362543
Mateusz Piotrowski [Tue, 23 Jun 2020 18:35:00 +0000 (18:35 +0000)]
Remove ldconfig_paths_aout from rc.conf after r362543

Approved by: imp
Differential Revision: https://reviews.freebsd.org/D25415

3 years agokmod.mk: Don't split out debug symbols if requested
Conrad Meyer [Tue, 23 Jun 2020 18:25:31 +0000 (18:25 +0000)]
kmod.mk: Don't split out debug symbols if requested

Ports bsd.kmod.mk explicitly sets MK_KERNEL_SYMBOLS=no to prevent auto-
splitting of debuginfo from kernel modules.  If that knob is set, don't
split out a .ko.debug and .ko from .ko.full; just generate a .ko with
debuginfo and leave it be.

Otherwise, with DEBUG_FLAGS set and MK_KERNEL_SYMBOLS=no, we would helpfully
strip out the debuginfo from the .ko.full and then not install it.  That is
not the desired result a WITH_DEBUG port kmod build.

Reviewed by: emaste, jhb
Differential Revision: https://reviews.freebsd.org/D24835

3 years agoUpdate documentation after dropping support for i386 aout from ldconfig
Mateusz Piotrowski [Tue, 23 Jun 2020 18:24:15 +0000 (18:24 +0000)]
Update documentation after dropping support for i386 aout from ldconfig

The i386 aout invocation was removed from rc.d/ldconfig in r362543.

3 years agopstat(8): improve the Size header width after r358181
Piotr Pawel Stefaniak [Tue, 23 Jun 2020 18:19:22 +0000 (18:19 +0000)]
pstat(8): improve the Size header width after r358181

All size values use fields of width 8. Also, all other headers use fields of
width 8. Make the Size header added in r358181 use 8 characters as well.

3 years agoarch(7): small corrections for RISC-V
Mitchell Horne [Tue, 23 Jun 2020 17:17:13 +0000 (17:17 +0000)]
arch(7): small corrections for RISC-V

Document that RISC-V supports multiple page sizes: 4K, 2M, and 1G.

RISC-V's long double is always 128-bits wide, therefore quad precision.

Mention __riscv_float_abi_soft, which can be used to differentiate between
riscv64 and riscv64sf in userland code.

MFC after: 3 days

3 years agosort(1): Fix two wchar-related bugs in radixsort
Conrad Meyer [Tue, 23 Jun 2020 16:43:48 +0000 (16:43 +0000)]
sort(1): Fix two wchar-related bugs in radixsort

Sort(1)'s radixsort implementation was broken for multibyte LC_CTYPEs in at
least two ways:

  * In actual radix sort, it would only bucket the least significant
    byte from each wchar, ignoring the 24 most-significant bits of each
    unicode character.

  * In degenerate cases / "fast paths," it would fall back to another
    sorting algorithm (default: mergesort) with a bogus comparator
    offset.  The string comparison functions in sort(1) take an offset
    in units of the operating character size.  However, radixsort was
    passing an offset in units of bytes.  The byte offset must be
    divided by sizeof(wchar_t).

This revision addresses both discovered issues.

Some example testcases:

  $ (echo 耳 ; echo 脳 ; echo 耳) | \
  LC_CTYPE=ja_JP.UTF-8 LC_COLLATE=C LANG=C sort --radixsort --debug

  $ (echo 耳 ; echo 脳 ; echo 耳) | \
  LC_CTYPE=C LC_COLLATE=C LANG=C           sort --radixsort --debug

  $ (for i in $(jot 34); do echo 耳耳耳耳耳; echo 耳耳耳耳脳; echo 耳耳耳耳脴; done) | \
  LC_CTYPE=ja_JP.UTF-8 LC_COLLATE=C LANG=C sort --radixsort --debug

PR: 247494
Reported by: knu
MFC after: I do not intend to, but parties interested in stable might want to

3 years agolibdevdctl: Force full match of "timestamp" field name
Ryan Moeller [Tue, 23 Jun 2020 16:29:59 +0000 (16:29 +0000)]
libdevdctl: Force full match of "timestamp" field name

OpenZFS generates events with a "zio_timestamp" field, which gets mistaken for
"timestamp" by libdevdctl due to imprecise string matching.  Then later it is
assumed a "timestamp" field exists when it doesn't and an exception is thrown.

Add a space to the search string so we match exactly "timestamp" rather than
anything with that as a suffix.

Approved by: mav (mentor)
MFC after: 3 days
Sponsored by: iXsystems, Inc.

3 years agoldconfig: remove i386 aout invocation
Ed Maste [Tue, 23 Jun 2020 15:36:05 +0000 (15:36 +0000)]
ldconfig: remove i386 aout invocation

aout support in ldconfig hasn't been required since FreeBSD 2.x.

Anyone still using FreeBSD 2 shared libraries can use a FreeBSD 2
ldconfig to generate aout ldconfig hints.

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

3 years agoarm64 armreg.h: fix TCR_TBI1 definition
Ed Maste [Tue, 23 Jun 2020 15:32:05 +0000 (15:32 +0000)]
arm64 armreg.h: fix TCR_TBI1 definition

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D25411

3 years agopkg: Provide a friendlier message when bootstrap fails due to address resolution
Tom Jones [Tue, 23 Jun 2020 15:14:54 +0000 (15:14 +0000)]
pkg: Provide a friendlier message when bootstrap fails due to address resolution

The current message when bootstapping pkg fails for any reason implies that pkg
is not available. We have the error code from fetch so if bootstrap failed due
to address resolution say so.

Reviewed by:    bapt, bz
Approved by:    bz (co-mentor)
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D25323

3 years agoTo avoid a startup script race change net.bpf.optimize_writers from
Tycho Nightingale [Tue, 23 Jun 2020 13:57:53 +0000 (13:57 +0000)]
To avoid a startup script race change net.bpf.optimize_writers from
CTLFLAG_RW to CTLFLAG_RWTUN to allow it to be modified by a loader
tunable.

Sponsored by: Dell EMC Isilon

3 years agoMention CI system information in development(7)
Li-Wen Hsu [Tue, 23 Jun 2020 11:40:11 +0000 (11:40 +0000)]
Mention CI system information in development(7)

Approved by: 0mp, bcr
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25340

3 years agoFix a typo and sort options
Mateusz Piotrowski [Tue, 23 Jun 2020 10:56:15 +0000 (10:56 +0000)]
Fix a typo and sort options

MFC after: 1 week

3 years agocolrm.1: Add a missing colon
Mateusz Piotrowski [Tue, 23 Jun 2020 10:27:41 +0000 (10:27 +0000)]
colrm.1: Add a missing colon

3 years agotee.1: Add a missing article
Mateusz Piotrowski [Tue, 23 Jun 2020 10:22:58 +0000 (10:22 +0000)]
tee.1: Add a missing article

3 years agocolrm(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 23 Jun 2020 10:15:08 +0000 (10:15 +0000)]
colrm(1): Add EXAMPLES section

Add a couple of simple examples

Approved by: bcr@
Differential Revision: https://reviews.freebsd.org/D25196

3 years agotee(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 23 Jun 2020 10:05:07 +0000 (10:05 +0000)]
tee(1): Add EXAMPLES section

Add one simple example

Approved by: bcr@
Differential Revision: https://reviews.freebsd.org/D25337

3 years agood(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 23 Jun 2020 07:48:48 +0000 (07:48 +0000)]
od(1): Add EXAMPLES section

 * Add two small examples showing the use of -a, -c, -j and -N
 * While here, remove obsolete .Tn reported by mandoc(1)

Approved by: 0mp@
Differential Revision: https://reviews.freebsd.org/D25372

3 years agocxgbe(4): Add a tx_len16_to_desc helper.
Navdeep Parhar [Tue, 23 Jun 2020 07:33:29 +0000 (07:33 +0000)]
cxgbe(4): Add a tx_len16_to_desc helper.

No functional change.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoMFOpenZFS: Add basic zfs ioc input nvpair validation
Toomas Soome [Tue, 23 Jun 2020 06:42:39 +0000 (06:42 +0000)]
MFOpenZFS: Add basic zfs ioc input nvpair validation

We want newer versions of libzfs_core to run against an existing
zfs kernel module (i.e. a deferred reboot or module reload after
an update).

Programmatically document, via a zfs_ioc_key_t, the valid arguments
for the ioc commands that rely on nvpair input arguments (i.e. non
legacy commands from libzfs_core). Automatically verify the expected
pairs before dispatching a command.

This initial phase focuses on the non-legacy ioctls. A follow-on
change can address the legacy ioctl input from the zfs_cmd_t.

The zfs_ioc_key_t for zfs_keys_channel_program looks like:

static const zfs_ioc_key_t zfs_keys_channel_program[] = {
       {"program",     DATA_TYPE_STRING,               0},
       {"arg",         DATA_TYPE_UNKNOWN,              0},
       {"sync",        DATA_TYPE_BOOLEAN_VALUE,        ZK_OPTIONAL},
       {"instrlimit",  DATA_TYPE_UINT64,               ZK_OPTIONAL},
       {"memlimit",    DATA_TYPE_UINT64,               ZK_OPTIONAL},
};

Introduce four input errors to identify specific input failures
(in addition to generic argument value errors like EINVAL, ERANGE,
EBADF, and E2BIG).

ZFS_ERR_IOC_CMD_UNAVAIL the ioctl number is not supported by kernel
ZFS_ERR_IOC_ARG_UNAVAIL an input argument is not supported by kernel
ZFS_ERR_IOC_ARG_REQUIRED a required input argument is missing
ZFS_ERR_IOC_ARG_BADTYPE an input argument has an invalid type

Reviewed by: allanjude
Obtained from: OpenZFS
Sponsored by: Netflix, Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25393

3 years agoteach ena driver about RSS kernel option
Andriy Gapon [Tue, 23 Jun 2020 04:58:36 +0000 (04:58 +0000)]
teach ena driver about RSS kernel option

Networking is broken if the driver configures its (virtual) hardware to
use a hash algorithm (or a key) different from the one that the network
stack (software RSS) uses.  This can be seen with connections initiated
from the host.  The PCB will be placed into the hash table based on the
hash value calculated by the software.  The hardware-calculated hash
value in reponse packets will be different, so the PCB won't be found.

Tested with a kernel compiled with 'options RSS' on an instance with ena
driver.

Reviewed by: mw, adrian
MFC after: 2 weeks
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D24733

3 years agoStore the AAD in a separate buffer for KTLS.
John Baldwin [Tue, 23 Jun 2020 00:02:28 +0000 (00:02 +0000)]
Store the AAD in a separate buffer for KTLS.

For TLS 1.2 this permits reusing one of the existing iovecs without
always having to duplicate both.

While here, only duplicate the output iovec for TLS 1.3 if it will be
used.

Reviewed by: gallatin
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25291

3 years agoAdd support for requests with separate AAD to ccr(4).
John Baldwin [Mon, 22 Jun 2020 23:41:33 +0000 (23:41 +0000)]
Add support for requests with separate AAD to ccr(4).

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25290

3 years agoAdd support for requests with separate AAD to aesni(4).
John Baldwin [Mon, 22 Jun 2020 23:22:13 +0000 (23:22 +0000)]
Add support for requests with separate AAD to aesni(4).

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25289

3 years agoAdd support to the crypto framework for separate AAD buffers.
John Baldwin [Mon, 22 Jun 2020 23:20:43 +0000 (23:20 +0000)]
Add support to the crypto framework for separate AAD buffers.

This permits requests to provide the AAD in a separate side buffer
instead of as a region in the crypto request input buffer.  This is
useful when the main data buffer might not contain the full AAD
(e.g. for TLS or IPsec with ESN).

Unlike separate IVs which are constrained in size and stored in an
array in struct cryptop, separate AAD is provided by the caller
setting a new crp_aad pointer to the buffer.  The caller must ensure
the pointer remains valid and the buffer contents static until the
request is completed (e.g. when the callback routine is invoked).

As with separate output buffers, not all drivers support this feature.
Consumers must request use of this feature via a new session flag.

To aid in driver testing, kern.crypto.cryptodev_separate_aad can be
set to force /dev/crypto requests to use a separate AAD buffer.

Discussed with: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25288

3 years agoFix crash in drill(1) when IP has two subsequent dots
Oleksandr Tymoshenko [Mon, 22 Jun 2020 23:13:14 +0000 (23:13 +0000)]
Fix crash in drill(1) when IP has two subsequent dots

Cherry-pick crash fix from the upstream repo

PR: 226575
Reported by: Goran Mekić <meka@tilda.center>
Obtained from: https://git.nlnetlabs.nl/ldns/commit/?id=98291475
MFC after: 2 weeks

3 years agoRevert r362148.
Yuri Pankov [Mon, 22 Jun 2020 22:59:03 +0000 (22:59 +0000)]
Revert r362148.

Breaks UTF-8 input for new or having only 7bit characters present files.

Reported by: glebius

3 years agoAssume all TSCs are synchronized for AMD Family 17h processors and later
Jung-uk Kim [Mon, 22 Jun 2020 20:42:58 +0000 (20:42 +0000)]
Assume all TSCs are synchronized for AMD Family 17h processors and later
when it has passed the synchronization test.

"Processor Programming Reference (PPR) for AMD Family 17h" states that
the TSC uses a common reference for all sockets, cores and threads.

MFC after: 1 month

3 years agoMFOpenZFS: Add zio_ddt_free()+ddt_phys_decref() error handling
Allan Jude [Mon, 22 Jun 2020 19:03:02 +0000 (19:03 +0000)]
MFOpenZFS: Add zio_ddt_free()+ddt_phys_decref() error handling

The assumption in zio_ddt_free() is that ddt_phys_select() must
always find a match.  However, if that fails due to a damaged
DDT or some other reason the code will NULL dereference in
ddt_phys_decref().

While this should never happen it has been observed on various
platforms.  The result is that unless your willing to patch the
ZFS code the pool is inaccessible.  Therefore, we're choosing
to more gracefully handle this case rather than leave it fatal.

http://mail.opensolaris.org/pipermail/zfs-discuss/2012-February/050972.html

https://github.com/openzfs/zfs/commit/5dc6af0eec29b119b731c793037fd77214fc9438

Reported by: Pierre Beyssac
Obtained from: OpenZFS
MFC after: 2 weeks
Sponsored by: Klara Inc.

3 years agoFollowup to r362502: rc.conf(5): unobsolete gif_interfaces
Eugene Grosbein [Mon, 22 Jun 2020 17:52:13 +0000 (17:52 +0000)]
Followup to r362502: rc.conf(5): unobsolete gif_interfaces

There are cases when gif_interfaces cannot be replaced
with cloned_interfaces, such as tunnels with external IPv6 addresses
and internal IPv4 or vice versa. Such configuration requires
extra invocation of ifconfig(8) and supported with gif_interfaces only.

Fix manual page and provide some examples.

MFC after: 1 week
X-MFC-With: 362502

3 years agonetwork.subr: unobsolete gif_interfaces
Eugene Grosbein [Mon, 22 Jun 2020 17:25:21 +0000 (17:25 +0000)]
network.subr: unobsolete gif_interfaces

There are cases when gif_interfaces cannot be replaced
with cloned_interfaces, such as tunnels with external IPv6 addresses
and internal IPv4 or vice versa. Such configuration requires
extra invocation of ifconfig(8) and supported with gif_interfaces only.

MFC after: 1 week

3 years agoNo need to include netinet/sctp_crc32.h twice.
Michael Tuexen [Mon, 22 Jun 2020 14:36:14 +0000 (14:36 +0000)]
No need to include netinet/sctp_crc32.h twice.

3 years agoMove the definition of SCTP's system_base_info into sctp_crc32.c.
Mark Johnston [Mon, 22 Jun 2020 14:01:31 +0000 (14:01 +0000)]
Move the definition of SCTP's system_base_info into sctp_crc32.c.

This file is the only SCTP source file compiled into the kernel when
SCTP_SUPPORT is configured.  sctp_delayed_checksum() references a couple
of counters defined in system_base_info, so the change allows these
counters to be referenced in a kernel compiled without "options SCTP".

Submitted by: tuexen
MFC with: r362338

3 years agoacpi_ibm(4): Add support for putting fans in disengaged mode.
Mark Johnston [Mon, 22 Jun 2020 12:36:05 +0000 (12:36 +0000)]
acpi_ibm(4): Add support for putting fans in disengaged mode.

PR: 247306
Submitted by: Ali Abdallah <ali.abdallah@suse.com>
MFC after: 2 weeks

3 years agostrtok(3): make it easier to find the RETURN VALUES section
Piotr Pawel Stefaniak [Mon, 22 Jun 2020 11:03:36 +0000 (11:03 +0000)]
strtok(3): make it easier to find the RETURN VALUES section

MFC after: 1 week

3 years agoTranslaate the PCI address when activating a resource
Andrew Turner [Mon, 22 Jun 2020 10:49:50 +0000 (10:49 +0000)]
Translaate the PCI address when activating a resource

When the PCI address != physical address we need to translate from the
former to the latter before passing to the parent to map into the kernels
virtual address space.

Sponsored by: Innovate UK

3 years agogpiobus_release_pin: remove incorrect prefix from error messages
Andriy Gapon [Mon, 22 Jun 2020 10:32:41 +0000 (10:32 +0000)]
gpiobus_release_pin: remove incorrect prefix from error messages

It's interesting that similar messages from gpiobus_acquire_pin never
had any prefix while gpiobus_release_pin messages were prefixed with
"gpiobus_acquire_pin".
Anyway, the prefix is not that useful and can be deduced from context.

MFC after: 2 weeks

3 years agoImprove the rcorder manual page
Mateusz Piotrowski [Mon, 22 Jun 2020 10:01:24 +0000 (10:01 +0000)]
Improve the rcorder manual page

- Fix formatting issues such as:
  - Use Ql instead of Dq Li as Li is deprecated
  - Address some mandoc warnings
- Add arguments missing from the list of options (i.e., document "-k keep"
  instead of just "-k").
- Document that -k and -s can be specified multiple times
- Use sshd instead of named for the example in the BUGS section, as named
  is not in the base system. Also, use Nm instead of Xr there as it is not
  the sshd binary that is required to be running, but the service.
- Use Sy instead of Cm for KEYWORDS. Cm is reserved for command-line
  modifiers of the CLI.
- Add an EXAMPLES section
- Cross-reference service(8).

MFC after: 2 weeks

3 years agoAdd some missing parts for supporting va_birthtime.
Doug Rabson [Mon, 22 Jun 2020 08:23:16 +0000 (08:23 +0000)]
Add some missing parts for supporting va_birthtime.

Reviewed by: rmacklem

3 years agoFix reboot command on the Raspberry Pi series.
Andrew Turner [Mon, 22 Jun 2020 08:12:21 +0000 (08:12 +0000)]
Fix reboot command on the Raspberry Pi series.

The Raspbery Pi computers do not properly implement PSCI. The canonical
way to reset them is to set a watchdog timer and allow it to expire.

Submitted by: Robert Crowston <crowston_protonmail.com>
Differential Revision: https://reviews.freebsd.org/D25268

3 years agoRevert r362466
Baptiste Daroussin [Mon, 22 Jun 2020 07:46:24 +0000 (07:46 +0000)]
Revert r362466

Such change should not have happen without prior discussion and review.

With hat: transitioning core

3 years agoSwitch cxgbe interface lookup to use fibX_lookup() from older
Alexander V. Chernikov [Mon, 22 Jun 2020 07:35:23 +0000 (07:35 +0000)]
Switch cxgbe interface lookup to use fibX_lookup() from older
 fibX_lookup_nh_ext().

fibX_lookup_nh_ represents pre-epoch generation of fib kpi,
providing less guarantees over pointer validness and requiring
on-stack data copying.

Reviewed by: np
Differential Revision: https://reviews.freebsd.org/D24975

3 years agoSquash liblzma build race
Kyle Evans [Mon, 22 Jun 2020 03:44:01 +0000 (03:44 +0000)]
Squash liblzma build race

As of r362452, liblzma depends on libmd but the buildworld build order
hadn't been amended to document the new dependency.

Reported by: jenkins via freqlabs
X-MFC-With: r362452

3 years agoflua: add ucl library
Ryan Moeller [Mon, 22 Jun 2020 03:14:43 +0000 (03:14 +0000)]
flua: add ucl library

libucl comes with a Lua library binding.  Build it into flua.

This lets us parse/generate config files in the various formats supported by
libucl with flua.  For example, the following script will detect the format of
an object written to stdin as one of UCL config, JSON, or YAML and write it to
stdout as pretty-printed JSON:

local ucl = require('ucl')
local parser = ucl.parser()
parser:parse_string(io.read('*a'))
local obj = parser:get_object()
print(ucl.to_format(obj, 'json'))

Reviewed by: kevans, pstef
Approved by: mmacy (mentor)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D25009

3 years agoAdd include missing from my last commit.
Michael Tuexen [Sun, 21 Jun 2020 23:47:27 +0000 (23:47 +0000)]
Add include missing from my last commit.

3 years agoCleanup the defintion of struct sctp_getaddresses. This stucture
Michael Tuexen [Sun, 21 Jun 2020 23:12:56 +0000 (23:12 +0000)]
Cleanup the defintion of struct sctp_getaddresses. This stucture
is used by the IPPROTO_SCTP level socket options SCTP_GET_PEER_ADDRESSES
and SCTP_GET_LOCAL_ADDRESSES, which are used by libc to implement
sctp_getladdrs() and sctp_getpaddrs().
These changes allow an old libc to work on a newer kernel.

3 years agoRather than zeroing MAXVIFS times size of pointer [r362289] (still better than
Bjoern A. Zeeb [Sun, 21 Jun 2020 22:09:30 +0000 (22:09 +0000)]
Rather than zeroing MAXVIFS times size of pointer [r362289] (still better than
sizeof pointer before [r354857]), we need to zero MAXVIFS times the size of
the struct.  All good things come in threes; I hope this is it on this one.

PR: 246629, 206583
Reported by: kib
MFC after: ASAP

3 years agoiflib: fix cloneattach fail and generalize pseudo device handling
Matt Macy [Sun, 21 Jun 2020 22:02:49 +0000 (22:02 +0000)]
iflib: fix cloneattach fail and generalize pseudo device handling

- a cloneattach failure will not currently be handled correctly,
  jump to the right target

- pseudo devices are all treat as if they're ethernet devices -
  this often doesn't make sense

MFC after: 1 week
Sponsored by: Netgate, Inc.
Differential Revision: https://reviews.freebsd.org/D25083

3 years agonet.link.generic.ifdata.<ifindex>.linkspecific: rework handler
Pawel Biernacki [Sun, 21 Jun 2020 18:40:17 +0000 (18:40 +0000)]
net.link.generic.ifdata.<ifindex>.linkspecific: rework handler

This OID was added in r17352 but the write path of IFDATA_LINKSPECIFIC
seems unused as there are no in-base writers, and as far as I can tell
we had issues with this code before, see PR 219472.  Drop the write path
to make the handler read-only as described in comments and man-pages.
It can be marked as MPSAFE now.

Reviewed by: bdragon, kib, melifaro, wollman
Approved by: kib (mentor)
Sponsored by: Mysterious Code Ltd.
Differential Revision: https://reviews.freebsd.org/D25348

3 years agoImprove wording to be more precise and clear.
Hans Petter Selasky [Sun, 21 Jun 2020 13:34:08 +0000 (13:34 +0000)]
Improve wording to be more precise and clear.
No functional change intended.

s/Master Boot/Main Boot/ (also called MBR)

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agow: use locale-based string format specifiers
Yuri Pankov [Sun, 21 Jun 2020 11:42:49 +0000 (11:42 +0000)]
w: use locale-based string format specifiers

Use locale-based string format specifiers when printing
the process names/arguments.

Reviewed by: pstef
Differential Revision: https://reviews.freebsd.org/D25174

3 years agoAdapt linuxulator syscalls.master files to the new layout.
Edward Tomasz Napierala [Sun, 21 Jun 2020 10:09:34 +0000 (10:09 +0000)]
Adapt linuxulator syscalls.master files to the new layout.
No functional changes.

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

3 years agoFix the build for an INET6 only configuration.
Michael Tuexen [Sun, 21 Jun 2020 09:56:09 +0000 (09:56 +0000)]
Fix the build for an INET6 only configuration.

The fix from the last commit is actually needed twice...

MFC after: 1 week

3 years agovfs: track sequential reads and writes separately
Thomas Munro [Sun, 21 Jun 2020 08:51:24 +0000 (08:51 +0000)]
vfs: track sequential reads and writes separately

For software like PostgreSQL and SQLite that sometimes reads sequentially
while also writing sequentially some distance behind with interleaved
syscalls on the same fd, performance is better on UFS if we do
sequential access heuristics separately for reads and writes.

Patch originally by Andrew Gierth in 2008, updated and proposed by me with
his permission.

Reviewed by: mjg, kib, tmunro
Approved by: mjg (mentor)
Obtained from: Andrew Gierth <andrew@tao11.riddles.org.uk>
Differential Revision: https://reviews.freebsd.org/D25024

3 years agoUse zone nomenclature that is consistent with UMA.
Jeff Roberson [Sun, 21 Jun 2020 04:59:02 +0000 (04:59 +0000)]
Use zone nomenclature that is consistent with UMA.

3 years ago[PowerPC] More relocation fixes
Brandon Bergren [Sun, 21 Jun 2020 03:39:26 +0000 (03:39 +0000)]
[PowerPC] More relocation fixes

It turns out relocating the symbol table itself can cause issues, like fbt
crashing because it applies the offsets to the kernel twice.

This had been previously brought up in rS333447 when the stoffs hack was
added, but I had been unaware of this and reimplemented symtab relocation.

Instead of relocating the symbol table, keep track of the relocation base
in ddb, so the ddb symbols behave like the kernel linker-provided symbols.

This is intended to be NFC on platforms other than PowerPC, which do not
use fully relocatable kernels. (The relbase will always be 0)

 * Remove the rest of the stoffs hack.
 * Remove my half-baked displace_symbol_table() function.
 * Extend ddb initialization to cope with having a relocation offset on the
   kernel symbol table.
 * Fix my kernel-as-initrd hack to work with booke64 by using a temporary
   mapping to access the data.
 * Fix another instance of __powerpc__ that is actually RELOCATABLE_KERNEL.
 * Change the behavior or X_db_symbol_values to apply the relocation base
   when updating valp, to match link_elf_symbol_values() behavior.

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D25223

3 years agoFix up a comment added by r362455.
Rick Macklem [Sun, 21 Jun 2020 02:49:56 +0000 (02:49 +0000)]
Fix up a comment added by r362455.

3 years agoModify the way the client side krpc does soreceive() for TCP.
Rick Macklem [Sun, 21 Jun 2020 00:06:04 +0000 (00:06 +0000)]
Modify the way the client side krpc does soreceive() for TCP.

Without this patch, clnt_vc_soupcall() first does a soreceive() for
4 bytes (the Sun RPC over TCP record mark) and then soreceive(s) for
the RPC message.
This first soreceive() almost always results in an mbuf allocation,
since having the 4byte record mark in a separate mbuf in the socket
rcv queue is unlikely.
This is somewhat inefficient and rather odd. It also will not work
for the ktls rx, since the latter returns a TLS record for each
soreceive().

This patch replaces the above with code similar to what the server side
of the krpc does for TCP, where it does a soreceive() for as much data
as possible and then parses RPC messages out of the received data.
A new field of the TCP socket structure called ct_raw is the list of
received mbufs that the RPC message(s) are parsed from.
I think this results in cleaner code and is needed for support of
nfs-over-tls.
It also fixes the code for the case where a server sends an RPC message
in multiple RPC message fragments. Although this is allowed by RFC5531,
no extant NFS server does this. However, it is probably good to fix this
in case some future NFS server does do this.

3 years agoSet a variable also in the case of an INET6 only kernel
Michael Tuexen [Sat, 20 Jun 2020 23:48:57 +0000 (23:48 +0000)]
Set a variable also in the case of an INET6 only kernel

MFC after: 1 week

3 years agoBump __FreeBSD_version after making liblzma to use libmd implementation
Xin LI [Sat, 20 Jun 2020 21:32:14 +0000 (21:32 +0000)]
Bump __FreeBSD_version after making liblzma to use libmd implementation
of SHA256.

PR: 200142

3 years agoliblzma: Make liblzma use libmd implementation of SHA256.
Xin LI [Sat, 20 Jun 2020 21:32:07 +0000 (21:32 +0000)]
liblzma: Make liblzma use libmd implementation of SHA256.

MFC after: 2 weeks
PR: 200142

3 years agoUse a struct sockaddr_in pr struct sockaddr_in6 as the option value
Michael Tuexen [Sat, 20 Jun 2020 21:06:02 +0000 (21:06 +0000)]
Use a struct sockaddr_in pr struct sockaddr_in6 as the option value
for the IPPROTO_SCTP level socket options SCTP_BINDX_ADD_ADDR and
SCTP_BINDX_REM_ADDR. These socket option are intended for internal
use only to implement sctp_bindx().
This is one user of struct sctp_getaddresses less.
struct sctp_getaddresses is strange and will be changed shortly.

3 years agoIn concluding RB_REMOVE_COLOR, in the case when the sibling of the
Doug Moore [Sat, 20 Jun 2020 20:25:39 +0000 (20:25 +0000)]
In concluding RB_REMOVE_COLOR, in the case when the sibling of the
root of the too-short tree is black and at least one of the children
of that sibling is red, either one or two rotations finish the
rebalancing. In the case when both of the children are red, the
current implementation uses two rotations where only one is
necessary. This change removes that extra rotation, and in that case
also removes a needless black-to-red-to-black recoloring.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25335

3 years agoClarify some language. Favor primary where both master and primary were
Jeff Roberson [Sat, 20 Jun 2020 20:21:04 +0000 (20:21 +0000)]
Clarify some language.  Favor primary where both master and primary were
used in conjunction with secondary.

3 years agoCleanup the adding and deleting of addresses via sctp_bindx().
Michael Tuexen [Sat, 20 Jun 2020 20:20:16 +0000 (20:20 +0000)]
Cleanup the adding and deleting of addresses via sctp_bindx().

There is no need to use the association identifier, so remove it.
While there, cleanup the code a bit.

MFC after: 1 week

3 years agodump(8): Reapply slightly modified r362422
Conrad Meyer [Sat, 20 Jun 2020 20:14:50 +0000 (20:14 +0000)]
dump(8): Reapply slightly modified r362422

Go ahead and replace the distasteful slave language for worker processes
with the straightforward description, "worker(s)."

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Sat, 20 Jun 2020 20:06:52 +0000 (20:06 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.0-97-g6f71678ecd2 (not quite 10.0.1 rc2, as more fixes are
still pending).

MFC after: 3 weeks

3 years agoRevert -r362422.
Warner Losh [Sat, 20 Jun 2020 20:06:14 +0000 (20:06 +0000)]
Revert -r362422.

While whimsical, there's too much negative energy around minion as well as the
positive.

3 years agoVendor import of llvm-project branch release/10.x
Dimitry Andric [Sat, 20 Jun 2020 18:49:12 +0000 (18:49 +0000)]
Vendor import of llvm-project branch release/10.x
llvmorg-10.0.0-97-g6f71678ecd2.

3 years agoRegen after r362440.
Edward Tomasz Napierala [Sat, 20 Jun 2020 18:31:02 +0000 (18:31 +0000)]
Regen after r362440.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoAdd linux_madvise(2) instead of having Linux apps call the native
Edward Tomasz Napierala [Sat, 20 Jun 2020 18:29:22 +0000 (18:29 +0000)]
Add linux_madvise(2) instead of having Linux apps call the native
FreeBSD madvise(2) directly.  While some of the flag values match,
most don't.

PR: kern/230160
Reported by: markj
Reviewed by: markj
Discussed with: brooks, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25272