]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

3 years agoMFC r363692: diff: fix side_by_side
Kyle Evans [Thu, 6 Aug 2020 18:17:19 +0000 (18:17 +0000)]
MFC r363692: diff: fix side_by_side

It's currently unclear to me how this could have worked previously; \n here
is not a literal newline but actual '\' 'n', and was getting passed to the
underlying regex engine as such. regex(3) does not translate this to a
newline, and this became an error because we don't really allow escaping
of arbitrary ordinary characters anymore.

Run the pattern strings through printf to make sure we're dealing with real
newlines before passing them through to atf_check, which ultimately feeds
them directly to regcomp(3).

This fix is different than that will be needed for sed, in that this is the
proper way to inject newlines into search strings as long as regex(3)
won't combine \ + n as folks might expect.

3 years agoMFC r361720, r362787: Simplify mailer.conf installation
Kyle Evans [Thu, 6 Aug 2020 18:13:45 +0000 (18:13 +0000)]
MFC r361720, r362787: Simplify mailer.conf installation

r361720:
pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL

When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that
conflict, and hilarity ensues. There's currently three different places that
we might install mailer.conf:

- ^/etc/Makefile (package=runtime, contingent on MK_MAIL != no)
- ^/libexec/dma/dmagent/Makefile (package=dma, contingent on MK_SENDMAIL !=
no)
- ^/usr.sbin/mailwrapper/Makefile (package=utilities, contingent on
not-installed)

The mailwrapper installation will effectively never happen because the ^/etc
one will first.

This patch simplifies the whole situation; remove the ^/etc/Makefile version
and install it primarily in mailwrapper if MK_MAILWRAPPER != "no". The
scenarios covered in mailwrapper are:

- sendmail(8) is installed, dma(8) may or may not be installed
- neither sendmail(8) nor dma(8) is installed

In the first scenario, sendmail(8) is dominant so we can go ahead and
install the version in ^/etc/mail. In the unlisted scenario, sendmail(8) is
not installed but dma(8) is, we'll let ^/libexec/dma/dmagent do the
installation. In the second listed scenario, we still want to install an
example mailer.conf so just install the base sendmail(8) version.

r362787:
mailwrapper: switch mailer.conf to CONFS

This matches what was already being done in dma(8), and should again make
this merge with etcupdate/mergemaster.

3 years agoMFC r355429 (by scottl): Add support for new sound HDA hardware
Alexander Motin [Thu, 6 Aug 2020 15:25:11 +0000 (15:25 +0000)]
MFC r355429 (by scottl): Add support for new sound HDA hardware

3 years agoMFC r354143 (by scottl):
Alexander Motin [Thu, 6 Aug 2020 15:23:51 +0000 (15:23 +0000)]
MFC r354143 (by scottl):
Add device IDs for the next generation of Intel HDA audio.

3 years agoMFC r340071: Adjust SiS 966/968 HDA controller naming.
Alexander Motin [Thu, 6 Aug 2020 15:20:31 +0000 (15:20 +0000)]
MFC r340071: Adjust SiS 966/968 HDA controller naming.

3 years agoMFC r363682:
Mark Johnston [Thu, 6 Aug 2020 14:08:23 +0000 (14:08 +0000)]
MFC r363682:
Fix a logic error in uipc_ready_scan().

3 years agoMFC r363447:
Mark Johnston [Thu, 6 Aug 2020 14:07:49 +0000 (14:07 +0000)]
MFC r363447:
MFOpenZFS: Fix zpool history unbounded memory usage

PR: 247557

3 years agoMFC r248454:
Konstantin Belousov [Thu, 6 Aug 2020 10:12:39 +0000 (10:12 +0000)]
MFC r248454:
Provide more correct description for sysctl kern.smp.cores.

PR: 248454

3 years agoMFC r362042: iicbb: rebuild the bit-banging algorithms using different primitives
Andriy Gapon [Thu, 6 Aug 2020 08:06:07 +0000 (08:06 +0000)]
MFC r362042: iicbb: rebuild the bit-banging algorithms using different primitives

I2C_SET was quite inflexible, it used too long delays as well as some
unnecessary delays.  The new building blocks are iicbb_clockin and
iicbb_clockout.  The former sets SDA and starts the high period of SCL,
the latter executes the low period of SCL.  What happens during the high
phase depends on the operation.  For writes we just hold both lines, for
reads we poll SDA.  S, Sr and P change SDA in the middle of the high
period.

Also, the calculation of udelay has been updated, so that the resulting
period more closely corresponds the requested bus frequency.  There is a
new knob, io_delay, that allows to further adjust udelay based on the
estimated latency of pin toggling operations.

Finally, I slightly changed debug tracing and added error indicators to
it.  The debug prints are compiled in but disabled by default.  This can
be of use if there is any fallout from this change.

3 years agoMFC r363409: libbe: annotate lbh as __unused in be_is_auto_snapshot_name
Kyle Evans [Thu, 6 Aug 2020 04:54:59 +0000 (04:54 +0000)]
MFC r363409: libbe: annotate lbh as __unused in be_is_auto_snapshot_name

lbh is included for consistency with other functions and in case
future work needs to use it, but it is currently unused. Mark it,
and a post-OpenZFS-import world will be able to raise WARNS of
libbe to the default (pending some minor changes to openzfs libzfs).

3 years agoMFC r363421: pkg-bootstrap: complain on improper `pkg bootstrap` usage
Kyle Evans [Thu, 6 Aug 2020 04:52:30 +0000 (04:52 +0000)]
MFC r363421: pkg-bootstrap: complain on improper `pkg bootstrap` usage

Right now, the bootstrap will gloss over things like pkg bootstrap -x or
pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
at the correct formatting.

3 years agoMFC r363917:
Mark Johnston [Wed, 5 Aug 2020 17:07:13 +0000 (17:07 +0000)]
MFC r363917:
Fix a TOCTOU vulnerability in freebsd32_copyin_control().

PR: 248257
Reported by: m00nbsd working with Trend Micro Zero Day Initiative
Reviewed by: kib
Security: SA-20:23.sendmsg
Security: CVE-2020-7460
Security: ZDI-CAN-11543

3 years agoMFC r362564: stand: remove redundant declarations
Kyle Evans [Wed, 5 Aug 2020 14:42:45 +0000 (14:42 +0000)]
MFC r362564: 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>.

3 years agoMFC r361257: bsdinstall: do a `certctl rehash` upon installation of config
Kyle Evans [Wed, 5 Aug 2020 14:40:09 +0000 (14:40 +0000)]
MFC r361257: bsdinstall: do a `certctl rehash` upon installation of config

If certctl is installed on the system we're configuring, do a certctl
rehash.

Note that certctl may not be present if the world we've installed was built
either WITHOUT_OPENSSL or WITHOUT_CAROOT. In this scenario, we don't
currently see if the host has a certctl as this may be an indication that
the system *shouldn't* have certs installed into /etc/ssl.

3 years agoMFC r359836-r359837, r359891, r360236-r360237: close_range(2)
Kyle Evans [Wed, 5 Aug 2020 03:53:57 +0000 (03:53 +0000)]
MFC r359836-r359837, r359891, r360236-r360237: close_range(2)

This commit diverges from our usual procedure of committing generated files
separately because the original commit, r359836, conflated userland use (in
tests) with the implementation.

__FreeBSD_version was already bumped ~15 hours prior to this MFC, 1201522
marks the introduction of close_range.

CPython will use this syscall for some pretty sizable performance gains.

r359836:
Implement a close_range(2) syscall

close_range(min, max, flags) allows for a range of descriptors to be
closed. The Python folk have indicated that they would much prefer this
interface to closefrom(2), as the case may be that they/someone have special
fds dup'd to higher in the range and they can't necessarily closefrom(min)
because they don't want to hit the upper range, but relocating them to lower
isn't necessarily feasible.

sys_closefrom has been rewritten to use kern_close_range() using ~0U to
indicate closing to the end of the range. This was chosen rather than
requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the
call to kern_close_range for simplicity.

The flags argument of close_range(2) is currently unused, so any flags set
is currently EINVAL. It was added to the interface in Linux so that future
flags could be added for, e.g., "halt on first error" and things of this
nature.

This patch is based on a syscall of the same design that is expected to be
merged into Linux.

r359837:
sysent: re-roll after introduction of close_range in r359836

r359891:
close_range/closefrom: fix regression from close_range introduction

close_range will clamp the range between [0, fdp->fd_lastfile], but failed
to take into account that fdp->fd_lastfile can become -1 if all fds are
closed. =-( In this scenario, just return because there's nothing further we
can do at the moment.

Add a test case for this, fork() and simply closefrom(0) twice in the child;
on the second invocation, fdp->fd_lastfile == -1 and will trigger a panic
before this change.

r360236:
close_range(2): use newly assigned AUE_CLOSERANGE

r360237:
sysent: re-roll after 360236 (AUE_CLOSERANGE used)

3 years agoMFC r360235: bsm: add AUE_CLOSERANGE
Kyle Evans [Wed, 5 Aug 2020 03:30:03 +0000 (03:30 +0000)]
MFC r360235: bsm: add AUE_CLOSERANGE

3 years agoMFC r363431: Untie nmi_handle_intr() from DEV_ISA.
Alexander Motin [Wed, 5 Aug 2020 01:43:40 +0000 (01:43 +0000)]
MFC r363431: Untie nmi_handle_intr() from DEV_ISA.

The only part of nmi_handle_intr() depending on ISA is isa_nmi(), which is
already wrapped.  Entering debugger on NMI does not really depend on ISA.

3 years agoMFC r361992: ixl(4): Add FW recovery mode support and other things
Eric Joyner [Tue, 4 Aug 2020 23:30:10 +0000 (23:30 +0000)]
MFC r361992: ixl(4): Add FW recovery mode support and other things

Update the iflib version of ixl driver based on the OOT version ixl-1.11.29.

Major changes:

- Extract iflib specific functions from ixl_pf_main.c to ixl_pf_iflib.c
  to simplify code sharing between legacy and iflib version of driver

- Add support for most recent FW API version (1.10), which extends FW
  LLDP Agent control by user to X722 devices

- Improve handling of device global reset

- Add support for the FW recovery mode

- Use virtchnl function to validate virtual channel messages instead of
  using separate checks

- Fix MAC/VLAN filters accounting

Relnotes: yes
Sponsored by: Intel Corporation

3 years agoMFC r362962, r362963:
Mark Johnston [Tue, 4 Aug 2020 16:06:58 +0000 (16:06 +0000)]
MFC r362962, r362963:
iflib: Fix handling of mbuf cluster allocation failures.

3 years agoMFC r358996 (by pkelsey):
Mark Johnston [Tue, 4 Aug 2020 15:48:12 +0000 (15:48 +0000)]
MFC r358996 (by pkelsey):
Fix iflib zero-length fragment handling

MFC r358997 (by pkelsey):
Remove freelist contiguous-indexes assertion from rxd_frag_to_sd()

MFC r358998 (by pkelsey):
Allow iflib drivers to specify the buffer size used for each receive queue

MFC r358999 (by pkelsey):
Remove refill budget from iflib

MFC r359000 (by pkelsey):
Fix if_vmx receive checksum offload bug and harden against the device
skipping receive descriptors

MFC r359001 (by pkelsey):
Adjust if_vmx default receive parameters for better out-of-box performance

MFC r359002 (by pkelsey):
Remove extraneous code from iflib

MFC r359029 (by pkelsey):
Restore power-of-2 queue count constraint from r290948

Tested by: marcus, mav

3 years agoregen
Pawel Biernacki [Tue, 4 Aug 2020 12:44:47 +0000 (12:44 +0000)]
regen

3 years agoMFC kernel part of r351729
Pawel Biernacki [Tue, 4 Aug 2020 12:42:55 +0000 (12:42 +0000)]
MFC kernel part of r351729

Add sysctlbyname system call

The two syscalls that exists in head but not in stable/12 are marked as
UNIMPL to keep the __sysctlbyname syscall number the same (570).
Userland part to be commited in about a week time.

Requested by: mjg
Discussed with: kib

3 years agoMFC r363630:
Ryan Moeller [Tue, 4 Aug 2020 12:04:47 +0000 (12:04 +0000)]
MFC r363630:

libpmc: Use known pmc_cpuid buffer size

Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various
buffers for reading it in libpmc.  This avoids some extra syscalls and
malloc/frees.

While in here, use strlcpy to copy a user-provided cpuid string instead of
memcpy, to make sure we terminate the buffer.

Reviewed by:    mav
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D25679

3 years agoMFC r363656: When modifying LUN pass "special" options too.
Alexander Motin [Tue, 4 Aug 2020 02:31:52 +0000 (02:31 +0000)]
MFC r363656: When modifying LUN pass "special" options too.

Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value.  Now CTL completely
replaces them, so we must pass everything still relevant.

3 years agoMFC r363649:
Mark Johnston [Tue, 4 Aug 2020 00:28:06 +0000 (00:28 +0000)]
MFC r363649:
ps(1): Fix formatting of the "command" field for kernel threads.

3 years agoMFC r363608:
Mark Johnston [Mon, 3 Aug 2020 23:06:33 +0000 (23:06 +0000)]
MFC r363608:
mpr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).

3 years agoMFC r363623:
Mark Johnston [Mon, 3 Aug 2020 23:05:47 +0000 (23:05 +0000)]
MFC r363623:
cxgbe(4): Stop checking for failures from malloc(M_WAITOK).

3 years agoMFC r363078:
Hans Petter Selasky [Mon, 3 Aug 2020 09:18:59 +0000 (09:18 +0000)]
MFC r363078:
Implement the bitmap_subset() function in the LinuxKPI. This function
checks if the bitmap pointed to by the first argument is a subset of
the bitmap pointed to by the second argument. The function returns one
on success and zero on failure.

Sponsored by: Mellanox Technologies

3 years agoMFC r363077:
Hans Petter Selasky [Mon, 3 Aug 2020 09:13:06 +0000 (09:13 +0000)]
MFC r363077:
Implement the array_size() function in the LinuxKPI. This function
basically multiplies its two arguments and returns SIZE_MAX if the
result overflows the size_t type.  Else the product of the two
arguments is returned.

Bump the FreeBSD_version to mitigate issues with existing
implementation of array_size() in drm-devel-kmod.

Discussed with: manu@
Sponsored by: Mellanox Technologies

3 years agoMFC r361549:
Hans Petter Selasky [Mon, 3 Aug 2020 09:11:10 +0000 (09:11 +0000)]
MFC r361549:
Add overflow.h to the LinuxKPI.

Only add check_add_overflow and check_mul_overflow as those are the only
two needed function by DRM v5.3.
Both gcc and clang have builtin to do this check so use them directly
but throw an error if the compiler/code checker doesn't support this builtin.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselsasky
Differential Revision: https://reviews.freebsd.org/D25015