]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agocp: fall back to read/write if copy_file_range fails
asomers [Fri, 11 Sep 2020 20:49:36 +0000 (20:49 +0000)]
cp: fall back to read/write if copy_file_range fails

Even though copy_file_range has a file-system agnostic version, it still
fails on devfs (perhaps because the file descriptor is non-seekable?) In
that case, fallback to old-fashioned read/write. Fixes
"cp /dev/null /tmp/null"

PR: 249248
Reported by: Michael Butler
Reviewed by: mjg
MFC-With: 365549
Differential Revision: https://reviews.freebsd.org/D26395

3 years agoAdd constant for the DE_CFG MSR on AMD CPUs.
jhb [Fri, 11 Sep 2020 20:32:40 +0000 (20:32 +0000)]
Add constant for the DE_CFG MSR on AMD CPUs.

Reported by: Patrick Mooney <pmooney@pfmooney.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25885

3 years agoImprove the documenation for bus_dma templates. Also add notes to
scottl [Fri, 11 Sep 2020 19:45:26 +0000 (19:45 +0000)]
Improve the documenation for bus_dma templates.  Also add notes to
make it clear that filters may not work correctly and that their use
is deprecated.

MFC after: 3 days

3 years agoImprovements for the src.conf(5) and build(7) man pages
gbe [Fri, 11 Sep 2020 18:09:49 +0000 (18:09 +0000)]
Improvements for the src.conf(5) and build(7) man pages

PR: 203863 (based on)
Submitted by: Russell Haley <russ dot haley at gmail dot com>
Reviewed by: bcr, imp
Approved by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26343

3 years agoFix indentation following r365638. No functional changes.
gjb [Fri, 11 Sep 2020 17:05:09 +0000 (17:05 +0000)]
Fix indentation following r365638.  No functional changes.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoAdd a NOGIT option to avoid explicitly requiring devel/git if the
gjb [Fri, 11 Sep 2020 17:04:09 +0000 (17:04 +0000)]
Add a NOGIT option to avoid explicitly requiring devel/git if the
sources are obtained through a different mechanism.

Reported and tested by: Ruslan Garipov
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFV r365636: libarchive: import fix for WARNS=6 builds in testing bits
kevans [Fri, 11 Sep 2020 16:13:45 +0000 (16:13 +0000)]
MFV r365636: libarchive: import fix for WARNS=6 builds in testing bits

Two more cases of explicitly marking globals for internal linkage where they
need not be shared. Committed upstream as of a38e62314a1f.

MFC after: 1 week

3 years agoiwm: fix regression from r365419 (ieee80211_media_change())
bz [Fri, 11 Sep 2020 14:18:47 +0000 (14:18 +0000)]
iwm: fix regression from r365419 (ieee80211_media_change())

In r365419 ieee80211_media_change() callers were updated to not longer
act on the obselete ENETRESET return code.
While in the old days iwm has done a stop/init cycle in these cases,
this was not executed since r193340.
As a consequence simplify iwm code as well by passing ieee80211_media_change()
right to ieee80211_vap_attach() as there is no more need for a local
implementation.

Reported by: Tomoaki AOKI (junchoon dec.sakura.ne.jp)
Tested by: Tomoaki AOKI (junchoon dec.sakura.ne.jp)
MFC after: 3 days
X-MFC: fix is already in stable/12
PR: 248955

3 years agoOnly set WARNS if not defined
kevans [Fri, 11 Sep 2020 13:28:37 +0000 (13:28 +0000)]
Only set WARNS if not defined

This would allow interested parties to do experimental runs with an
environment set appropriately to raise all the warnings throughout the
build; e.g. env WARNS=6 NO_WERROR=yes buildworld.

Not currently touching the numerous instances in ^/tools.

MFC after: 1 week

3 years agoFix compatibility regression after r364117.
ae [Fri, 11 Sep 2020 10:07:09 +0000 (10:07 +0000)]
Fix compatibility regression after r364117.

Properly handle the case, when some opcode keywords follow after
the `frag` opcode without additional options.

Reported by: Evgeniy Khramtsov <evgeniy at khramtsov org>

3 years agodtrace: fix fbt return probes on RISC-V
kp [Fri, 11 Sep 2020 09:15:49 +0000 (09:15 +0000)]
dtrace: fix fbt return probes on RISC-V

Return values are passed in a0, so read it from there. We also pass a1 through
to userspace, as the ABI allows small structs to be returned in registers
a0/a1. While here read the register values directly from the trapframe rather
than rtval, and remove the now unneeded argument from dtrace_invop().

Set fbtp_roffset so that we get the correct return location in arg0.

Reviewed by: markj
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26389

3 years agoRevert r365592 and r365603 as the tests are fixed by r365593
lwhsu [Fri, 11 Sep 2020 05:45:27 +0000 (05:45 +0000)]
Revert r365592 and r365603 as the tests are fixed by r365593

PR: 249236
Sponsored by: The FreeBSD Foundation

3 years agomemfd_create: simplify HUGETLB support a little bit
kevans [Fri, 11 Sep 2020 02:02:15 +0000 (02:02 +0000)]
memfd_create: simplify HUGETLB support a little bit

This also fixes a minor issue that was missed in the initial review; the
layout of the MFD_HUGE_* flags is actually not 1:1 bit:flag -- it instead
borrowed the Linux convention of how this is laid out since it was
originally implemented on Linux, the top 6 bits represent the shift required
for the requested page size.

This allows us to remove the flag <-> pgsize mapping table and simplify the
logic just prior to validation of the requested page size.

While we're here, fix two small nits:

- HUGETLB memfd shouldn't exhibit the SHM_GROW_ON_WRITE behavior. We can
  only grow largepage shm by appropriately aligned (i.e. requested pagesize)
  sizes, so it can't work in the typical/sane fashion. Furthermore, Linux
  does the same, so let's be compatible.

- We don't allow MFD_HUGETLB without specifying a pagesize, so no need to
  check for that later.

Reviewed by: kib (slightly earlier version)

3 years agoDon't clear reserved bits per RealTek
jmg [Fri, 11 Sep 2020 02:02:13 +0000 (02:02 +0000)]
Don't clear reserved bits per RealTek

MFC after: 3 days

3 years agoDisable WITNESS for spin locks by default.
jhb [Fri, 11 Sep 2020 00:06:16 +0000 (00:06 +0000)]
Disable WITNESS for spin locks by default.

This matches all other architectures and removes substantial overhead.

Reported by: arichardson (indirectly)
Reviewed by: imp, arichardson
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26403

3 years agoice(4): Update to 0.26.16
erj [Thu, 10 Sep 2020 23:46:13 +0000 (23:46 +0000)]
ice(4): Update to 0.26.16

Summary of changes:

- Assorted bug fixes
- Support for newer versions of the device firmware
- Suspend/resume support
- Support for Lenient Link Mode for E82X devices (e.g. can try to link with
  SFP/QSFP modules with bad EEPROMs)
- Adds port-level rx_discards sysctl, similar to ixl(4)'s

This version of the driver is intended to be used with DDP package 1.3.16.0,
which has already been updated in a previous commit.

Tested by: Jeffrey Pieper <jeffrey.e.pieper@intel.com>
MFC after: 3 days
MFC with: r365332, r365550
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D26322

3 years agoUse vmcb_read/write for the vmcb snapshot functions.
jhb [Thu, 10 Sep 2020 22:22:23 +0000 (22:22 +0000)]
Use vmcb_read/write for the vmcb snapshot functions.

This avoids some unnecessary layers of indirection.

3 years agomemfd_create: fix return values
kevans [Thu, 10 Sep 2020 21:25:16 +0000 (21:25 +0000)]
memfd_create: fix return values

Literally returning EINVAL from a function designed to return an fd makes
for interesting scenarios.

I cannot assign enough pointy hats to cover this one.

3 years agoFix interaction between largepages and seals/writes.
kib [Thu, 10 Sep 2020 20:54:44 +0000 (20:54 +0000)]
Fix interaction between largepages and seals/writes.

On write with SHM_GROW_ON_WRITE, use proper truncate.
Do not allow to grow largepage shm if F_SEAL_GROW is set. Note that
shrinks are not supported at all due to unmanaged mappings.
Call to vm_pager_update_writecount() is only valid for swap objects,
skip it for unmanaged largepages.
Largepages cannot support write sealing.
Do not writecnt largepage mappings.

Reported by: kevans
Reviewed by: kevans, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26394

3 years agoAdd basic test for net.fibs dynamic growth.
melifaro [Thu, 10 Sep 2020 19:25:51 +0000 (19:25 +0000)]
Add basic test for net.fibs dynamic growth.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D26382

3 years ago[PowerPC64LE] Add LOAD_LR_NIA and RETURN_TO_NATIVE_ENDIAN defines.
bdragon [Thu, 10 Sep 2020 18:41:15 +0000 (18:41 +0000)]
[PowerPC64LE] Add LOAD_LR_NIA and RETURN_TO_NATIVE_ENDIAN defines.

* Add LOAD_LR_NIA define. This is preferred to "bl 1f; 1:" because it
doesn't pollute the branch predictor.

* Add magic sequence to return the CPU to the correct endianness after
jumping to cross-endian code, similar to the sequence from Linux.

Sponsored by: Tag1 Consulting, Inc.

3 years agourndis(4): Add support of Inseego/Novatel Wireless MiFi 8800/8000
lwhsu [Thu, 10 Sep 2020 18:27:52 +0000 (18:27 +0000)]
urndis(4): Add support of Inseego/Novatel Wireless MiFi 8800/8000

PR: 245152
Submitted by: rootless@gmail.com
Reviewed by: hselasky
MFC after: 3 days

3 years agocrunchgen(8): fix crunched application build with WARNS=6
kevans [Thu, 10 Sep 2020 18:19:45 +0000 (18:19 +0000)]
crunchgen(8): fix crunched application build with WARNS=6

This was revealed by the rescue build with a patch I'm working on to default
WARNS=6 everywhere. The issues resolved were:

- Missing prototype for _crunched_${ident}_stub in the *_stub.c generated
  bits
- Missing prototype for crunched_main
- Incomplete prototype for _crunched_${ident}_stub in the generated parts of
  crunched_main
- Literal strings in the stub table must drop const qualifier, unless we
  const'ify name
- f field in struct stub didn't have a proper prototype

Most of these issues are minor formalities and easily addressed.

I note that if my patch to eventually raise WARNS for the rescue build
lands, we'll need to bump the __FreeBSD_version requirement for
bootstrapping crunchgen and wipe out the rescue .OBJDIR if it's stale, which
we should be able to detect pretty easily from a couple of the issues that
have been fixed here.

Reviewed by: arichardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26363

3 years agoFix the build after r365592
kevans [Thu, 10 Sep 2020 17:58:24 +0000 (17:58 +0000)]
Fix the build after r365592

r365592 accidentally mixed atf-c and atf-sh; convert atf_skip -> atf_tc_skip

3 years agolibrt: tests: fix minor issues with higher WARNS
kevans [Thu, 10 Sep 2020 17:53:00 +0000 (17:53 +0000)]
librt: tests: fix minor issues with higher WARNS

got_sigalrm is a global with external linkage and must therefore have a
previous extern declaration. There's no reason to maintain the status quo
there, so just make it static.

The result var is unused.

This part of the test has not been upstreamed, presumably because it exists
solely for sem_clockwait_np. We should perhaps consider moving it into its
own test file outside of ^/contrib/netbsd-tests, but this can happen later.

MFC after: 1 week

3 years agoMFV r365599: import fix for a libexecinfo warning at higher WARNS
kevans [Thu, 10 Sep 2020 17:48:27 +0000 (17:48 +0000)]
MFV r365599: import fix for a libexecinfo warning at higher WARNS

v1.17 of this file included a fix that I just submitted upstream to fix a
warning about prevent_inline with external linkage not having been
previously declared.

MFC after: 1 week

3 years agoFix memfd_create tests after r365524
kevans [Thu, 10 Sep 2020 17:23:30 +0000 (17:23 +0000)]
Fix memfd_create tests after r365524

r365524 did accidentally invert this check that sets SHM_LARGEPAGE, leading
non-hugetlb memfd as unconfigured largepage shm and thus test failures when
we try to ftruncate or write to them.

PR: 249236
Discussed with: kib

3 years agoTemporarily skip failing sys.kern.memfd_test.* tests in CI
lwhsu [Thu, 10 Sep 2020 17:15:44 +0000 (17:15 +0000)]
Temporarily skip failing sys.kern.memfd_test.* tests in CI

PR: 249236
Sponsored by: The FreeBSD Foundation

3 years agoFollow-up r364753 by only using arm's stdatomic.c implementation, as it
dim [Thu, 10 Sep 2020 16:47:12 +0000 (16:47 +0000)]
Follow-up r364753 by only using arm's stdatomic.c implementation, as it
already covers the functions in compiler-rt's atomic.c, leading to
conflicts when linking.

PR: 230888
MFC after: 3 days
X-MFC-With: r364753

3 years agoEnsure that the makewhatis symlink is added in the bootstrap-tools stage
arichardson [Thu, 10 Sep 2020 15:37:29 +0000 (15:37 +0000)]
Ensure that the makewhatis symlink is added in the bootstrap-tools stage

We currently set MK_MAN=no in $BSARGS so MK_MAN_UTILS will also be false
which means that the makewhatis symlink will not be created.
This change fixes the build when using both -DBUILD_WITH_STRICT_TMPPATH and
-DBOOTSTRAP_ALL_TOOLS.

Tested by: andrew
Differential Revision: https://reviews.freebsd.org/D16761

3 years agoSilence GCC's -Wno-unused-result during bootstrap
arichardson [Thu, 10 Sep 2020 15:37:24 +0000 (15:37 +0000)]
Silence GCC's -Wno-unused-result during bootstrap

Unlike clang, GCC still warns even with (void) casts (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425)

3 years agoFix -Wpointer-sign warnings in bwstring.c
arichardson [Thu, 10 Sep 2020 15:37:19 +0000 (15:37 +0000)]
Fix -Wpointer-sign warnings in bwstring.c

3 years agoFix a noisy -Wundef warning when bootstrapping tools
arichardson [Thu, 10 Sep 2020 15:37:15 +0000 (15:37 +0000)]
Fix a noisy -Wundef warning when bootstrapping tools

3 years agoRemove -I flag for include path that doesn't exist
arichardson [Thu, 10 Sep 2020 15:37:07 +0000 (15:37 +0000)]
Remove -I flag for include path that doesn't exist

Found this while trying to get macOS bootstrap to work again after OpenZFS merge.

Reviewed By: #zfs, freqlabs
Differential Revision: https://reviews.freebsd.org/D26192

3 years agoMove the pl061 acpi attachment earlier
andrew [Thu, 10 Sep 2020 14:58:46 +0000 (14:58 +0000)]
Move the pl061 acpi attachment earlier

As the pl061 driver can be an interrupt controller attach it earlier in the
boot so other drivers can use it.

Use a new GPIO xref to not conflict with the existing root interrupt
controller.

Sponsored by: Innovate UK

3 years agoIgnore the .interp section in the arm64 EFI loader
andrew [Thu, 10 Sep 2020 14:13:49 +0000 (14:13 +0000)]
Ignore the .interp section in the arm64 EFI loader

When building the loader an unneeded .interp section may be added. Move
this to the unused section region so offsets of used sections don't
change.

Obtained from: CheriBSD
Sponsored by: Innovate UK

3 years agoMove the rid variable to the generic iommu context.
br [Thu, 10 Sep 2020 14:12:25 +0000 (14:12 +0000)]
Move the rid variable to the generic iommu context.
It could be used in various IOMMU platforms, not only DMAR.

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

3 years agoSet AlignTrailingComments in the clang-format config
arichardson [Thu, 10 Sep 2020 14:11:29 +0000 (14:11 +0000)]
Set AlignTrailingComments in the clang-format config

This seems to be fairly common in existing code and often looks better when
adding trailing comments to e.g. enumerators or array initializers.
See D26340 for more context.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D26391

3 years agoUse the correct config names for some .clang-format entries
arichardson [Thu, 10 Sep 2020 14:11:24 +0000 (14:11 +0000)]
Use the correct config names for some .clang-format entries

Those values are enum entries and should use "Never" instead of "false".
clang-format currently accepts false, but it's better to use the correct
syntax in case that changes in the future.

3 years agoAdd author entity for rhurlin, part 2
rhurlin [Thu, 10 Sep 2020 13:57:57 +0000 (13:57 +0000)]
Add author entity for rhurlin, part 2

Forgot to submit step 5 from procedure 1 in Chap. 6 of the Committers Guide:
Update Mentor and Mentee Information

Reviewed by: arrowd (mentor), tcberner (mentor)
Approved by: arrowd (mentor), tcberner (mentor)

3 years agoSwitch the name of the pl061 driver to gpio
andrew [Thu, 10 Sep 2020 09:50:43 +0000 (09:50 +0000)]
Switch the name of the pl061 driver to gpio

We need it to be named gpio for gpiobus to work.

Sponsored by: Innovate UK

3 years agoOnly manage ofw gpio providers on ofw systems
andrew [Thu, 10 Sep 2020 09:42:37 +0000 (09:42 +0000)]
Only manage ofw gpio providers on ofw systems

On arm64 we may boot via ACPI. In this case we will still try to manage the
gpio providers as if we are using FDT. Fix this by checking if the FDT node
is valid before registering a cross reference.

Sponsored by: Innovate UK

3 years agoUse the correct variable to check which interrupt mode to use
andrew [Thu, 10 Sep 2020 09:37:30 +0000 (09:37 +0000)]
Use the correct variable to check which interrupt mode to use

In the PL061 driver we incorrectly used the mask rather than mode to find
how to configure the interrupt.

Sponsored by: Innovate UK

3 years agoFix RADIX_MPATH build broken by r365521.
melifaro [Thu, 10 Sep 2020 07:05:31 +0000 (07:05 +0000)]
Fix RADIX_MPATH build broken by r365521.

Reported by: jenkins, Hartmann, O. <ohartmann at walstatt.org>

3 years agoRemove vm_map_create(9) KPI's manpage according to r364302
lwhsu [Thu, 10 Sep 2020 06:32:25 +0000 (06:32 +0000)]
Remove vm_map_create(9) KPI's manpage according to r364302

Submitted by: Ka Ho Ng <khng300@gmail.com>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26372

3 years agoice_ddp: Fix 1.3.16.0 package
erj [Thu, 10 Sep 2020 04:00:13 +0000 (04:00 +0000)]
ice_ddp: Fix 1.3.16.0 package

The version uploaded in the previous commit was far too small. This one
should be the right size.

MFC after: 1 day
Sponsored by: Intel Corporation

3 years agocp: use copy_file_range(2)
asomers [Thu, 10 Sep 2020 02:48:55 +0000 (02:48 +0000)]
cp: use copy_file_range(2)

This has three advantages over write(2)/read(2):

* Fewer context switches and data copies
* Mostly preserves a file's sparseness
* On some file systems (currently NFS 4.2) the file system will perform the
  copy in an especially efficient way.

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

3 years ago[PowerPC] Fix setting of time in OPAL
bdragon [Thu, 10 Sep 2020 01:49:53 +0000 (01:49 +0000)]
[PowerPC] Fix setting of time in OPAL

There were multiple bugs in the OPAL RTC code which had never been
discovered, as the default configuration of OPAL machines is to
have the BMC / FSP control the RTC.

* Fix calling convention for setting the time -- the variables are passed
directly in CPU registers, not via memory.

* Fix bug in the bcd encoding routines. (from jhibbits)

Tested on POWER9 Talos II (BE) and POWER9 Blackbird (LE).

Reviewed by: jhibbits (in irc)
Sponsored by: Tag1 Consulting, Inc.

3 years agoAdd -z "TOS" option to ping6, to test DSCP/ECN values
rscheff [Thu, 10 Sep 2020 00:50:18 +0000 (00:50 +0000)]
Add -z "TOS" option to ping6, to test DSCP/ECN values

ping has the option to add the (deprecated) TOS byte
using the -z option. Adding the same option, with the
same (deprecated) Traffic Class Byte (nowadays actually
DSCP and ECN fields) to ping6 to validate proper QoS
processing in network switches.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26384

3 years agocc_mod: remove unused CCF_DELACK definition
rscheff [Thu, 10 Sep 2020 00:46:38 +0000 (00:46 +0000)]
cc_mod: remove unused CCF_DELACK definition

During the DCTCP improvements, use of CCF_DELACK was
removed. This change is just to rename the unused flag
bit to prevent use of it, without also re-implementing
the tcp_input and tcp_output interfaces.

No functional change.

Reviewed by: chengc_netapp.com, tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26181

3 years agoAdd posixshmcontrol(1) support for largepage shm objects.
kib [Wed, 9 Sep 2020 22:22:02 +0000 (22:22 +0000)]
Add posixshmcontrol(1) support for largepage shm objects.

Create op with -l <largepage> option can create it, stat displays
configured page size.

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

3 years agoAdd shm_create_largepage(3) helper for creation and configuration of
kib [Wed, 9 Sep 2020 22:20:36 +0000 (22:20 +0000)]
Add shm_create_largepage(3) helper for creation and configuration of
largepage shm objects.

And since we can, add memfd_create(MFD_HUGETLB) support, hopefully
close enough to the Linux feature.

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

3 years agoFix compilation of libsysdecode after r365522, should have been part of it.
kib [Wed, 9 Sep 2020 22:18:44 +0000 (22:18 +0000)]
Fix compilation of libsysdecode after r365522, should have been part of it.

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

3 years agoSupport for userspace non-transparent superpages (largepages).
kib [Wed, 9 Sep 2020 22:12:51 +0000 (22:12 +0000)]
Support for userspace non-transparent superpages (largepages).

Created with shm_open2(SHM_LARGEPAGE) and then configured with
FIOSSHMLPGCNF ioctl, largepages posix shared memory objects guarantee
that all userspace mappings of it are served by superpage non-managed
mappings.

Only amd64 for now, both 2M and 1G superpages can be requested, the
later requires CPU feature.

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

3 years agoUpdate nexthop handling for route addition/deletion in preparation for mpath.
melifaro [Wed, 9 Sep 2020 22:07:54 +0000 (22:07 +0000)]
Update nexthop handling for route addition/deletion in preparation for mpath.

Currently kernel requests deletion for the certain routes with specified gateway,
 but this gateway is not actually checked. With multipath routes, internal gateway
 checking becomes mandatory. Add the logic performing this check.

Generalise RTF_PINNED routes to the generic route priorities, simplifying the logic.

Add lookup_prefix() function to perform exact match search based on data in @info.

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

3 years agovm_map: Add a map entry kind that can only be clipped at specific boundary.
kib [Wed, 9 Sep 2020 22:02:30 +0000 (22:02 +0000)]
vm_map: Add a map entry kind that can only be clipped at specific boundary.

The entries and their clip boundaries must be aligned on supported
superpages sizes from pagesizes[].  vm_map operations return Mach
error KERN_INVALID_ARGUMENT, which is usually translated to EINVAL, if
it would require clip not at the boundary.

In other words, entries force preserving virtual addresses superpage
properties.

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

3 years agoAdd pmap_enter(9) PMAP_ENTER_LARGEPAGE flag and implement it on amd64.
kib [Wed, 9 Sep 2020 21:50:24 +0000 (21:50 +0000)]
Add pmap_enter(9) PMAP_ENTER_LARGEPAGE flag and implement it on amd64.

The flag requests entry of non-managed superpage mapping of size
pagesizes[psind] into the page table.

Pmap supports fake wiring of the largepage mappings.  Only attributes
of the largepage mapping can be changed by calling pmap_enter(9) over
existing mapping, physical address of the page must be unchanged.

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

3 years agoRetain marking net.fibs sysctl as a tunable.
melifaro [Wed, 9 Sep 2020 21:45:18 +0000 (21:45 +0000)]
Retain marking net.fibs sysctl as a tunable.

Suggested by: avg

3 years agoAdd vm_map_find_aligned(9).
kib [Wed, 9 Sep 2020 21:44:59 +0000 (21:44 +0000)]
Add vm_map_find_aligned(9).

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

3 years agoMove MAP_32BIT_MAX_ADDR definition to sys/mman.h.
kib [Wed, 9 Sep 2020 21:39:06 +0000 (21:39 +0000)]
Move MAP_32BIT_MAX_ADDR definition to sys/mman.h.

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

3 years agoFix assert.
kib [Wed, 9 Sep 2020 21:35:44 +0000 (21:35 +0000)]
Fix assert.

Noted by: alc
MFC after: 1 week

3 years agoPrepare to handle non-trivial errors from vm_map_delete().
kib [Wed, 9 Sep 2020 21:34:31 +0000 (21:34 +0000)]
Prepare to handle non-trivial errors from vm_map_delete().

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

3 years agoamd64 pmap: teach functions walking user page tables about PG_PS bit in PDPE.
kib [Wed, 9 Sep 2020 21:08:45 +0000 (21:08 +0000)]
amd64 pmap: teach functions walking user page tables about PG_PS bit in PDPE.

Only unmanaged 1G superpages are handled.

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

3 years agoamd64: report support for 1G superpages in getpagesizes(2).
kib [Wed, 9 Sep 2020 21:01:36 +0000 (21:01 +0000)]
amd64: report support for 1G superpages in getpagesizes(2).

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

3 years agouipc_shm.c: Move comment where it belongs.
kib [Wed, 9 Sep 2020 21:00:11 +0000 (21:00 +0000)]
uipc_shm.c: Move comment where it belongs.

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

3 years agoFollow-up r364753 by enabling compiler-rt's atomic implementation only
dim [Wed, 9 Sep 2020 20:48:57 +0000 (20:48 +0000)]
Follow-up r364753 by enabling compiler-rt's atomic implementation only
for clang, as it uses clang specific builtins, and does not compile
correctly with gcc. Note that gcc packages usually come with their own
libatomic, providing these primitives.

PR: 230888
MFC after: 3 days
X-MFC-With: r364753

3 years agoperiodic.conf(5): don't truncate interface names reported by 420.status-network.
rew [Wed, 9 Sep 2020 19:07:34 +0000 (19:07 +0000)]
periodic.conf(5): don't truncate interface names reported by 420.status-network.

The daily periodic script, 420.status-network uses netstat(1) to report
interface status. By default, netstat(1) truncates interface names.

Add the '-W' flag (avoid truncating interface names) as the default for
'daily_status_network_netstat_flags' in periodic.conf(5).

The default 420.status-network command is now 'netstat -i -d -W -n'.

PR:     163572
Reported by: kes-kes@yandex.ru
Reviewed by: allanjude (mentor) bcr (manpages)
Approved by: allanjude (mentor)
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D26023

3 years agoMerge commit e6bb4c8e7 from llvm git (by Craig Topper):
dim [Wed, 9 Sep 2020 18:11:04 +0000 (18:11 +0000)]
Merge commit e6bb4c8e7 from llvm git (by Craig Topper):

  [X86] SSE4_A should only imply SSE3 not SSSE3 in the frontend.

  SSE4_1 and SSE4_2 due imply SSSE3. So I guess I got confused when
  switching the code to being table based in D83273.

  Fixes PR47464

This should fix builds with -march=amdfam10 emitting SSSE3 instructions
such as pshufb, which lead to programs crashing with SIGILL on such
processors.

Reported by: avg
MFC after: 6 weeks
X-MFC-With: r364284

3 years agogetlogin_r: fix the type of len
kevans [Wed, 9 Sep 2020 18:07:13 +0000 (18:07 +0000)]
getlogin_r: fix the type of len

getlogin_r is specified by POSIX to to take a size_t len, not int. Fix our
version to do the same, bump the symbol version due to ABI change and
provide compat.

This was reported to break compilation of Ruby 2.8.

Some discussion about the necessity of the ABI compat did take place in the
review. While many 64-bit platforms would likely be passing it in a 64-bit
register and zero-extended and thus, not notice ABI breakage, some do
sign-extend (e.g. mips).

PR: 247102
Submitted by: Bertram Scharpf <software@bertram-scharpf.de> (original)
Submitted by: cem (ABI compat)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26335

3 years agostand/efihttp: Work around a bug in edk2 http instance reconfiguration
scottph [Wed, 9 Sep 2020 16:35:51 +0000 (16:35 +0000)]
stand/efihttp: Work around a bug in edk2 http instance reconfiguration

A bug in the EFI HTTP driver of TianoCore EDK2 causes memory
corruption when an http instance that uses tls is reconfigured,
leading to a crash.

Work around this by forcing a new http instance for each request
instead of reconfiguring the existing one.

The upstream bug report is https://bugzilla.tianocore.org/show_bug.cgi?id=1917

Submitted by: bcran
Reviewed By: imp, kevans, tsoome
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21281

3 years agoIn r354148 the goal was to check THREAD_CAN_SLEEP() only once for the
glebius [Wed, 9 Sep 2020 16:13:33 +0000 (16:13 +0000)]
In r354148 the goal was to check THREAD_CAN_SLEEP() only once for the
purpose of epoch_trace() and for calling subsequent panic, but to keep
code fully under INVARIANTS, so don't use bare function call to panic().
However, at the last stage of review a true value slipped in, while
always false was assumed.  I checked that in email archive with kib@.

Noticed by: trasz

3 years agoggate: Fix ggated/ggatec debug print of offsets.
markj [Wed, 9 Sep 2020 12:58:19 +0000 (12:58 +0000)]
ggate: Fix ggated/ggatec debug print of offsets.

The request offset and length are always unsigned, so print them as
such.

Submitted by: Yoshihiro Ota <ota@j.email.ne.jp>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21388

3 years agoSo it turns out that syzkaller hit another crash. It has to do with switching
rrs [Wed, 9 Sep 2020 11:11:50 +0000 (11:11 +0000)]
So it turns out that syzkaller hit another crash. It has to do with switching
stacks with a SENT_FIN outstanding. Both rack and bbr will only send a
FIN if all data is ack'd so this must be enforced. Also if the previous stack
sent the FIN we need to make sure in rack that when we manufacture the
"unknown" sends that we include the proper HAS_FIN bits.

Note for BBR we take a simpler approach and just refuse to switch.

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D26269

3 years agocertctl: fix hashed link generation with duplicate subjects
kevans [Wed, 9 Sep 2020 09:08:09 +0000 (09:08 +0000)]
certctl: fix hashed link generation with duplicate subjects

Currently, certctl rehash will just keep clobbering .0 rather than
incrementing the suffix upon encountering a duplicate. Do this, and do it
for blacklisted certs as well.

This also improves the situation with the blacklist to be a little less
flakey, comparing cert fingerprints for all certs with a matching subject
hash in the blacklist to determine if the cert we're looking at can be
installed.

Future work needs to completely revamp the blacklist to align more with how
it's described in PR 246614. In particular, /etc/ssl/blacklisted should go
away to avoid potential confusion -- OpenSSL will not read it, it's
basically certctl internal.

PR: 246614
Reviewed by: Michael Osipov <michael.osipov siemens com>
Tested by: Michael Osipov
With suggestions from: Michael Osipov
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26167

3 years agoUpdate nvi to 2.2.0
bapt [Wed, 9 Sep 2020 08:38:47 +0000 (08:38 +0000)]
Update nvi to 2.2.0

Main changes:
* Vim-style expandtab option
* Provides Turkish translation
* Backspace now deletes \ rather than being escaped
* T during motion commands is now VI-compatible
* Encoding related fixes, such as UTF-8 detection
* Fixed a number of memory management issues

MFC after: 3 weeks

3 years agoImport missing files from the nvi 2.2.0 previous half done import
bapt [Wed, 9 Sep 2020 08:18:04 +0000 (08:18 +0000)]
Import missing files from the nvi 2.2.0 previous half done import

3 years agoImport nvi 2.2.0
bapt [Wed, 9 Sep 2020 07:57:59 +0000 (07:57 +0000)]
Import nvi 2.2.0

3 years agolibc tests: dynthr_mod: fix some WARNS issues
kevans [Wed, 9 Sep 2020 02:45:47 +0000 (02:45 +0000)]
libc tests: dynthr_mod: fix some WARNS issues

This is being addressed as part of a side-patch I'm working on that builds
all the things with WARNS=6, instead of relying on it being supplied in just
shallow parts of the build with higher-level Makefile.inc.

Provide a prototype for mod_main and annotate the thread function argument
as unused.

MFC after: 1 week

3 years agolibc/resolv: attempt to fix the test under WARNS=6
kevans [Wed, 9 Sep 2020 02:42:21 +0000 (02:42 +0000)]
libc/resolv: attempt to fix the test under WARNS=6

In a side-change that I'm working on to start defaulting src builds to
WARNS=6 where WARNS isn't otherwise specified, GCC6 (and clang, to a lesser
extent) pointed out a number of issues with the resolv tests:

- Global method variable that gets shadowed in run_tests()
- Signed/unsigned comparison between i in run_tests() and hosts->sl_cur

The shadowed variable looks like it might actually be bogus as written, as
we pass it to RUN_TESTS -> run_tests, but other parts use the global method
instead. This change is mainly geared towards correcting that by removing
the global and plumbing the method through from run_tests -> run into the
new thread.

For the signed/unsigned comparison, there's no compelling reason to not just
switch i/nthreads/nhosts to size_t.

The review also included a change to the load() function that was better
addressed by jhb in r365302.

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

3 years agosrc.conf(5): regen after r365491
kevans [Wed, 9 Sep 2020 00:41:31 +0000 (00:41 +0000)]
src.conf(5): regen after r365491

3 years agoopts: FREEBSD_UPDATE no longer relies on PORTSNAP
kevans [Wed, 9 Sep 2020 00:40:54 +0000 (00:40 +0000)]
opts: FREEBSD_UPDATE no longer relies on PORTSNAP

phttpget is no longer tied to the portsnap build as of r365490.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26255

3 years agophttpget: move out of portsnap
kevans [Wed, 9 Sep 2020 00:39:47 +0000 (00:39 +0000)]
phttpget: move out of portsnap

Currently, WITHOUT_PORTSNAP forces WITHOUT_FREEBSD_UPDATE because the
latter relies on phttpget, which lives inside the portsnap build bits.

Remove the dependency between these two options by moving phttpget out into
^/libexec and building/installing it if either WITH_PORTSNAP or
WITH_FREEBSD_UPDATE.

Future work could remove the conditional if it's decided that users will use
it independently of either the current in-base consumers.

Reported by: swills
Reviewed by: jilles, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26255

3 years ago[PowerPC64LE] PPC64LE support for libelf.
bdragon [Wed, 9 Sep 2020 00:06:35 +0000 (00:06 +0000)]
[PowerPC64LE] PPC64LE support for libelf.

Fix native detection when building on powerpc64le.

I will be submitting this and r361104 upstream shortly.

Sponsored by: Tag1 Consulting, Inc.

3 years agoAllow consumer to customize physical pager.
kib [Wed, 9 Sep 2020 00:00:43 +0000 (00:00 +0000)]
Allow consumer to customize physical pager.

Add support for user-supplied callbacks into phys pager operations,
providing custom getpages(), haspage(), and populate() methods
implementations.  Pager stores user data ptr/val in the object to
provide context.

Add phys_pager_allocate() helper that takes user ops table as one of
the arguments.

Current code for these methods is moved to the 'default' ops table,
assigned automatically when vm_pager_alloc() is used.

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

3 years ago[PowerPC64] Fix xive order calculation in qemu TCG
bdragon [Tue, 8 Sep 2020 23:48:49 +0000 (23:48 +0000)]
[PowerPC64] Fix xive order calculation in qemu TCG

When emulating a single thread system for testing reasons, mp_maxid can
be 0. This trips up our math for calculating the order.

Account for this to fix xive attachment when emulating a single-thread
core on qemu powernv (a configuration that doesn't exist in the real world.)

Sponsored by: Tag1 Consulting, Inc.

3 years agoAdd kern_mmap_racct_check(), a helper to verify limits in vm_mmap*().
kib [Tue, 8 Sep 2020 23:48:19 +0000 (23:48 +0000)]
Add kern_mmap_racct_check(), a helper to verify limits in vm_mmap*().

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

3 years agoConvert allocations of the phys pager to vm_pager_allocate().
kib [Tue, 8 Sep 2020 23:38:49 +0000 (23:38 +0000)]
Convert allocations of the phys pager to vm_pager_allocate().

Future changes would require additional initialization of OBJT_PHYS
objects, and vm_object_allocate() is not suitable for it.

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

3 years agoAdd interruptible variant of vm_wait(9), vm_wait_intr(9).
kib [Tue, 8 Sep 2020 23:28:09 +0000 (23:28 +0000)]
Add interruptible variant of vm_wait(9), vm_wait_intr(9).

Also add msleep flags argument to vm_wait_doms(9).

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

3 years agoFix 64-bit build of libofw.
bdragon [Tue, 8 Sep 2020 23:22:11 +0000 (23:22 +0000)]
Fix 64-bit build of libofw.

Adjust a couple of printf() lines that deal with dumping out addresses
to cast to uintmax_t.

This allows building a 64-bit libofw for use in things like a future
Petitboot loader for PowerPC64, and other FDT platforms that require
a 64-bit loader binary and want to use forth.

Sponsored by: Tag1 Consulting, Inc.

3 years ago[PowerPC64] Hide dssall instruction from llvm assembler
bdragon [Tue, 8 Sep 2020 22:59:43 +0000 (22:59 +0000)]
[PowerPC64] Hide dssall instruction from llvm assembler

When doing a build for a modern CPUTYPE, llvm will throw errors if obsolete
instructions are used, even if they will never run due to runtime checks.

Hiding the dssall instruction from the assembler fixes kernel build when
overriding CPUTYPE, without having any effect on the generated binary.

This has been in my local tree for over a year and is well tested across
a variety of machines.

Sponsored by: Tag1 Consulting, Inc.

3 years ago[PowerPC] Add root_pic assertion.
bdragon [Tue, 8 Sep 2020 22:42:41 +0000 (22:42 +0000)]
[PowerPC] Add root_pic assertion.

When enabling an interrupt, assert that we do in fact have a root PIC.

This would have saved me some debugging effort.

Sponsored by: Tag1 Consulting, Inc.

3 years agoDon't return errors from the cryptodev_process() method.
jhb [Tue, 8 Sep 2020 22:41:35 +0000 (22:41 +0000)]
Don't return errors from the cryptodev_process() method.

The cryptodev_process() method should either return 0 if it has
completed a request, or ERESTART to defer the request until later.  If
a request encounters an error, the error should be reported via
crp_etype before completing the request via crypto_done().

Fix a few more drivers noticed by asomers@ similar to the fix in
r365389.  This is an old bug, but went unnoticed since crypto requests
did not start failing as a normal part of operation until digest
verification was introduced which can fail requests with EBADMSG.

PR: 247986
Reported by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D26361

3 years agogeom_part: extend kern.geom.part.check_integrity to work on GPT
eugen [Tue, 8 Sep 2020 22:23:53 +0000 (22:23 +0000)]
geom_part: extend kern.geom.part.check_integrity to work on GPT

There are multiple USB/SATA bridges on the market that unconditionally
cut some LBAs off connected media. This could be a problem
for pre-partitioned drives so GEOM complains and does not create
devices in /dev for slices/partitions preventing access to existing data.

We have kern.geom.part.check_integrity that allows us to correct
partitioning if changed from default 1 to 0 but it works for MBR only.
If backup copy of GPT is unavailable due to decreases number of LBAs,
kernel still does not give access to partitions and prints to dmesg:

GEOM: md0: corrupt or invalid GPT detected.
GEOM: md0: GPT rejected -- may not be recoverable.

This change makes it work for GPT too, so it created partitions in /dev
and prints to dmesg this instead:

GEOM: md0: the secondary GPT table is corrupt or invalid.
GEOM: md0: using the primary only -- recovery suggested.

Then "gpart recover" re-created backup copy of GPT
and allows further manipulations with partitions.

This change is no-op for default configuration having
kern.geom.part.check_integrity=1

Reported by: Alex Korchmar
MFC after: 3 days.

3 years agoFix panic with net.fibs tunable set in loader.conf.
melifaro [Tue, 8 Sep 2020 21:39:34 +0000 (21:39 +0000)]
Fix panic with net.fibs tunable set in loader.conf.

Fix by removing forgotten CTLFLAG_RWTUN flag from the sysctl,
 loader variable will be read later in vnet_rtables_init().

Reported by: mav

3 years agoZFS: remove some extra defines
mmacy [Tue, 8 Sep 2020 17:47:30 +0000 (17:47 +0000)]
ZFS: remove some extra defines

When merging a number of defines that are needed in the standalone
build made it in to the module makefile.

Reported by: markj@

3 years agofd: fix fhold on an uninitialized var in fdcopy_remapped
mjg [Tue, 8 Sep 2020 16:07:47 +0000 (16:07 +0000)]
fd: fix fhold on an uninitialized var in fdcopy_remapped

Reported by: gcc9

3 years agocache: drop write-only tvp_seqc vars
mjg [Tue, 8 Sep 2020 16:06:46 +0000 (16:06 +0000)]
cache: drop write-only tvp_seqc vars

3 years agovfs: drop a write-only var in vfs_periodic_msync_inactive
mjg [Tue, 8 Sep 2020 16:06:26 +0000 (16:06 +0000)]
vfs: drop a write-only var in vfs_periodic_msync_inactive

3 years agoarm64: check for CRC32 support via HWCAP
mhorne [Tue, 8 Sep 2020 15:39:19 +0000 (15:39 +0000)]
arm64: check for CRC32 support via HWCAP

Doing it this way eliminates the assumption about homogeneous support
for the feature, since HWCAP values are only set if support is present
on all CPUs.

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

3 years agoarm64: export new HWCAP features
mhorne [Tue, 8 Sep 2020 15:36:38 +0000 (15:36 +0000)]
arm64: export new HWCAP features

Expose some of the new HWCAP features added in r65304. This includes the
addition of elf_hwcap2 into the sysvec, and a separate function to parse
for those features.

This only exposes features which require no further configuration, e.g.
indicating the presence of certain instructions. Larger features (SVE)
will not be advertised until we actually support them. The exact list of
features/extensions this patch exposes is:
  - ARMv8.0-DGH
  - ARMv8.0-SB
  - ARMv8.2-BF16
  - ARMv8.2-DCCVADP
  - ARMv8.2-I8MM
  - ARMv8.4-LRCPC
  - ARMv8.5-CondM
  - ARMv8.5-FRINT
  - ARMv8.5-RNG
  - PSTATE.SSBS

While here, annotate elf_hwcap and elf_hwcap2 as __read_frequently, and
move the declarations to the machine/md_var.h header.

Submitted by: mikael@ (D22314 portion)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26031
Differential Revision: https://reviews.freebsd.org/D22314