]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMFC r361397, r361683: certctl(8) unprivileged mode
Kyle Evans [Thu, 20 Aug 2020 14:07:29 +0000 (14:07 +0000)]
MFC r361397, r361683: certctl(8) unprivileged mode

r361397:
Add an unprivileged mode where calls to install are passed appropriate
flags.  For ease of integration, use the same flags as install:

 -U unprivileged mode
 -D <destdir> Specify DESTDIR (overrides the environment)
 -M <metalog> Full path to METALOG file

r361683:
certctl: fix test syntax

test doesn't understand &&, but it does understand -a.

3 years agoMFC r364185: Fill device serial_num and device_id in NVMe XPT.
Alexander Motin [Thu, 20 Aug 2020 02:54:44 +0000 (02:54 +0000)]
MFC r364185: Fill device serial_num and device_id in NVMe XPT.

It allows to report GEOM::lunid for nda(4) same as for nvd(4).  Since
NVMe now allows multiple LUs (namespaces) with multiple paths unique
LU identification is important.  The serial_num field is filled same
as before with the controller serial number, while device_id is based
on namespace GUID and/or EUI64 fields as recommended by "NVM Express:
SCSI Translation Reference" and matching nvd(4) at the end.

3 years agoMFC r364178: Report proper stripesize for nda(4).
Alexander Motin [Thu, 20 Aug 2020 02:51:18 +0000 (02:51 +0000)]
MFC r364178: Report proper stripesize for nda(4).

Same as for nvd(4) report NPWG if present, otherise NOIOB.

3 years agoMFC r364168:
Mark Johnston [Wed, 19 Aug 2020 13:44:08 +0000 (13:44 +0000)]
MFC r364168:
linprocfs: Fix some inaccuracies in meminfo.

PR: 248463

3 years agoMFC r364109:
Hans Petter Selasky [Wed, 19 Aug 2020 13:32:55 +0000 (13:32 +0000)]
MFC r364109:
Need to clone the task struct fields related to RCU aswell in the
LinuxKPI after r359727. This fixes a minor regression issue. Else the
priority tracking won't work properly when both sleepable and
non-sleepable RCU is in use on the same thread.

Bump the __FreeBSD_version to force recompilation of external kernel
modules.

PR: 242272
Sponsored by: Mellanox Technologies

3 years agoFix for INVARIANTS build.
Hans Petter Selasky [Wed, 19 Aug 2020 13:28:50 +0000 (13:28 +0000)]
Fix for INVARIANTS build.

The "name" argument is not present in the EPOCH(9) APIs in 12-stable as
merged in r364381 .

This is a direct commit.

Sponsored by: Mellanox Technologies

3 years agoMFC r364072, r364073 and r364102:
Hans Petter Selasky [Wed, 19 Aug 2020 13:23:52 +0000 (13:23 +0000)]
MFC r364072, r364073 and r364102:
Use proper prototype for SYSINIT() functions.
Mark the unused argument using the __unused macro.

Make sure the multicast release tasks are properly drained when
destroying a VNET or a network interface.

Else the inm release tasks, both IPv4 and IPv6 may cause a panic
accessing a freed VNET or network interface.

Use a static initializer for the multicast free tasks.
This makes the SYSINIT() function updated in r364072 superfluous.

Differential Revision: https://reviews.freebsd.org/D24914
Sponsored by: Mellanox Technologies

3 years agoMFC r359438 and r359477:
Hans Petter Selasky [Wed, 19 Aug 2020 13:07:04 +0000 (13:07 +0000)]
MFC r359438 and r359477:
Remove the "config" taskqgroup and its KPIs.

Equivalent functionality is already provided by taskqueue(9), just use
that instead.

Interfaces may be detached from a taskqueue_thread task, for example by
prison_complete(), so after r359438, when draining the queue we may end
up deadlocking.

3 years agoMFC 364294, 364295:
Mateusz Piotrowski [Wed, 19 Aug 2020 12:47:05 +0000 (12:47 +0000)]
MFC 364294, 364295:

- Remove an unnecessary macro
- Comment out TODO notes from bectl(8) manual page

3 years agoMFC r364028:
Hans Petter Selasky [Wed, 19 Aug 2020 12:25:34 +0000 (12:25 +0000)]
MFC r364028:
Implement radix_tree_store() in the LinuxKPI for use with the coming
extensible arrays implementation.

While at it add some more comments explaining the current
radix_tree_insert() function and make sure to clean the root node when
the radix tree reaches the maximum height. This can happen if the
index passed is too big when the tree is empty.

The radix_tree_store() function is basically a copy of the
radix_tree_insert() function with some added functionality.

The radix_tree_store() function is local to FreeBSD and does not yet
exist in Linux.

Reviewed by: kib
Sponsored by: Mellanox Technologies

3 years agoMFC r364019:
Hans Petter Selasky [Wed, 19 Aug 2020 12:23:05 +0000 (12:23 +0000)]
MFC r364019:
Add full support support for dynamic allocation and freeing of epoch's.

Make sure to reclaim epoch structures when they are freed to support
dynamic allocation and freeing of epoch structures.

While at it, move the 64 supported epoch control structures to the
static memory domain. This overall simplifies the management and
debugging of system epoch's.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D25960
Sponsored by: Mellanox Technologies

3 years agoMFC r363950:
Hans Petter Selasky [Wed, 19 Aug 2020 12:16:11 +0000 (12:16 +0000)]
MFC r363950:
Add new USB ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by: Mellanox Technologies

3 years agoMFC r363397: Fix style and comment around concave/convex regions in TCP cubic.
Richard Scheffenegger [Wed, 19 Aug 2020 10:40:02 +0000 (10:40 +0000)]
MFC r363397: 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)
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24657

3 years agoMFC r363380: Add MODULE_VERSION to TCP loadable congestion control modules.
Richard Scheffenegger [Wed, 19 Aug 2020 10:36:16 +0000 (10:36 +0000)]
MFC r363380: 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)
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D25744

3 years agoMFC r362988: Fix KASSERT during tcp_newtcpcb when low on memory
Richard Scheffenegger [Wed, 19 Aug 2020 10:32:26 +0000 (10:32 +0000)]
MFC r362988: Fix KASSERT during tcp_newtcpcb when low on memory

While testing with system default cc set to cubic, and
running a memory exhaustion validation, FreeBSD panics for a
missing inpcb reference / lock.

Reviewed by: rgrimes (mentor), tuexen (mentor)
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D25583

3 years agoMFC r364133:
Cy Schubert [Tue, 18 Aug 2020 20:41:03 +0000 (20:41 +0000)]
MFC r364133:

When booting a system with WITHOUT_IPFILTER the following errors
are encountered at boot time:

rcorder: requirement `ipfs' in file `/etc/rc.d/netif' has no providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/netif' has no
providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/netwait' has no
providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/net_watchdog' has no
providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/securelevel' has no
providers.

Listing its own requrements in BEFORE rather than use REQUIRE of
non-optional scripts resolves this issue.

The issue was discovered and patched by glebius at Netflix.

Submitted by: glebius
Reported by: glebius

3 years agoMFC r364131: tput(1): Several enhancements for the manual page
Gordon Bergling [Tue, 18 Aug 2020 06:55:12 +0000 (06:55 +0000)]
MFC r364131: tput(1): Several enhancements for the manual page

- a couple of descriptions are incomplete
- synopsis doesn't show that all arguments are optional
- missing an ENVIRONMENT section with TERM mentioned

PR: 84670
Submitted by: Gary W. Swearingen <garys at opusnet dot com>
Reviewed by: bcr
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D26009

3 years agoMFC 363596, 363719, 363733
Peter Grehan [Tue, 18 Aug 2020 03:40:09 +0000 (03:40 +0000)]
MFC 363596, 363719, 363733

 363596  Support the setting of additional AHCI controller parameters.
 363719  Definition for the 'removable media flag' from word 0 in the Identify page.
 363733  Replace magic numbers in Identify page register 0 with ATA definitions.

Relnotes: yes

3 years agoInsta-MFC r364322:
Konstantin Belousov [Mon, 17 Aug 2020 19:17:54 +0000 (19:17 +0000)]
Insta-MFC r364322:
Remove unused declaration for qsort_b().

This should fix the build on gcc arches.  It seems that gcc 4.2 port of
the blocks support defines the guard symbol unconditionally.

3 years agoMFC r360509: geli tests require OpenSSL - exclude them under WITHOUT_OPENSSL
Ed Maste [Mon, 17 Aug 2020 17:48:28 +0000 (17:48 +0000)]
MFC r360509: geli tests require OpenSSL - exclude them under WITHOUT_OPENSSL

PR: 245931
Submitted by: The FreeBSD Foundation

3 years agoMFC r360501: src.opts.mk: add WITHOUT_OPENSSL dependencies
Ed Maste [Mon, 17 Aug 2020 17:47:04 +0000 (17:47 +0000)]
MFC r360501: src.opts.mk: add WITHOUT_OPENSSL dependencies

A number of components require OpenSSL and fail to build if it is not
enabled.  As a first phase force these off under WITHOUT_OPENSSL.  A
second phase should make these more fine-grained, allowing the component
to build but without OpenSSL.

PR: 245931
Sponsored by: The FreeBSD Foundation

3 years agoMFC r364091:
Konstantin Belousov [Mon, 17 Aug 2020 16:27:02 +0000 (16:27 +0000)]
MFC r364091:
Export scandir_b from libc.

PR: 248572

3 years agoMFC r364083:
Mark Johnston [Mon, 17 Aug 2020 12:38:35 +0000 (12:38 +0000)]
MFC r364083:
fortune, strfile: Improve validation of command-line arguments.

PR: 246050

3 years agoMFC r364186: ifconfig(8): plug memory leak
Eugene Grosbein [Sun, 16 Aug 2020 02:04:35 +0000 (02:04 +0000)]
MFC r364186: ifconfig(8): plug memory leak

3 years agoMFC r354139:
Edward Tomasz Napierala [Sat, 15 Aug 2020 17:18:36 +0000 (17:18 +0000)]
MFC r354139:

Document the fact that Linux binaries depend on pty(4).

Sponsored by: The FreeBSD Foundation

3 years agoMFC r351783:
Edward Tomasz Napierala [Sat, 15 Aug 2020 17:02:23 +0000 (17:02 +0000)]
MFC r351783:

Unbreak Linux binaries linked against new glibc, such as the ones
from recent Ubuntu versions.  Without it they segfault on startup.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r364029: tmpnam(3): Also mention tmpfile in the ENVIRONMENT section
Gordon Bergling [Fri, 14 Aug 2020 06:48:29 +0000 (06:48 +0000)]
MFC r364029: tmpnam(3): Also mention tmpfile in the ENVIRONMENT section

PR: 181785
Submitted by: Kevin P. Neal <kpneal at pobox dot com>

3 years agoMFC r364032: setlocale(3): Add an EXAMPLES section and add LANG category
Gordon Bergling [Fri, 14 Aug 2020 06:46:40 +0000 (06:46 +0000)]
MFC r364032: setlocale(3): Add an EXAMPLES section and add LANG category

PR: 41824
Submitted by: Slaven Rezic <eserte at vran dot herceg dot de>
Obtained from: NetBSD

3 years agoMFC r364031: mbsrtowcs(3): Clarify the RETURN VALUES section
Gordon Bergling [Fri, 14 Aug 2020 06:44:34 +0000 (06:44 +0000)]
MFC r364031: mbsrtowcs(3): Clarify the RETURN VALUES section

PR: 215848
Submitted by: Andrew Stevenson <andrew at ugh dot net dot au>

3 years agoMFC r364005: telnet(1): Document -P option
Gordon Bergling [Fri, 14 Aug 2020 06:41:59 +0000 (06:41 +0000)]
MFC r364005: telnet(1): Document -P option

PR: 248157
Submitted by: Juraj Lutter <juraj at lutter dot sk>
Reviewed by: bcr
Approved by: bcr
Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D25794

3 years agoMFC r364112:
Mark Johnston [Fri, 14 Aug 2020 00:55:48 +0000 (00:55 +0000)]
MFC r364112:
script: Minor cleanups.

PR: 248377

3 years agoMFC r364039:
Mark Johnston [Fri, 14 Aug 2020 00:55:23 +0000 (00:55 +0000)]
MFC r364039:
script: Put the terminal in raw mode when playing back a session.

PR: 248377

3 years agoMFC r351703:
Edward Tomasz Napierala [Thu, 13 Aug 2020 19:07:07 +0000 (19:07 +0000)]
MFC r351703:

Relax compat.linux.osrelease checks.  This way one can do eg
'compat.linux.osrelease=3.10.0-957.12.1.el7.x86_64', which
corresponds to CentOS 7.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r351723:
Edward Tomasz Napierala [Thu, 13 Aug 2020 19:05:51 +0000 (19:05 +0000)]
MFC r351723:

Bump Linux version to 3.2.0.  Without it, binaries linked against
glibc 2.24 and up (eg Ubuntu 19.04) fail with "FATAL: kernel too old".

Sponsored by: The FreeBSD Foundation

3 years agoMFC r363303:
Edward Tomasz Napierala [Thu, 13 Aug 2020 19:03:32 +0000 (19:03 +0000)]
MFC r363303:

Add missing SysV IPC stats to linprocfs(4).  Fixes 'ipcs -l',
and also helps Oracle.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r363302:
Edward Tomasz Napierala [Thu, 13 Aug 2020 19:02:11 +0000 (19:02 +0000)]
MFC r363302:

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

Sponsored by: The FreeBSD Foundation

3 years agoMFC r363301:
Edward Tomasz Napierala [Thu, 13 Aug 2020 19:00:55 +0000 (19:00 +0000)]
MFC r363301:

Fix two typos in flag names in /proc/cpuinfo.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r363094:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:59:35 +0000 (18:59 +0000)]
MFC r363094:

Make linprocfs(5) report correct tty number in /proc/<PID>/stat.
Fixes sudo (sudo-1.8.21p2-3ubuntu1.2); previously would fail
with "sudo: no tty present and no askpass program specified".

Sponsored by: The FreeBSD Foundation

3 years agoMFC r362930:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:57:06 +0000 (18:57 +0000)]
MFC r362930:

Add /proc/sys/kernel/tainted to linprocfs(5).  Helps LTP.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r362929:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:55:36 +0000 (18:55 +0000)]
MFC r362929:

Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5)
create /sys/class/power_supply/.  This silences some warnings
from biology/linux-foldingathome.

Reported by: 0mp
Sponsored by: The FreeBSD Foundation

3 years agoMFC r362806:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:54:01 +0000 (18:54 +0000)]
MFC r362806:

Make linprocfs(5) create the /proc/<PID>/task/ directores.
This is to silence down some Chromium assertions.

PR: kern/240991
Analyzed by: Alex S <iwtcex@gmail.com>
Sponsored by: The FreeBSD Foundation

3 years agoMFC r356175:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:51:57 +0000 (18:51 +0000)]
MFC r356175:

Make linprocfs(5) provide an empty /proc/modules.  This should silence
some warnings.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r351822:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:50:32 +0000 (18:50 +0000)]
MFC r351822:

Fix /proc/mounts for autofs(5) mounts.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r351758:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:49:12 +0000 (18:49 +0000)]
MFC r351758:

Make linprocfs(4) report Tgid, Linux ltrace(1) needs it.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r347051:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:48:01 +0000 (18:48 +0000)]
MFC r347051:

Decode more CPU flags in cpuinfo.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r347030:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:46:31 +0000 (18:46 +0000)]
MFC r347030:

Fix flags in cpuinfo.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r347015:
Edward Tomasz Napierala [Thu, 13 Aug 2020 18:42:10 +0000 (18:42 +0000)]
MFC r347015:

Add sys/devices/system/cpu/{possible,present} to linsysfs(5).
That makes Linux lscpu(1) work.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r343121:
Edward Tomasz Napierala [Thu, 13 Aug 2020 17:42:50 +0000 (17:42 +0000)]
MFC r343121:

Workaround for nscd(8) failure with large entries.

It fixes a case where eg a 2KB group entry would take several seconds
to complete with cache enabled in nsswitch.conf.

3 years agoMFC r341009 by des:
Edward Tomasz Napierala [Thu, 13 Aug 2020 17:41:29 +0000 (17:41 +0000)]
MFC r341009 by des:

Style cleanup.

3 years agoMFC r340015:
Edward Tomasz Napierala [Thu, 13 Aug 2020 17:37:54 +0000 (17:37 +0000)]
MFC r340015:

Unbreak nscd(8).  Without this change the CMSG gets truncated.

3 years agoMFC r339919:
Edward Tomasz Napierala [Thu, 13 Aug 2020 17:36:52 +0000 (17:36 +0000)]
MFC r339919:

Make "nscd -t" work.

3 years agoMFC r363916:
Cy Schubert [Thu, 13 Aug 2020 14:26:25 +0000 (14:26 +0000)]
MFC r363916:

Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

3 years agoMFC r363960:
Mark Johnston [Thu, 13 Aug 2020 13:59:31 +0000 (13:59 +0000)]
MFC r363960:
Clean up reassignbuf() and buf_vlist_remove() a bit.

3 years agoMFC r363959:
Mark Johnston [Thu, 13 Aug 2020 13:58:21 +0000 (13:58 +0000)]
MFC r363959:
Remove the vfs.reassignbufcalls counter and sysctl.

3 years agoMFC r363979: Add CTL support for REPORT IDENTIFYING INFORMATION command.
Alexander Motin [Thu, 13 Aug 2020 00:42:09 +0000 (00:42 +0000)]
MFC r363979: Add CTL support for REPORT IDENTIFYING INFORMATION command.

It allows to report to initiator LU identifying information, preset via
"ident_info" and "text_ident_info" options.

Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
since we have no persistent storage it requires, so the information is
read-only for initiator and has to be set out-of-band.

3 years agoMFC r363955: Add Intel Apollo Lake AHCI ID.
Alexander Motin [Thu, 13 Aug 2020 00:40:40 +0000 (00:40 +0000)]
MFC r363955: Add Intel Apollo Lake AHCI ID.

3 years agoMFC r356321 (by markj):
Alexander Motin [Wed, 12 Aug 2020 16:16:17 +0000 (16:16 +0000)]
MFC r356321 (by markj):
Take the ifnet's address lock in igmp_v3_cancel_link_timers().

inm_rele_locked() may remove the multicast address associated with inm.

3 years agoMFC r363906:
Andrey V. Elsukov [Wed, 12 Aug 2020 11:49:35 +0000 (11:49 +0000)]
MFC r363906:
  Add m__getjcl SDT probe.

3 years agoMFC r363888:
Andrey V. Elsukov [Wed, 12 Aug 2020 11:48:19 +0000 (11:48 +0000)]
MFC r363888:
  Handle delayed checksums if needed in NAT64.

  Upper level protocols defer checksums calculation in hope we have
  checksums offloading in a network card. CSUM_DELAY_DATA flag is used
  to determine that checksum calculation was deferred. And IP output
  routine checks for this flag before pass mbuf to lower layer. Forwarded
  packets have not this flag.

  NAT64 uses checksums adjustment when it translates IP headers.
  In most cases NAT64 is used for forwarded packets, but in case when it
  handles locally originated packets we need to finish checksum calculation
  that was deferred to correctly adjust it.

  Add check for presence of CSUM_DELAY_DATA flag and finish checksum
  calculation before adjustment.

3 years agoMFC r363900:
Andrey V. Elsukov [Wed, 12 Aug 2020 11:43:43 +0000 (11:43 +0000)]
MFC r363900:
  Fix typo.

3 years agoMFC r363904:
Andrey V. Elsukov [Wed, 12 Aug 2020 11:42:36 +0000 (11:42 +0000)]
MFC r363904:
  Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.

3 years agoMFC r363889: bsnmptools: make it print protocol errors to stderr instead of stdout
Eugene Grosbein [Wed, 12 Aug 2020 10:11:34 +0000 (10:11 +0000)]
MFC r363889: bsnmptools: make it print protocol errors to stderr instead of stdout

Reviewed by: syrinx, bz
Differential Revision: https://reviews.freebsd.org/D25911

3 years agoMFC userland part of r351729
Pawel Biernacki [Wed, 12 Aug 2020 10:03:10 +0000 (10:03 +0000)]
MFC userland part of r351729

Add sysctlbyname system call

3 years agoMFC r363907: environ(7): Update the description and include some more environment...
Gordon Bergling [Wed, 12 Aug 2020 07:00:06 +0000 (07:00 +0000)]
MFC r363907: environ(7): Update the description and include some more environment variables

- Add a better introduction to the DESCRIPTION section
- Add a description for MANPATH and POSIXLY_CORRECT
- Asorted improvements for the usage of some macros

PR: 43823
Submitted by: Lyndon Nerenberg <lyndon at orthanc dot ab dot ca>
Reviewed by: 0mp, bcr
Approved by: 0mp, bcr
Differential Revision: https://reviews.freebsd.org/D25912

3 years agoMFC r364037: Add some more checks to make APEI driver more robust.
Alexander Motin [Wed, 12 Aug 2020 02:05:33 +0000 (02:05 +0000)]
MFC r364037: Add some more checks to make APEI driver more robust.

3 years agoMFC r350885 (by avos):
Mark Johnston [Tue, 11 Aug 2020 17:54:10 +0000 (17:54 +0000)]
MFC r350885 (by avos):
rtwn_pci: add device ID for RTL8192CE.

PR: 239795

3 years agoMFC: Mirror recommendation from Handbook to avoid linking conflicts when
Gregory Neil Shapiro [Tue, 11 Aug 2020 17:51:31 +0000 (17:51 +0000)]
MFC: Mirror recommendation from Handbook to avoid linking conflicts when
     pulling in SASL libraries.  (r363750)

3 years agoMFC r362807:
Edward Tomasz Napierala [Tue, 11 Aug 2020 15:08:32 +0000 (15:08 +0000)]
MFC r362807:

Fix misplaced voltages/temperatures labels in 'sesutil show'.

PR: bin/247384
Reported by: brd

3 years agoMFC r355751:
Edward Tomasz Napierala [Tue, 11 Aug 2020 15:07:27 +0000 (15:07 +0000)]
MFC r355751:

Add 'sesutil show' subcommand to show enclosure and its contents
in a user-friendly way.

Relnotes: yes
Sponsored by: Klara, Inc.

3 years agoMFC r355130:
Edward Tomasz Napierala [Tue, 11 Aug 2020 15:05:02 +0000 (15:05 +0000)]
MFC r355130:

Fix typos.

Sponsored by: Klara, Inc.

3 years agoMFC r363841:
Mark Johnston [Tue, 11 Aug 2020 13:51:48 +0000 (13:51 +0000)]
MFC r363841:
Remove an incorrect assertion from in6p_lookup_mcast_ifp().

3 years agoMFC r363064,363067,363081,363136: optimize install(1) a bit.
Eugene Grosbein [Tue, 11 Aug 2020 11:32:44 +0000 (11:32 +0000)]
MFC r363064,363067,363081,363136: optimize install(1) a bit.

Currently, "install -s -S" behaviour is inefficient for upgrade.
First it finds that destination file already exists and copies
source file to temporary file. Then it calls strip(1)
with name of temporary file as single agrument and our strip(1) creates
another temporary file in the /tmp (or TMPDIR) making another copy
that is finally copied to DESTDIR third time.

Meantime, strip(1) has an option "-o dst" to specify destination
so install(1) is allowed to skip initial copying from obj to DESTDIR.
This change makes it do so.

This optimization descreases total amount of data sent to
both of /tmp and DESTDIR during "make installworld" by 32% or so.
See the differential for details.

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

3 years agoMFC r363829: directory(3): Add an ERRORS section
Gordon Bergling [Tue, 11 Aug 2020 10:56:44 +0000 (10:56 +0000)]
MFC r363829: directory(3): Add an ERRORS section

- Add an ERRORS section for opendir(3) and closedir(3)
- Document also the errors of readdir(3), readdir_r(3) and telldir(3)
- Convert the code sample into an EXAMPLES section

PR: 75711
Submitted by: abc <abc at ai1 dot anchorage dot mtaonline dot net>
Reviewed by: 0mp, bcr, jilles
Approved by: 0mp, bcr, jilles
Obtained from: partial from OpenBSD
Differential Revision: https://reviews.freebsd.org/D25892

3 years agoMFC r363830: iovctl.conf(5): Use Lk macro for the URL of the UCL website
Gordon Bergling [Tue, 11 Aug 2020 10:41:36 +0000 (10:41 +0000)]
MFC r363830: iovctl.conf(5): Use Lk macro for the URL of the UCL website

PR: 248334
Submitted by: chuck at tuffli dot net
Reviewed by: bcr, 0mp
Approved by: bcr, 0mp
Differential Revision: https://reviews.freebsd.org/D25891

3 years agoMFC: r363210
Rick Macklem [Tue, 11 Aug 2020 05:10:01 +0000 (05:10 +0000)]
MFC: r363210
Fix the pNFS flexible file layout client for servers with small write size.

The code in nfscl_dofflayout() loops when a flexible file layout server
provides a small write data limit (no extant server is known to do this).
If/when it looped, it erroneously reused the "drpc" argument for the
mirror worker thread, corrupting it.
This patch fixes the problem by only using the calling thread after the
first loop iteration.

Found during testing by simulating a server with a small write size.

Since no extant pNFS server is known to provide a small write size,
this fix it not needed in practice at this time.

3 years agoMFC r363852: Remove extra memset() left after r342388.
Alexander Motin [Tue, 11 Aug 2020 00:41:48 +0000 (00:41 +0000)]
MFC r363852: Remove extra memset() left after r342388.

This memset() wiped MPI2_FUNCTION_SCSI_TASK_MGMT set by mprsas_alloc_tm(),
that broke target reset on device removal, making later re-insertion into
the same slot impossible, since firmware was still waiting for the driver
to finish with the removed device.

3 years agoMFC r363966:
Brooks Davis [Mon, 10 Aug 2020 18:26:18 +0000 (18:26 +0000)]
MFC r363966:

Preserve ASLR vm_map flags across fork

In the most common case (fork+execve) this doesn't matter, but further
attempts to apply entropy would fail in (e.g.) a pre-fork server.

Reported by: Alfredo Mazzinghi
Reviewed by: kib, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25966

3 years agoMFC r363378
Vincenzo Maffione [Mon, 10 Aug 2020 17:53:09 +0000 (17:53 +0000)]
MFC r363378

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
Differential Revision:  https://reviews.freebsd.org/D25541

3 years agoMFC r363988:
Dimitry Andric [Mon, 10 Aug 2020 17:35:58 +0000 (17:35 +0000)]
MFC r363988:

Fix clang 11 -Wformat warnings in yp_mkdb:

usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
                        ~~~~                         ^~~~~~~~
usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                    data.data);
                    ^~~~~~~~~

3 years agoMFC r363813:
Konstantin Belousov [Mon, 10 Aug 2020 10:52:54 +0000 (10:52 +0000)]
MFC r363813:
Add SOL_LOCAL symbolic constant for unix socket option level.

3 years agoMFC r364021: grep(1): correct typos for 'if a name patches' to 'if a name matches'
Gordon Bergling [Mon, 10 Aug 2020 06:19:33 +0000 (06:19 +0000)]
MFC r364021: grep(1): correct typos for 'if a name patches' to 'if a name matches'

PR: 237635
Submitted by: durin42 <raf atdurin42 dot com>
Reviewed by: kevans
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D25994

3 years agoMFC r363880 (by lwhsu):
Mark Johnston [Mon, 10 Aug 2020 02:39:42 +0000 (02:39 +0000)]
MFC r363880 (by lwhsu):
Appease gcc's -Wparentheses (and -Werror)

3 years agoMFC r364013: Allow ACPI APEI driver build without PCI.
Alexander Motin [Mon, 10 Aug 2020 00:43:43 +0000 (00:43 +0000)]
MFC r364013: Allow ACPI APEI driver build without PCI.

On x86 it seems difficult to build ACPI without PCI, but some aarch64
users appears to be doing it.

3 years agoMFC: 362681, 362697, 362914, 362984, 362986, 362987, 363091, 363172, 363809,
Stefan Eßer [Sat, 8 Aug 2020 16:41:28 +0000 (16:41 +0000)]
MFC: 362681, 362697, 362914, 362984, 362986, 362987, 363091, 363172, 363809,
     363810, 363811, 363915

Import new 2-clause BSD licenced implementation of the bc and dc commands

These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:

- They do not depend on external large number functions (i.e. no dependency
  on OpenSSL or any other large-number library)

- They implements all features found in GNU bc/dc (with the exception of
  the forking of sub-processes in dc, which the author of this version
  considers a security issue).

- They are significantly faster than the current code in base (more than
  2 orders of magnitude in some of my tests, e.g. for 12345^100000).

- They should be fully compatible with all features and the behavior of the
  current implementations in FreeBSD (not formally verified).

- They support POSIX message catalogs and come with localized messages in
  Chinese, Dutch, English, French, German, Japanese, Polish, Portuguese,
  and Russian.

- They offer very detailed man-pages that provide far more information than
  the current ones.

This code is not built and installed in FreeBSD-12, unless WITH_GH_BC=yes
is set (e.g. in src.conf) during builworld and installworld. It has been
imported and made the default in FreeBSD-CURRENT, and all improvements and
changes requested for the version in -CURRENT are included in this initial
import into a stable branch.

3 years agoMFC r363931:
Mateusz Guzik [Fri, 7 Aug 2020 23:32:42 +0000 (23:32 +0000)]
MFC r363931:

    vfs hash: annotate the lock with __exclusive_cache_line

3 years agoMFC r363855,r363890,r363891
Mateusz Guzik [Fri, 7 Aug 2020 23:31:45 +0000 (23:31 +0000)]
MFC r363855,r363890,r363891

    cache: add missing numcache detrement on insertion failure
    cache: convert ncnegnash into a macro
    cache: reduce zone alignment to 8 bytes

3 years agoMFC r362661: Add mostly dummy hw.pci.enable_aspm tunable.
Alexander Motin [Fri, 7 Aug 2020 17:32:53 +0000 (17:32 +0000)]
MFC r362661: Add mostly dummy hw.pci.enable_aspm tunable.

The only thing this tunable enables now is reporting to ACPI _OSC that
Active State Power Management and Clock Power Management Capability are
"supported" by the OS.

I've found that at least some Supermicro server boards do not allow OS
to support native PCIe hot-plug unless it reports those capabilities.
After spending significant time in PCIe specs I have found very little
motivation for that, and none of it applies to those motherboards, not
enabling ASPM themselves.  So unless OS explicitly wants to save power,
I see nothing for it to do there actually.

I guess it may get sense to support ASPM when we get Thunderbolt support.
Otherwise I have no system with PCIe hot-plug where power saving matters.

It would be nice to enable this by default, but I worry that it affect
power saving of some laptops, even though I haven't noticed that myself.

3 years agoFix bug in r363624 12 adaptation.
Alexander Motin [Fri, 7 Aug 2020 15:58:23 +0000 (15:58 +0000)]
Fix bug in r363624 12 adaptation.

3 years agoMFC r362230: libcasper(3): Document HISTORY within the manpages
Gordon Bergling [Fri, 7 Aug 2020 15:11:27 +0000 (15:11 +0000)]
MFC r362230: libcasper(3): Document HISTORY within the manpages

Reviewed by: bcr
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24695

3 years agoMFC r363291: devstat(9): Update the man page to reflect the current implementation
Gordon Bergling [Fri, 7 Aug 2020 15:03:20 +0000 (15:03 +0000)]
MFC r363291: 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
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D25677

3 years agoMFC r363736:
Mark Johnston [Fri, 7 Aug 2020 13:42:47 +0000 (13:42 +0000)]
MFC r363736:
ng_iface(4): Remove unsupported protocols.

3 years agoMFC r363735:
Mark Johnston [Fri, 7 Aug 2020 13:40:49 +0000 (13:40 +0000)]
MFC r363735:
ng_iface(4): Set the current VNET before calling netisr_dispatch().

PR: 242406

3 years agoMFC 363737:
Mateusz Piotrowski [Fri, 7 Aug 2020 09:50:44 +0000 (09:50 +0000)]
MFC 363737:

Point to rc(8) for more details about the autoboot variable

Reviewed by: bcr, imp
Differential Revision: https://reviews.freebsd.org/D25904

3 years agoMFC r363624: Add initial driver for ACPI Platform Error Interfaces.
Alexander Motin [Fri, 7 Aug 2020 01:05:10 +0000 (01:05 +0000)]
MFC r363624: Add initial driver for ACPI Platform Error Interfaces.

APEI allows platform to report different kinds of errors to OS in several
ways.  We've found that Supermicro X10/X11 motherboards report PCIe errors
appearing on hot-unplug via this interface using NMI.  Without respective
driver it ended up in kernel panic without any additional information.

This driver introduces support for the APEI Generic Hardware Error Source
reporting via NMI, SCI or polling.  It decodes the reported errors and
either pass them to pci(4) for processing or just logs otherwise.  Errors
marked as fatal still end up in kernel panic, but some more informative.

When somebody get to native PCIe AER support implementation both of the
reporting mechanisms should get common error recovery code.  Since in our
case errors happen when the device is already gone, there is nothing to
recover, so the code just clears the error statuses, practically ignoring
the otherwise destructive NMIs in nicer way.

Relnotes: yes
Sponsored by: iXsystems, Inc.

3 years agoMFC r360328 (by vangyzen):
Alexander Motin [Fri, 7 Aug 2020 00:56:20 +0000 (00:56 +0000)]
MFC r360328 (by vangyzen):
Fix handling of NMIs from unknown sources (BMC, hypervisor)

Release kernels have no KDB backends enabled, so they discard an NMI
if it is not due to a hardware failure.  This includes NMIs from
IPMI BMCs and hypervisors.

Furthermore, the interaction of panic_on_nmi, kdb_on_nmi, and
debugger_on_panic is confusing.

Respond to all NMIs according to panic_on_nmi and debugger_on_panic.
Remove kdb_on_nmi.  Expand the meaning of panic_on_nmi by making
it a bitfield.  There are currently two bits: one for NMIs due to
hardware failure, and one for all others.  Leave room for more.

If panic_on_nmi and debugger_on_panic are both true, don't actually panic,
but directly enter the debugger, to allow someone to leave the debugger
and [hopefully] resume normal execution.

Relnotes: yes: machdep.kdb_on_nmi is gone; machdep.panic_on_nmi changed

3 years agoFix build after r363999.
Alexander Motin [Fri, 7 Aug 2020 00:50:41 +0000 (00:50 +0000)]
Fix build after r363999.

3 years agoMFC r363527: Allow swi_sched() to be called from NMI context.
Alexander Motin [Fri, 7 Aug 2020 00:40:28 +0000 (00:40 +0000)]
MFC r363527: Allow swi_sched() to be called from NMI context.

For purposes of handling hardware error reported via NMIs I need a way to
escape NMI context, being too restrictive to do something significant.

To do it this change introduces new swi_sched() flag SWI_FROMNMI, making
it careful about used KPIs.  On platforms allowing IPI sending from NMI
context (x86 for now) it immediately wakes clk_intr_event via new IPI_SWI,
otherwise it works just like SWI_DELAY.

3 years agoMFC r363495: Introduce ipi_self_from_nmi().
Alexander Motin [Fri, 7 Aug 2020 00:33:28 +0000 (00:33 +0000)]
MFC r363495: Introduce ipi_self_from_nmi().

It allows safe IPI sending to current CPU from NMI context.

Unlike other ipi_*() functions this waits for delivery to leave LAPIC in
a state safe for interrupted code.

3 years agoMFC r363490: Make lapic_ipi_vectored(APIC_IPI_DEST_SELF) NMI safe.
Alexander Motin [Fri, 7 Aug 2020 00:26:16 +0000 (00:26 +0000)]
MFC r363490: Make lapic_ipi_vectored(APIC_IPI_DEST_SELF) NMI safe.

Sending IPI to self or all CPUs does not require write into upper part of
the ICR, prone to races.  Previously the code disabled interrupts, but it
was not enough for NMIs.  Instead of that when possible write only lower
part of the register, or use special SELF IPI register in x2APIC mode.

This also removes ICR reads used to preserve reserved bits on write.
It was there from the beginning, but I failed to find explanation why,
neither I see Linux doing it.  Specification even tells that ICR content
may be lost in deep C-states, so if hardware does not bother to preserve
it, why should we?

3 years agoMFC r363020: test: add libkvm read test
Alfredo Dal'Ava Junior [Thu, 6 Aug 2020 20:44:18 +0000 (20:44 +0000)]
MFC r363020: test: add libkvm read test

This test checks if value received from kvm_read is sane, based on
value returned by sysctl interface.

Reviewed by: jhb
Approved by: jhibbits (mentor)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D23783