]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r348005:
Leandro Lupori [Wed, 5 Jun 2019 12:34:28 +0000 (12:34 +0000)]
MFC r348005:
[PowerPC64] stand: fix build using clang 8 as compiler

This change fixes "stand" build issues when using clang 8
as compiler.

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20026

4 years agoMFC r348117: Allocate buffers smaller then ABD chunk size as linear.
Alexander Motin [Wed, 5 Jun 2019 00:51:51 +0000 (00:51 +0000)]
MFC r348117: Allocate buffers smaller then ABD chunk size as linear.

This allows to reduce memory waste by letting UMA to put multiple small
buffers into one memory page slab.  The page sharing means that UMA
may not be able to free memory page when some of buffers are freed, but
alternatively memory used by that buffer would just be wasted from the
beginning.

This change follows alike change in ZoL, but unlike Linux (according to
my understanding of it from comments) FreeBSD never shares slabs bigger
then one memory page, so this should be even less invasive then there.

4 years agoMFC r346570, r348440
Navdeep Parhar [Tue, 4 Jun 2019 21:06:34 +0000 (21:06 +0000)]
MFC r346570, r348440

r346570:
cxgbe/t4_tom: Add a "TCB history" feature that samples hardware state
for a tid and maintains a running history of some interesting events.

Service TCP_INFO queries from the history when the tid is being tracked
there.

r348440:
cxgbe/t4_tom: Do not attempt to look up entries in the TCB history if
it hasn't been initialized.

This fixes a bug in r346570 that could cause a panic when servicing
TCP_INFO for offloaded connections.

Sponsored by: Chelsio Communications

4 years agoMFC r348491:
Navdeep Parhar [Tue, 4 Jun 2019 20:37:00 +0000 (20:37 +0000)]
MFC r348491:

cxgbe/t4_tom: adjust the hardware receive window to match changes to the
receive sockbuf's high water mark.

Calculate rx credits on the spot instead of tracking sbused/sb_cc and
rx_credits in the toepcb.  The previous method worked when the high
water mark changed due to SB_AUTOSIZE but not when it was adjusted
directly (for example, by the soreserve in nfsrvd_addsock).

This fixes a connection hang while running iozone over an NFS mounted
share where nfsd's TCP sockets are being handled by t4_tom.

Sponsored by: Chelsio Communications

4 years agoMFC r348059: vt efifb: add suspend/resume calls
Ed Maste [Tue, 4 Jun 2019 18:11:12 +0000 (18:11 +0000)]
MFC r348059: vt efifb: add suspend/resume calls

Using the latest NVIDIA driver, upon resuming from suspend with X
running the display remained blank.  Additionally OpenGL applications
that were running triggered a number of error messages from the NVIDIA
driver.

This occurred because the vt efifb back-end did not signal the X server
to release the display before suspending (or to re-acquire it after
resuming).  The NVIDIA driver includes code for smoothly shutting down
and re-initializing the GPU, which was not getting called.

Since the NVIDIA driver doesn't currently support framebuffer devices
and vt is forced to fall back to the efifb back-end, add vd_suspend and
vd_resume members to connect the suspend/resume path.  This ensures the
X server is properly able to re-initialize the display.

PR: 237050
Submitted by: Erik Kurzinger <ekurzinger@nvidia.com>

4 years agoMFC r348364:
Ruslan Bukin [Tue, 4 Jun 2019 17:42:47 +0000 (17:42 +0000)]
MFC r348364:

Don't copy the data from bounce buffer back to the mbuf if channel does
not use bounce buffering.

Sponsored by: DARPA, AFRL

4 years agoMFC r347514:
Ruslan Bukin [Tue, 4 Jun 2019 17:39:46 +0000 (17:39 +0000)]
MFC r347514:

Add support for HiFive Unleashed -- the board with a multi-core RISC-V SoC
from SiFive, Inc.

The first core on this SoC (hart 0) is a 64-bit microcontroller.

o Pick a hart to run boot process using hart lottery.
  This allows to exclude hart 0 from running the boot process.
  (BBL releases hart 0 after the main harts, so it never wins the lottery).
o Renumber CPUs early on boot.
  Exclude non-MMU cores. Store the original hart ID in struct pcpu. This
  allows to find out the correct destination for IPIs and remote sfence
  calls.

Thanks to SiFive, Inc for the board provided.

Sponsored by: DARPA, AFRL

4 years agoMFC r340028 (by jhb):
Mark Johnston [Tue, 4 Jun 2019 17:37:50 +0000 (17:37 +0000)]
MFC r340028 (by jhb):
SBI calls expect a pointer to a u_long rather than a pointer.

4 years agoMFC r340027 (by jhb):
Mark Johnston [Tue, 4 Jun 2019 17:37:20 +0000 (17:37 +0000)]
MFC r340027 (by jhb):
Don't allow debuggers to modify SSTATUS, only to read it.

4 years agoMFC r344108:
Mark Johnston [Tue, 4 Jun 2019 17:31:59 +0000 (17:31 +0000)]
MFC r344108:
Implement per-CPU pmap activation tracking for RISC-V.

4 years agoMFC r344107:
Mark Johnston [Tue, 4 Jun 2019 17:31:29 +0000 (17:31 +0000)]
MFC r344107:
Implement pmap_clear_modify() for RISC-V.

4 years agoMFC r344106:
Mark Johnston [Tue, 4 Jun 2019 17:31:05 +0000 (17:31 +0000)]
MFC r344106:
Implement transparent 2MB superpage promotion for RISC-V.

4 years agoMFC r342733:
Mark Johnston [Tue, 4 Jun 2019 17:30:22 +0000 (17:30 +0000)]
MFC r342733:
Set PTE_U on PTEs created by pmap_enter_quick().

4 years agoMFC r340159 (by jhb):
Mark Johnston [Tue, 4 Jun 2019 17:29:47 +0000 (17:29 +0000)]
MFC r340159 (by jhb):
Rework setting PTE_D for kernel mappings.

4 years agoMFC r340030 (by jhb):
Mark Johnston [Tue, 4 Jun 2019 17:29:20 +0000 (17:29 +0000)]
MFC r340030 (by jhb):
Restrict setting PTE execute permissions on RISC-V.

4 years agoMFC r340029 (by jhb):
Mark Johnston [Tue, 4 Jun 2019 17:28:49 +0000 (17:28 +0000)]
MFC r340029 (by jhb):
Set PTE_A and PTE_D for user mappings in pmap_enter().

4 years agoMFC r342765:
Mark Johnston [Tue, 4 Jun 2019 17:25:45 +0000 (17:25 +0000)]
MFC r342765:
Fix dirty bit handling in pmap_remove_write().

4 years agoMFC r342764:
Mark Johnston [Tue, 4 Jun 2019 17:25:22 +0000 (17:25 +0000)]
MFC r342764:
Clear PGA_WRITEABLE in pmap_remove_pages().

4 years agoMFC r342736:
Mark Johnston [Tue, 4 Jun 2019 17:24:52 +0000 (17:24 +0000)]
MFC r342736:
Fix a use-after-free in the riscv pmap_release() implementation.

4 years agoMFC r342735:
Mark Johnston [Tue, 4 Jun 2019 17:24:26 +0000 (17:24 +0000)]
MFC r342735:
Synchronize access to the allpmaps list.

4 years agoMFC r342734:
Mark Johnston [Tue, 4 Jun 2019 17:23:58 +0000 (17:23 +0000)]
MFC r342734:
Fix some issues with the riscv pmap_protect() implementation.

4 years agoMFC r343529:
Mark Johnston [Tue, 4 Jun 2019 17:23:24 +0000 (17:23 +0000)]
MFC r343529:
Remove a redundant test.

4 years agoMFC r342732:
Mark Johnston [Tue, 4 Jun 2019 17:20:34 +0000 (17:20 +0000)]
MFC r342732:
Use regular stores to update PTEs in the riscv pmap layer.

4 years agoMFC r342766:
Mark Johnston [Tue, 4 Jun 2019 17:19:16 +0000 (17:19 +0000)]
MFC r342766:
Don't enable interrupts in init_secondary().

4 years agoMFC r347427:
Ruslan Bukin [Tue, 4 Jun 2019 15:42:30 +0000 (15:42 +0000)]
MFC r347427:

RISC-V ISA does not specify how to manage physical memory attributes (PMA).
So do nothing in pmap_page_set_memattr() and don't panic.

Sponsored by: DARPA, AFRL

4 years agoMFC r347351:
Ruslan Bukin [Tue, 4 Jun 2019 15:40:30 +0000 (15:40 +0000)]
MFC r347351:

Connect Xilinx AXI drivers and Cadence Ethernet MAC to the RISC-V build.

Sponsored by: DARPA, AFRL

4 years agoMFC r347344:
Ruslan Bukin [Tue, 4 Jun 2019 15:39:28 +0000 (15:39 +0000)]
MFC r347344:

Add driver for the Xilinx AXI Direct Memory Access (AXI DMA) controller
found in the U.S. Government Furnished Equipment (GFE) 64-bit RISC-V cores.

Sponsored by: DARPA, AFRL

4 years agoMFC r347342:
Ruslan Bukin [Tue, 4 Jun 2019 15:37:36 +0000 (15:37 +0000)]
MFC r347342:

Add driver for Xilinx AXI Ethernet tri-mode (10/100/1000 Mb/s) MAC found
in the U.S. Government Furnished Equipment (GFE) 64-bit RISC-V cores.

Sponsored by: DARPA, AFRL

4 years agoMFC r347337:
Ruslan Bukin [Tue, 4 Jun 2019 15:35:46 +0000 (15:35 +0000)]
MFC r347337:

o Implement a bounce buffer based on device reserved memory.
  Grab device reserved physical memory regions from FDT using standard
  "memory-region" property and use vmem(9) to allocate buffers from it.
  The same vmem could be used by DMA engine drivers to allocate memory for
  DMA descriptors.
  This is required for platforms that provide uncached memory region
  reserved exclusively for DMA operations.
o Change sleepable sx(9) lock type to non-sleepable mutex(9) since
  network drivers usually hold mutex during DMA operations. So we don't
  take sleepable lock after non-sleepable.

Tested on U.S. Government Furnished Equipment (GFE) 64-bit RISC-V cores.

Sponsored by: DARPA, AFRL

4 years agoMFC r347226:
Ruslan Bukin [Tue, 4 Jun 2019 15:33:52 +0000 (15:33 +0000)]
MFC r347226:

Disable interrupts first and then set spinlock_count to 1.
Otherwise interrupt can be generated just after setting spinlock_count
and before disabling interrupts.

Sponsored by: DARPA, AFRL

4 years agoMFC r347225:
Ruslan Bukin [Tue, 4 Jun 2019 15:32:56 +0000 (15:32 +0000)]
MFC r347225:

Provide a template for busdma code for RISC-V.

RISC-V ISA specifies no cache management instructions so leave cache
operations in cpufunc.h as no-op for now.

Note some new hardware comes with their own memory-mapped cache
management controller.

Tested on HiFive Unleashed board with cgem(4).

Sponsored by: DARPA, AFRL

4 years agoMFC r346994:
Ruslan Bukin [Tue, 4 Jun 2019 15:30:46 +0000 (15:30 +0000)]
MFC r346994:

Deactivate IRQ resource by calling to intr_deactivate_irq().
This is the part of INTRNG support that was missed.

Sponsored by: DARPA, AFRL

4 years agoMFC r346896:
Ruslan Bukin [Tue, 4 Jun 2019 15:28:32 +0000 (15:28 +0000)]
MFC r346896:

o Rewrite softdma_process_tx() of Altera SoftDMA engine driver
  so it does not require a bounce buffer. The only need for this was
  to align the buffer address. Implement unaligned access and we don't
  need to copy data twice.
o Remove contigmalloc-based bounce buffer from xDMA code since it is
  not suitable for arbitrary memory provided by platform, which is
  sometimes a dedicated piece of memory that is not managed by OS at all.

Sponsored by: DARPA, AFRL

4 years agoMFC r346634:
Ruslan Bukin [Tue, 4 Jun 2019 15:26:02 +0000 (15:26 +0000)]
MFC r346634:

Add support for Cadence network controller found in HiFive Unleashed board.

Sponsored by: DARPA, AFRL

4 years agoMFC r346633:
Ruslan Bukin [Tue, 4 Jun 2019 15:25:03 +0000 (15:25 +0000)]
MFC r346633:

Implement pic_pre_ithread(), pic_post_ithread().

Sponsored by: DARPA, AFRL

4 years agoMFC r345796:
Ruslan Bukin [Tue, 4 Jun 2019 15:18:41 +0000 (15:18 +0000)]
MFC r345796:

o Grab the number of devices supported by PLIC from FDT.
o Fix bug in PLIC_ENABLE macro when irq >= 32.

Tested on the real hardware, which is HiFive Unleashed board.

Thanks to SiFive, Inc. for the board provided.

Sponsored by: DARPA, AFRL

4 years agoMFC r345581:
Ruslan Bukin [Tue, 4 Jun 2019 15:15:37 +0000 (15:15 +0000)]
MFC r345581:

Grab timer frequency from FDT.

RISC-V timer has no dedicated DTS node and we have to get timer
frequency from cpus node.

Tested on Government Furnished Equipment (GFE) cores synthesized
on Xilinx VCU118.

Sponsored by: DARPA, AFRL

4 years agoMFC r344252:
Ruslan Bukin [Tue, 4 Jun 2019 15:13:48 +0000 (15:13 +0000)]
MFC r344252:

Avoid orphan sections between __bss_start and .(s)bss.

Ensure __bss_start is associated with the next section
in case orphan sections are placed directly after .sdata,
as has been seen to happen with LLD.

Sponsored by: DARPA, AFRL

4 years agoMFC 339774:
Ruslan Bukin [Tue, 4 Jun 2019 15:11:14 +0000 (15:11 +0000)]
MFC 339774:

o Add pmap lock around pmap_fault_fixup() to ensure other thread will not
  modify l3 pte after we loaded old value and before we stored new value.
o Preset A(accessed), D(dirty) bits for kernel mappings.

Sponsored by: DARPA, AFRL

4 years agoMFC r347999:
Martin Matuska [Tue, 4 Jun 2019 10:28:50 +0000 (10:28 +0000)]
MFC r347999:

Install missing data file for
lib.libarchive.functional_test.test_read_format_zip_utf8_paths

4 years agoMFC r347990:
Martin Matuska [Tue, 4 Jun 2019 10:20:56 +0000 (10:20 +0000)]
MFC r347990:
Sync libarchive with vendor.

Relevant vendor changes:
  Issue #795: XAR - do not try to add xattrs without an allocated name
  PR #812: non-recursive option for extract and list
  PR #958: support reading metadata from compressed files
  PR #999: add --exclude-vcs option to bsdtar
  Issue #1062: treat empty archives with a GNU volume header as valid
  PR #1074: Handle ZIP files with trailing 0s in the extra fields
            (Android APK archives)
  PR #1109: Ignore padding in Zip extra field data (Android APK archives)
  PR #1167: fix problems related to unreadable directories
  Issue #1168: fix handling of strtol() and strtoul()
  PR #1172: RAR5 - fix invalid window buffer read in E8E9 filter
  PR #1174: ZIP reader - fix of MSZIP signature parsing
  PR #1175: gzip filter - fix reading files larger than 4GB from memory
  PR #1177: gzip filter - fix memory leak with repeated header reads
  PR #1180: ZIP reader - add support for Info-ZIP Unicode Path Extra Field
  PR #1181: RAR5 - fix merge_block() recursion
            (OSS-Fuzz 12999, 13029, 13144, 13478, 13490)
  PR #1183: fix memory leak when decompressing ZIP files with LZMA
  PR #1184: fix RAR5 OSS-Fuzz issues 12466, 14490, 14491, 12817
    OSS-Fuzz 12466: RAR5 - fix buffer overflow when parsing huffman tables
    OSS-Fuzz 14490, 14491: RAR5 - fix bad shift-left operations
    OSS-Fuzz 12817: RAR5 - handle a case with truncated huffman tables
  PR #1186: RAR5 - fix invalid type used for dictionary size mask
            (OSS-Fuzz 14537)
  PR #1187: RAR5 - fix integer overflow (OSS-Fuzz 14555)
  PR #1190: RAR5 - RAR5 don't try to unpack entries marked as directories
            (OSS-Fuzz 14574)
  PR #1196: RAR5 - fix a potential SIGSEGV on 32-bit builds
  OSS-Fuzz 2582: RAR - fix use after free if there is an invalid entry
  OSS-Fuzz 14331: RAR5 - fix maximum owner name length
  OSS-Fuzz 13965: RAR5 - use unsigned int for volume number + range check

  Additional RAR5 reader changes:
    - support symlinks, hardlinks, file owner, file group, versioned files
    - change ARCHIVE_FORMAT_RAR_V5 to 0x100000
    - set correct mode for readonly directories
    - support readonly, hidden and system Windows file attributes

4 years agoMFC r348320:
Cy Schubert [Tue, 4 Jun 2019 03:04:30 +0000 (03:04 +0000)]
MFC r348320:

Contuation of r343701, removal of irrelevant #ifdefs.

4 years agoMFC r348338:
Johannes Lundberg [Tue, 4 Jun 2019 01:00:30 +0000 (01:00 +0000)]
MFC r348338:
pseudofs: Ignore unsupported commands in vop_setattr.

Users of pseudofs (e.g. lindebugfs), should be able to receive
input from command line via commands like "echo 1 > /path/to/file".
Currently this fails because sh tries to truncate the file first and
vop_setattr returns not supported error for this. This patch simply
ignores the error and returns 0 instead.

Reviewed by: imp (mentor), asomers
Approved by: imp (mentor), asomers
Differential Revision: D20451

4 years agoMFC 348206,348231,348454: GELI crypto deprecation warnings.
John Baldwin [Mon, 3 Jun 2019 21:03:28 +0000 (21:03 +0000)]
MFC 348206,348231,348454: GELI crypto deprecation warnings.

348206:
Add deprecation warnings for weaker algorithms to geli(4).

- Triple DES has been formally deprecated in Kerberos (RFC 8429)
  and is soon to be deprecated in IPsec (RFC 8221).
- Blowfish is deprecated.  FreeBSD doesn't support its successor
  (Twofish).
- MD5 is generally considered a weak digest that has known attacks.

geli refuses to create new volumes using these algorithms via 'geli
init'.  It also warns when attaching to existing volumes or creating
temporary volumes via 'geli onetime' .  The plan is to fully remove
support for these algorithms in FreeBSD 13.

Note that none of these algorithms have ever been the default
algorithm used by geli(8).  Users would have had to explicitly select
these algorithms when creating volumes in the past.

348231:
Correct the argument passed to g_eli_algo2str()

348454:
Remove tests for the deprecated algorithms in r348206

The tests are failing because the return value and output have changed, but
before test code structure adjusted, removing these test cases help people
be able to focus on more important cases.

Relnotes: yes

4 years agoMFC r348003, r348011:
Mark Johnston [Mon, 3 Jun 2019 16:59:56 +0000 (16:59 +0000)]
MFC r348003, r348011:
Add a man page for DEFINE_IFUNC.

4 years agoMFC r348509: jail_getid(3): add special-case immediate return for jid 0
Kyle Evans [Mon, 3 Jun 2019 15:28:37 +0000 (15:28 +0000)]
MFC r348509: jail_getid(3): add special-case immediate return for jid 0

As depicted in the comment: jid 0 always exists, but the lookup will fail as
it does not appear in the kernel's alljails list being a special jail. Some
callers will expect/rely on this, and we have no reason to lie because it
does always exist.

Approved by: re (early MFC)

4 years agoMFC r348306:
Konstantin Belousov [Mon, 3 Jun 2019 15:10:37 +0000 (15:10 +0000)]
MFC r348306:
Correct some inconsistencies in the earliest created kernel page
tables which affect demotion.

4 years agoMFC r348312:
Cy Schubert [Mon, 3 Jun 2019 04:38:07 +0000 (04:38 +0000)]
MFC r348312:

style(9)

4 years agoMFC r348311:
Cy Schubert [Mon, 3 Jun 2019 04:36:57 +0000 (04:36 +0000)]
MFC r348311:

Fix indentation and while at it simplfy the code.

Reported by: lwhsu@

4 years agoMFC r348310:
Cy Schubert [Mon, 3 Jun 2019 04:35:28 +0000 (04:35 +0000)]
MFC r348310:

Remove compile-time tests for unsupported versions of FreeBSD.

4 years agoMFC r347944
Vincenzo Maffione [Sun, 2 Jun 2019 20:03:00 +0000 (20:03 +0000)]
MFC r347944

netmap: align if_ptnet to the changes introduced by r347233

This removes non-functional SCTP checksum offload support.
More information in the log message of r347233.

4 years agoMFC r346184
Vincenzo Maffione [Sun, 2 Jun 2019 18:46:21 +0000 (18:46 +0000)]
MFC r346184

netmap: add test cases for multiple host rings

Extend the netmap unit tests with new test cases for the multiple-host-rings
feature introduced by r345269.

5 years agoMFC r348433:
Konstantin Belousov [Sun, 2 Jun 2019 09:28:50 +0000 (09:28 +0000)]
MFC r348433:
Remove TODO comment after posixshmcontrol(1) added.

5 years agoMFC r348432:
Konstantin Belousov [Sun, 2 Jun 2019 09:27:38 +0000 (09:27 +0000)]
MFC r348432:
Minor tweaks to the layout.

5 years agoMFC r345085 for mfi.4, mrsas.4: document how to get ATA TRIM support
Eugene Grosbein [Sat, 1 Jun 2019 13:22:56 +0000 (13:22 +0000)]
MFC r345085 for mfi.4, mrsas.4: document how to get ATA TRIM support
for SSD while using LSI RAID adapters as it was completely obscure
before: mfi has no TRIM support at all and mrsas provides TRIM
if underlying adapter does it (for Non-RAID drives generally).

5 years agoMFC 348205:
John Baldwin [Fri, 31 May 2019 20:25:57 +0000 (20:25 +0000)]
MFC 348205:
Add deprecation warnings for IPsec algorithms deprecated in RFC 8221.

All of these algorithms are either explicitly marked MUST NOT, or they
are implicitly MUST NOTs by virtue of not being included in IETF's
list of protocols at all despite having assignments from IANA.

Specifically, this adds warnings for the following ciphers:
- des-cbc
- blowfish-cbc
- cast128-cbc
- des-deriv
- des-32iv
- camellia-cbc

Warnings for the following authentication algorithms are also added:
- hmac-md5
- keyed-md5
- keyed-sha1
- hmac-ripemd160

5 years agoMFC r348247:
Kenneth D. Merry [Fri, 31 May 2019 20:15:29 +0000 (20:15 +0000)]
MFC r348247:
  ------------------------------------------------------------------------
  r348247 | ken | 2019-05-24 13:58:29 -0400 (Fri, 24 May 2019) | 57 lines

  Fix FC-Tape bugs caused in part by r345008.

  The point of r345008 was to reset the Command Reference Number (CRN)
  in some situations where a device stayed in the topology, but had
  changed somehow.

  This can include moving from a switch connection to a direct
  connection or vice versa, or a device that temporarily goes away
  and comes back.  (e.g. moving to a different switch port)

  There were a couple of bugs in that change:
  - We were reporting that a device had not changed whenever the
    Establish Image Pair bit was not set.  That is not quite correct.
    Instead, if the Establish Image Pair bit stays the same (set or
    not), the device hasn't changed in that way.

  - We weren't setting PRLI Word0 in the port database when a new
    device arrived, so comparisons with the old value for the
    Establish Image Pair bit weren't really possible.  So, make sure
    PRLI Word0 is set in the port database for new devices.

  - We were resetting the CRN whenever the Establish Image Pair bit
    was set for a device, even when the device had stayed the same
    and the value of the bit hadn't changed.  Now, only reset the
    CRN for devices that have changed, not devices that sayed the
    same.

  The result of all of this was that if we had a single FC device on
  an FC port and it went away and came back, we would wind up
  correctly resetting the CRN.

  But, if we had multiple devices connected via a switch, and there
  was any change in one or more of those devices, all of the devices
  that stayed the same would also have their CRN values reset.

  The result, from a user standpoint, is that the tape drives, etc.
  would all start to time out commands and the initiator would send
  aborts.

  sys/dev/isp/isp.c:
   In isp_pdb_add_update(), look at whether the Establish
   Image Pair bit has changed as part of the check to
   determine whether a device is still the same.   This was
   causing erroneous change notifications.  Also, when
   creating a new port database entry, initialize the
   PRLI Word 0 values.

  sys/dev/isp/isp_freebsd.c:
   In isp_async(), in the changed/stayed case, instead of
   looking at the Establish Image Pair bit to determine
   whether to reset the CRN, look at the command value.
   (Changed vs. Stayed.)  Only reset the CRN for devices
   that have changed.

  ------------------------------------------------------------------------

Sponsored by: Spectra Logic

5 years agoMFC r348246:
Konstantin Belousov [Fri, 31 May 2019 19:13:31 +0000 (19:13 +0000)]
MFC r348246:
Fix a corner case in demotion of kernel mappings.

5 years agoMFC r348258:
Konstantin Belousov [Fri, 31 May 2019 19:09:56 +0000 (19:09 +0000)]
MFC r348258:
Make pmap_kextract() work on large map.  Fix assert.

5 years agoMFC r348257:
Konstantin Belousov [Fri, 31 May 2019 19:07:02 +0000 (19:07 +0000)]
MFC r348257:
Add PG_PS_PDP_FRAME symbol.

5 years agoMFC r348113:
Alan Somers [Fri, 31 May 2019 16:25:16 +0000 (16:25 +0000)]
MFC r348113:

Update VFS_FHTOVP(9) with the flags argument

Revison 222167 added a new argument to VFS_FHTOVP. This revision updates the
man page to match.

Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20323

5 years agoMFC r348077:
Alan Somers [Fri, 31 May 2019 16:24:51 +0000 (16:24 +0000)]
MFC r348077:

Link fhlinkat(2) man page

Reviewed by: kib
MFC-With: r341689
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20339

5 years agoMFC r347032:
Alan Somers [Fri, 31 May 2019 16:24:22 +0000 (16:24 +0000)]
MFC r347032:

directory.3: add a STANDARDS section

Reviewed by: jilles, ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20111

5 years agoMFC r346847:
Alan Somers [Fri, 31 May 2019 16:23:51 +0000 (16:23 +0000)]
MFC r346847:

fsx: seed more randomly with the -S0 option

When using -S0, seed the PRNG with the current time in nanoseconds, not
seconds, so consecutive runs don't accidentally use the same seed.

Also, rename some variables for clarity.

Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20078

5 years agoMFC r346750:
Alan Somers [Fri, 31 May 2019 16:23:13 +0000 (16:23 +0000)]
MFC r346750:

[skip ci] fix typo in comment from r59840

Sponsored by: The FreeBSD Foundation

5 years agoMFC r346078:
Alan Somers [Fri, 31 May 2019 16:22:29 +0000 (16:22 +0000)]
MFC r346078:

fix cache_lookup's documentation

cache_lookup's documentation got dislocated by r324378. Relocate and expand
it.

Reviewed by: jhb, kib
Sponsored by: The FreeBSD Foundation

5 years agoMFC r345677:
Alan Somers [Fri, 31 May 2019 16:21:38 +0000 (16:21 +0000)]
MFC r345677:

Add man page for VOP_FDATASYNC(9)

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

5 years agoMFC r345202:
Alan Somers [Fri, 31 May 2019 16:20:50 +0000 (16:20 +0000)]
MFC r345202:

VOP_INACTIVE(9): clarify wording

Reviewed by: kib, 0mp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19596

5 years agoMFC r345034:
Alan Somers [Fri, 31 May 2019 16:20:00 +0000 (16:20 +0000)]
MFC r345034:

Drop "All rights reserved" from the files I own

Also, add SPDX tags where needed.

5 years agoMFC r348241:
Mark Johnston [Fri, 31 May 2019 15:05:54 +0000 (15:05 +0000)]
MFC r348241:
Modernize the MAKE_JUST_KERNELS hint in the top-level makefile.

5 years agoMFC r348236:
Andrey V. Elsukov [Fri, 31 May 2019 11:21:30 +0000 (11:21 +0000)]
MFC r348236:
  Restore IPV6_NEXTHOP option support that seem was partially broken
  since r286195.

  Do not forget results of route lookup and initialize rt and ifp pointers.

  PR: 238098
  Submitted by: Masse Nicolas <nicolas.masse at stormshield eu>

5 years agoficl pfopen: verify file
Simon J. Gerraty [Thu, 30 May 2019 23:43:54 +0000 (23:43 +0000)]
ficl pfopen: verify file

If the file is verified - do not allow write
otherwise do not allow read.

Add O_ACCMODE to stand.h

MFC of r348249

Reviewed by: stevek, mindal_semihalf.com
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D20387

5 years agoMFC 346650: Add support for AES-CCM to ccr(4).
John Baldwin [Thu, 30 May 2019 18:44:19 +0000 (18:44 +0000)]
MFC 346650: Add support for AES-CCM to ccr(4).

This is fairly similar to the AES-GCM support in ccr(4) in that it will
fall back to software for certain cases (requests with only AAD and
requests that are too large).

5 years agoMFC 347964:
John Baldwin [Thu, 30 May 2019 16:40:21 +0000 (16:40 +0000)]
MFC 347964:
Expose the MD_CLEAR capability used by Intel MDS mitigations to guests.

5 years agoMFC r346932, r347159:
Mark Johnston [Thu, 30 May 2019 15:23:43 +0000 (15:23 +0000)]
MFC r346932, r347159:
Optimize lseek(SEEK_DATA) on UFS.

5 years agoMFC r348080, r348081:
Mark Johnston [Thu, 30 May 2019 15:20:20 +0000 (15:20 +0000)]
MFC r348080, r348081:
Add platform-dependent DTrace tests.

5 years agoMFC r348082:
Mark Johnston [Thu, 30 May 2019 15:17:35 +0000 (15:17 +0000)]
MFC r348082:
Provide an example of using dhclient-script(5) to configure netdump.

5 years agoMFC r348167, r348168, r348359, r348361:
Konstantin Belousov [Thu, 30 May 2019 15:15:47 +0000 (15:15 +0000)]
MFC r348167, r348168, r348359, r348361:
Add posixshmcontrol(1) utility.

5 years agoMFC r348158:
Konstantin Belousov [Thu, 30 May 2019 15:13:23 +0000 (15:13 +0000)]
MFC r348158:
Add a kern.ipc.posix_shm_list sysctl.

5 years agoMFC r348157:
Konstantin Belousov [Thu, 30 May 2019 15:12:20 +0000 (15:12 +0000)]
MFC r348157:
Report ref count of the backing object as st_nlink for posix shm fd.

5 years agoMFC r348156:
Konstantin Belousov [Thu, 30 May 2019 15:10:41 +0000 (15:10 +0000)]
MFC r348156:
Make pack_kinfo() available for external callers.

5 years agoMFC r347974, r348001, r348006, r348013, r348016, r348018, r348020
Ian Lepore [Thu, 30 May 2019 14:40:23 +0000 (14:40 +0000)]
MFC r347974, r348001, r348006, r348013, r348016, r348018, r348020

FDT support for if_muge and if_smsc drivers...

r347974:
Add common support functions for USB devices configured via FDT data.

FDT data is sometimes used to configure usb devices which are hardwired into
an embedded system. Because the devices are instantiated by the usb
enumeration process rather than by ofwbus iterating through the fdt data, it
is somewhat difficult for a usb driver to locate fdt data that belongs to
it. In the past, various ad-hoc methods have been used, which can lead to
errors such applying configuration that should apply only to a hardwired
device onto a similar device attached by the user at runtime. For example,
if the user adds an ethernet device that uses the same driver as the builtin
ethernet, both devices might end up with the same MAC address.

These changes add a new usb_fdt_get_node() helper function that a driver can
use to locate FDT data that belongs to a single unique instance of the
device. This function locates the proper FDT data using the mechanism
detailed in the standard "usb-device.txt" binding document [1].

There is also a new usb_fdt_get_mac_addr() function, used to retrieve the
mac address for a given device instance from the fdt data. It uses
usb_fdt_get_node() to locate the right node in the FDT data, and attempts to
obtain the mac-address or local-mac-address property (in that order, the
same as linux does it).

The existing if_smsc driver is modified to use the new functions, both as an
example and for testing the new functions. Rpi and rpi2 boards use this
driver and provide the mac address via the fdt data.

[1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/usb-device.txt

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

r348001 by emaste:
muge: configure LEDs per dtb (for Raspberry Pi 3B+)

Also apply some style(9) and remove the message about EEPROM configuration
(if there's an EEPROM the hardware handles LED configuration itself).

PR: 237325
Reviewed by: ian
Submitted by: Ralf <iz-rpi03@hs-karlsruhe.de>

r348006 by emaste:
muge: update FDT LED configuration

Also use LED mode settings from the FDT to set the PHY.
From v3 of the patch submitted in the PR.

I moved the sc_led_modes and sc_led_modes_mask default setting outside
of the #ifdef FDT case.

PR: 237325
Submitted by: Ralf <iz-rpi03@hs-karlsruhe.de>
Reviewed by: ian
MFC with: r348001
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D20325

r348013:
Use the new usb fdt support functions to locate the proper fdt node for
the device instance, and to get the MAC address for the device instance.
The ad-hoc code this replaces could find the wrong instance if multiple
devices were present.

r348016:
Don't detour through sc->sc_ue when we have a direct pointer to ue in hand
already.  Also, shorten a variable name for nicer line-wrapping.

No functional changes.

r348018:
A MAC adddress from FDT data should override anything stored in eeprom or
OTP registers (because the user is in control of the fdt data).  Remove the
early returns from the code that tries to find a good mac address, so that
the execution always flows through the routine to get an address from FDT
data last, when on FDT-enabled systems.

r348020:
Reverse the bit logic of sc_led_modes_mask.  Instead of initializing it to
all-ones then carving out blocks of zeroes where specified values go, init
it to all-zeroes, put in ones where values need to be masked, then use it
as value &= ~sc_led_modes_mask.  In addition to being more idiomatic, this
means everything related to FDT data is initialized to zero along with the
rest of the softc, and that allows removing some #ifdef FDT sections and
wrapping the whole muge_set_leds() function in a single ifdef block.

This also deletes the early-out from muge_set_leds() when an eeprom exists.
Even if there is an eeprom with led config in it, the fdt data (if present)
should override that, because the user is in control of the fdt data.

5 years agoMFC r348290:
Michael Tuexen [Thu, 30 May 2019 13:51:11 +0000 (13:51 +0000)]
MFC r348290:
When an ACK segment as the third message of the three way handshake is
received and support for time stamps was negotiated in the SYN/SYNACK
exchange, perform the PAWS check and only expand the syn cache entry if
the check is passed.
Without this check, endpoints may get stuck on the incomplete queue.

Reviewed by: jtl@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D20374

5 years agoMFC r348302:
Xin LI [Thu, 30 May 2019 04:09:45 +0000 (04:09 +0000)]
MFC r348302:

Chase r261913: hardcoded default crypt(3) algorithm is SHA-512 when DES
is not available.

Submitted by: Ali Mashtizadeh <ali mashtizadeh.com>

5 years agoMFC 347033:
John Baldwin [Wed, 29 May 2019 23:05:26 +0000 (23:05 +0000)]
MFC 347033:
Increase the VirtIO segment count to support modern Windows guests.

The Windows virtio driver ignores the advertized seg_max field and
assumes the host can accept up to 67 segments in indirect descriptors,
triggering an assert in the bhyve process.

This brings back r282922 but with a couple of changes:
- It raises the block interface segment limit to 128 instead of 67.
- Linux's virtio driver assumes that the segment limit is no
  larger than the ring size.  To avoid breaking Linux guests,
  raise the VirtIO ring size to 128, and cap the VirtIO segment
  limit at ring size - 2 (effectively 126).

5 years agoMFC r348288:
Dimitry Andric [Wed, 29 May 2019 18:23:18 +0000 (18:23 +0000)]
MFC r348288:

Pull in r361696 from upstream llvm trunk (by Sanjay Patel):

  [SelectionDAG] soften assertion when legalizing narrow vector FP ops

  The test based on PR42010:
  https://bugs.llvm.org/show_bug.cgi?id=42010

  ...may show an inaccuracy for PPC's target defs, but we should not be
  so aggressive with an assert here. There's no telling what
  out-of-tree targets look like.

This fixes an assertion when building the graphics/mesa-dri port for
PowerPC64.

Reported by: Mark Millard <marklmi26-fbsd@yahoo.com>
PR: 238082

5 years agoMFC r348052:
Konstantin Belousov [Wed, 29 May 2019 13:47:10 +0000 (13:47 +0000)]
MFC r348052:
NDFREE(): Fix unlocking for LOCKPARENT|LOCKLEAF and ndp->ni_dvp == ndp->ni_vp.

5 years agoMFC r348075:
Konstantin Belousov [Wed, 29 May 2019 13:33:29 +0000 (13:33 +0000)]
MFC r348075:
Do not call hw_mds_recalculate() from initializecpu().

5 years agoMFC r348111: Simplify math added in r310524.
Alexander Motin [Wed, 29 May 2019 13:17:58 +0000 (13:17 +0000)]
MFC r348111: Simplify math added in r310524.

Should be no functional change.

5 years agoMFC r345405,345406,346228,346657,348195,348198: UART SPCR fixes.
Colin Percival [Tue, 28 May 2019 22:22:40 +0000 (22:22 +0000)]
MFC r345405,345406,346228,346657,348195,348198: UART SPCR fixes.

r345405: Obey SPCR AccessWidth parameter.
r345406: Initialize uart_bus_space_mem on arm64.
r346228: Add quirk to ignore AccessWidth on PL011 UART.
r346657: Handle SPCR BaudRate = 0.
r348195: Extract arm64 SPCR code and make it MI; use on x86 too.
r348198: Fix for r348195.

This unbreaks the console on EC2 a1.* and *.metal instances.

Sponsored by: https://www.patreon.com/cperciva

5 years agoMFC: r348340
Jung-uk Kim [Tue, 28 May 2019 21:57:01 +0000 (21:57 +0000)]
MFC: r348340

Merge OpenSSL 1.1.1c.

5 years agoMFC r348066, r348090:
Mark Johnston [Tue, 28 May 2019 14:17:03 +0000 (14:17 +0000)]
MFC r348066, r348090:
bootpd: Add an option to skip modifications to the ARP table.

PR: 30854

5 years agoMFC r348069: bootpd: avoid the same error indication for different issues
Ed Maste [Tue, 28 May 2019 13:14:53 +0000 (13:14 +0000)]
MFC r348069: bootpd: avoid the same error indication for different issues

There were several (apparently) copy-pasted NEED validation macros,
leading to the same error string for different issues.  Change the
YP and NTP tags so they are distinct.

PR: 30863
Submitted by: Dan Lukes <dan@obluda.cz>
Reviewed by: markj

5 years agoMFC r347642:
Cy Schubert [Tue, 28 May 2019 02:00:09 +0000 (02:00 +0000)]
MFC r347642:

The driver list prints "(null)" for the NDIS driver when -h (help) or
an unknown switch is passed outputting the command usage. This is
because the NDIS driver is uninitialized when usage help is printed.
To resolve this we initialize the driver prior to the possibility of
printing the usage help message.

Obtained from: The wpa_supplicant port

5 years agoMFC r348215, r348219: fix bectl(8) jail w/ numeric BE names
Kyle Evans [Mon, 27 May 2019 02:18:33 +0000 (02:18 +0000)]
MFC r348215, r348219: fix bectl(8) jail w/ numeric BE names

r348215:
jail_getid(3): validate jid string input

Currently, if jail_getid(3) is passed in a numeric string, it assumes that
this is a jid string and passes it back converted to an int without checking
that it's a valid/existing jid. This breaks consumers that might use
jail_getid(3) to see if it can trivially grab a jid from a name if that name
happens to be numeric but not actually the name/jid of the jail. Instead of
returning -1 for the jail not existing, it'll return the int version of the
input and the consumer will not fallback to trying other methods.

Pass the numeric input to jail_get(2) as the jid for validation, rather than
the name. This works well- the kernel enforces that jid=name if name is
numeric, so doing the safe thing and checking numeric input as a jid will
still DTRT based on the description of jail_getid.

r348219:
bectl(8): Add a test for jail/unjail of numeric BE names

Fixed by r348215, bectl ujail first attempts the trivial fetch of a jid by
passing the first argument to 'ujail' to jail_getid(3) in case a jid/name
have been passed in instead of a BE name. For numerically named BEs, this
was doing the wrong thing: instead of failing to locate the jid specified
and falling back to mountpath search, jail_getid(3) would return the input
as-is.

While here, I've fixed bectl_jail_cleanup which still used a hard-coded pool
name that was overlooked w.r.t. other work that was in-flight around the
same time.

5 years agoMFC r348127: bectl(8): add description for create subcommand
Kyle Evans [Mon, 27 May 2019 02:17:41 +0000 (02:17 +0000)]
MFC r348127: bectl(8): add description for create subcommand

In commit r345845, a portion of documentation for the create subcommand was
removed. Specifically, for creating a snapshot of an existing boot
environment. bectl even has a test-case for this functionality.

Removing the sub-command description was discussed in PR 235850.

This patch brings back the second "create" description that was originally
in place. Albeit, with a few wording/clarifying changes.

5 years agoMFC r347975:
Michael Tuexen [Sun, 26 May 2019 16:43:06 +0000 (16:43 +0000)]
MFC r347975:
Improve input validation for the IPPROTO_SCTP level socket options
SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.

MFC r347976:
Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.
This issue was found by running syzkaller.

5 years agoLinuxKPI: Revert MFC of r347892
Johannes Lundberg [Sat, 25 May 2019 20:53:23 +0000 (20:53 +0000)]
LinuxKPI: Revert MFC of r347892

Revert until we can figure out how to keep compatibility with drm-kmod
ports between 12.0 and 12-STABLE/12.1.

5 years agoMFC r344385:
Johannes Lundberg [Sat, 25 May 2019 20:24:51 +0000 (20:24 +0000)]
MFC r344385:
PFS: Bump NAMELEN and don't require clients to be sleepable

- debugfs consumers expect to be able to export names more than 48 characters

- debugfs consumers expect to be able to hold locks across calls and are able
  to handle allocation failures

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19256

5 years agoMFC r344384:
Johannes Lundberg [Sat, 25 May 2019 19:59:59 +0000 (19:59 +0000)]
MFC r344384:
Add non-sleepable strdup variant strdup_flags

debugfs expects to do non-sleepable allocations

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19259