]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r333228
kib [Thu, 17 May 2018 15:24:53 +0000 (15:24 +0000)]
MFC r333228
Implement support for ifuncs in the kernel linker on x86.

MFC r333411:
Avoid calls to bzero() before ireloc

Approved by: re (marius)

6 years agoMFC r333458:
ae [Thu, 17 May 2018 10:01:47 +0000 (10:01 +0000)]
MFC r333458:
  Fix the printing of rule comments.

  Change uint8_t type of opcode argument to int in the print_opcode()
  function. Use negative value to print the rest of opcodes, because
  zero value is O_NOP, and it can't be uses for this purpose.

  Reported by: lev
Approved by: re (gjb)

6 years agoMFC 332891,332892: Fixes for atomic_*cmpset() on arm.
jhb [Wed, 16 May 2018 21:04:19 +0000 (21:04 +0000)]
MFC 332891,332892: Fixes for atomic_*cmpset() on arm.

332891:
Fix some harmless type mismatches in the ARM atomic_cmpset implementations.

The return value of atomic_cmpset() and atomic_fcmpset() is an int (which
is really a bool) that has the values 0 or 1.  Some of the inlines were
using the type being operated on (e.g. uint32_t) as either the return type
of the function, or the type of a local 'ret' variable used to hold the
return value.  Fix all of these to just use plain 'int'.  Due to C promotion
rules and the fact that the value can only be 0 or 1, these should all be
harmless.

332892:
Implement 32-bit atomic_fcmpset() in userland for armv4/v5.

- Add an implementation of atomic_fcmpset_32() using RAS for armv4/v5.
  This fixes recent world breakage due to use of atomic_fcmpset() in
  userland.
- While here, be more careful to not expose wrapper macros for 64-bit
  atomic_*cmpset to userland for armv4/v5 as only 32-bit cmpset is
  implemented.

This has been reviewed, but not runtime-tested, but should fix the arm.arm
and arm.armeb worlds that have been broken for a while.

Approved by: re (kib)

6 years agoMFC r333436: only launch getty if underlying device exists
imp [Wed, 16 May 2018 13:18:37 +0000 (13:18 +0000)]
MFC r333436: only launch getty if underlying device exists

Note: pc98 isn't run under VM, so I didn't do a direct commit to it.

Approved by: re@ (gjb@)

6 years agoMFC r333404, r333405:
kib [Wed, 16 May 2018 11:06:39 +0000 (11:06 +0000)]
MFC r333404, r333405:
Remove PG_U from the recursive pte for kernel pmap' PML4 page
and from the rest of the kernel pmap ptes.

Approved by: re (marius)

6 years agoMFC r331340, r331342, r331472, r332050, r333276, r333448:
np [Tue, 15 May 2018 18:41:01 +0000 (18:41 +0000)]
MFC r331340, r331342, r331472, r332050, r333276, r333448:

r331340:
cxgbe(4): Tunnel congestion drops on a port should be cleared when the
stats for that port are cleared.

r331342:
cxgbe(4): Do not read MFG diags information from custom boards.

r331472:
cxgbe(4): Always initialize requested_speed to a valid value.

This fixes an avoidable EINVAL when the user tries to disable AN after
the port is initialized but l1cfg doesn't have a valid speed to use.

r332050:
cxgbe(4): Always display an error message if SIOCSIFFLAGS will leave
IFF_UP and IFF_DRV_RUNNING out of sync.  ifhwioctl in the kernel pays no
attention to the return code from the driver ioctl during SIOCSIFFLAGS
so these messages are the only indication that the ioctl was called but
failed.

r333276:
cxgbe(4): Update all firmwares to 1.19.1.0.

r333448:
cxgbe(4): Disable write-combined doorbells by default.

This had been the default behavior but was changed accidentally as part
of the recent iw_cxgbe+OFED overhaul.  Fix another bug in that change
while here: the global knob affects all the adapters in the system and
should be left alone by per-adapter code.

Approved by: re@ (marius@)
Sponsored by: Chelsio Communications

6 years agoMFC r333521:
kib [Tue, 15 May 2018 12:11:52 +0000 (12:11 +0000)]
MFC r333521:
PROC_PDEATHSIG_CTL will appear first in 11.2.

Approved by: re (marius)

6 years agoMFC r333244:
ae [Tue, 15 May 2018 11:43:05 +0000 (11:43 +0000)]
MFC r333244:
  Immediately propagate EACCES error code to application from tcp_output.

  In r309610 and r315514 the behavior of handling EACCES was changed, and
  tcp_output() now returns zero when EACCES happens. The reason of this
  change was a hesitation that applications that use TCP-MD5 will be
  affected by changes in project/ipsec.

  TCP-MD5 code returns EACCES when security assocition for given connection
  is not configured. But the same error code can return pfil(9), and this
  change has affected connections blocked by pfil(9). E.g. application
  doesn't return immediately when SYN segment is blocked, instead it waits
  when several tries will be failed.

  Actually, for TCP-MD5 application it doesn't matter will it get EACCES
  after first SYN, or after several tries. Security associtions must be
  configured before initiating TCP connection.

  I left the EACCES in the switch() to show that it has special handling.

  Reported by: Andreas Longwitz <longwitz at incore dot de>
Approved by: re (marius)

6 years agoMFC r333504:
kib [Tue, 15 May 2018 11:25:10 +0000 (11:25 +0000)]
MFC r333504:
Remove dead declaration.

Approved by: re (marius)

6 years agoHandle the difference between HEAD and stable/11 tests build.
kib [Tue, 15 May 2018 10:10:14 +0000 (10:10 +0000)]
Handle the difference between HEAD and stable/11 tests build.
This is a direct commit to stable/11.

PR: 228018, 228233
Tested by: Helge Oldach <freebsd@oldach.net>
Sponsored by: The FreeBSD Foundation
Approved by: re (marius)

6 years agoMFC r333362:
hselasky [Tue, 15 May 2018 09:40:52 +0000 (09:40 +0000)]
MFC r333362:
Fix for missing network interface address event when adding the default IPv6
based link-local address.

The default link local address for IPv6 is added as part of bringing the
network interface up. Move the call to "EVENTHANDLER_INVOKE(ifaddr_event,)"
from the SIOCAIFADDR_IN6 ioctl(2) handler to in6_notify_ifa() which should
catch all the cases of adding IPv6 based addresses to a network interface.
Add a witness warning in case the event handler is not allowed to sleep.

Approved by: re (marius)
Reviewed by: network (ae), kib
Differential Revision: https://reviews.freebsd.org/D13407
Sponsored by: Mellanox Technologies

6 years agoMFC r331906:
gonzo [Tue, 15 May 2018 02:26:50 +0000 (02:26 +0000)]
MFC r331906:

Approved by: re (gjb)

Fix accidental USB port resets by GPIO on Zynq/Zedboard boards

The Zynq/Zedboard GPIO driver attempts to tri-state all GPIO pins on
boot up but the order in which I reset the hardware can cause the pins
to be briefly held low before being tri-stated.  This is a problem on
boards that use GPIO pins to reset devices.

In particular, the Zybo and ZC-706 boards use a GPIO pin as a USB PHY
reset.  If U-boot enables the USB port before booting the kernel, the
GPIO driver attach causes a glitch on the USB PHY reset and the USB
port loses power.  My fix is to have the GPIO driver leave the pins in
whatever configuration U-boot placed them.

PR: 225713
Submitted by: Thomas Skibo <thoma555-bsd@yahoo.com>

6 years agoMFC SVN r329188,329334,329353,329914,329995-329996: DTrace Enhancements
dteske [Tue, 15 May 2018 00:00:44 +0000 (00:00 +0000)]
MFC SVN r329188,329334,329353,329914,329995-329996: DTrace Enhancements

r329188: Use tabs in io.d, fix alignment issues, remove extra newlines
r329334: Add errno definitions to /usr/lib/dtrace/errno.d
r329353: Add inline to errno.d for translating int to string
r329914: Updates and enhancements to io.d to aid DTrace scripting
r329995: Updates and enhancements to signal.d to aid DTrace scripting
r329996: Consistent casing for fallback SIGCHLD (s/Unknown/unknown/)

MFC SVN r330559-330560,330672,332865-332867,333513-333519: dwatch(1)

r330559: Introduce dwatch(1) as a tool for making DTrace more useful
r330560: Bump dwatch(1) internal version from 1.0-beta-91 to 1.0
r330672: Fix display of wrong pid from dtrace_sched(4)
r332865: Add `-dev' option to aid debugging of profiles
r332866: Add profile for send(2)/recv(2) syscalls
r332867: Remove the line used to demonstrate `-dev' option
r333513: Bugfix, usage displayed with `-1Q'
r333514: Separate default values so `-[BK] num' don't affect usage
r333515: Simplify info message test
r333516: Export ARGV to profiles loaded via load_profile()
r333517: Allow `-E code' to override profile EVENT_DETAILS
r333518: Expose process for ip/tcp/udp
r333519: Refactor sendrecv profile

Reviewed by: markj, gnn, bdrewery (head; earlier version)
Approved by: re (gjb)
Relnotes: yes
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D15418

6 years agoMFC r332317, r332439, r332442
gonzo [Mon, 14 May 2018 23:12:30 +0000 (23:12 +0000)]
MFC r332317, r332439, r332442

Approved by: re

r332317:
[man] Fix return type of BUS_ADD_CHILD(9)

Fix return type of BUS_ADD_CHILD(9) in SYNOPSYS section,
it should be device_t, not int

PR: 207389

r332439:
Fix quotes in the example code in syslog(3) BUGS section

mdoc treats verbatim quotes in .Dl as a string delimiter and does
not pass them to the rendered output. Use special char \*q to specify
double quote

PR: 216755

r332442:
Bump .Dd value (forgot to do this in r332439)

6 years agoMFC r303848
sbruno [Mon, 14 May 2018 22:56:41 +0000 (22:56 +0000)]
MFC r303848

Repair trivial panic in ng_uncallout.  Fixes bugzilla #211031

PR: 211031
Approved by: re (gjb)

6 years agoMFC r333239:
pfg [Mon, 14 May 2018 19:20:37 +0000 (19:20 +0000)]
MFC r333239:
msdosfs: long names of files are created incorrectly.

This fixes a regression that happened in r120492 (2003) where libkiconv
was introduced and we went from checking unlen to checking for '\0'.

PR: 111843
Patch by: Damjan Jovanovic
Approved by: re (gjb)

6 years agoMFC r333473:
gjb [Mon, 14 May 2018 17:43:43 +0000 (17:43 +0000)]
MFC r333473:
 Add a special GCE_LICENSE variable to Makefile.gce, which when set,
 will include license metadata in the resultant GCE image.

 GCE_LICENSE is unset by default, as it primarily pertains to images
 produced by the FreeBSD Project, but for downstream FreeBSD consumers,
 it can be set in the make(1) environment in the format of:

   --licenses="projects/PROJECT_ID/global/licenses/LICENSE_NAME"

 The "license" is not a license, per se, but required metadata that
 is required by the GCE marketplace.  For the FreeBSD Project, the
 license name is simply 'freebsd', with the description of 'FreeBSD'.

Approved by: re (marius)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333493:
trasz [Mon, 14 May 2018 15:35:54 +0000 (15:35 +0000)]
MFC r333493:

Set kldxref_enable="YES" for ARM images. Without it, the images are missing
the /boot/kernel/linker.hints file, which breaks loading some of the modules
with dependencies, eg cfiscsi.ko.

This is a minimal fix for ARM images, in order to safely MFC it before
11.2-RELEASE.  Afterwards, however, I believe we should actually just change
the default (as in, etc/defaults/rc.conf).  The reason is that it's required
for every image that's being cross-built, as kldxref(1) cannot handle files
for non-native architectures.  For the one that is not - amd64 - having it
on by default doesn't change anything - the script is noop if the linker.hints
already exists.

The long-term solution would be to rewrite kldxref(1) to handle other
architectures, and generate linker.hints at build time.

Approved by: re (marius@)
Sponsored by: DARPA, AFRL

6 years agoMFC r333460:
kib [Sun, 13 May 2018 17:44:26 +0000 (17:44 +0000)]
MFC r333460:
Add the test program to examine CPU behaviour for pop ss issue
CVE-2018-8897.

Approved by: re (marius)

6 years agoMFC r332504:
kib [Sat, 12 May 2018 11:40:34 +0000 (11:40 +0000)]
MFC r332504:
Set PG_G global mapping bit on the trampoline ptes.

Approved by: re (marius)

6 years agoMFC r332450:
kib [Sat, 12 May 2018 11:18:14 +0000 (11:18 +0000)]
MFC r332450:
Optimize context switch for PTI on PCID pmap.

Approved by: re (marius)

6 years agor285910 attempted to make shutdown() be POSIX compliant by returning
jtl [Sat, 12 May 2018 01:55:24 +0000 (01:55 +0000)]
r285910 attempted to make shutdown() be POSIX compliant by returning
ENOTCONN when shutdown() is called on unconnected sockets.  This change was
slightly modified by r316874, which returns ENOTCONN in the case of an
unconnected datagram socket, but still runs the shutdown code for the
socket.  This specifically supports the case where the user-space code is
using the shutdown() call to wakeup another thread blocked on the socket.

In PR 227259, a user is reporting that they have code which is using
shutdown() to wakup another thread blocked on a stream listen socket.  This
code is failing, while it used to work on FreeBSD 10 and still works on
Linux.

It seems reasonable to add another exception to support something users are
actually doing, which used to work on FreeBSD 10, and still works on Linux.
And, it seems like it should be acceptable to POSIX, as we still return
ENOTCONN.

This is a direct commit to stable/11.  The listen socket code changed
substantially in head, and the code change there will be substantially
more complex.  In the meantime, it seems to make sense to commit this
trivial fix to stable/11 given the fact that users appear to depend on
this behavior, this appears to have been an unintended change in stable/11,
and we did not announce the change.

PR: 227259
Reviewed by: ed
Approved by: re (gjb)
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D15021
Tested by: Eric Masson (emss at free.fr)

6 years agoCreate a sun7i-a20-bananapi.dtb hard link to bananapi.dtb to fix
gjb [Fri, 11 May 2018 21:46:53 +0000 (21:46 +0000)]
Create a sun7i-a20-bananapi.dtb hard link to bananapi.dtb to fix
a boot failure on the Banana Pi SoC.

This is a direct commit to stable/11, as the sun7i-a20-bananapi.dtb
file exists in head, but appears to have been part of a larger
rework of dtb-related files that may have larger consequences than
hard link creation.  Note: creating a hard link to dtb files was
an original fix in 12-CURRENT beforehand, introduced in r319603.

Approved by: re (marius)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333329, r333366, r333373
shurd [Fri, 11 May 2018 20:40:26 +0000 (20:40 +0000)]
MFC r333329, r333366, r333373

r333329: Fix off-by-one error requesting tx interrupt
r333366: Cleanup queues when iflib_device_register fails
r333373: Log iflib_tx_structures_setup failure in function

Approved by: re (gjb@)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15354

6 years agoRename stable/11 from PRERELEASE to BETA1 as part of the 11.2-RELEASE
gjb [Thu, 10 May 2018 23:58:33 +0000 (23:58 +0000)]
Rename stable/11 from PRERELEASE to BETA1 as part of the 11.2-RELEASE
cycle.

Update the default pkg(8) repository to the 'quarterly' branch to
prevent further 11.2 builds from downgrading packages when invoking
'pkg upgrade' for the duration of the cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333003
davidcs [Wed, 9 May 2018 19:52:33 +0000 (19:52 +0000)]
MFC r333003
Upgraded FW Related Files to version 5.4.67

Approved by:re(gjb)

6 years agoMFC r333019 r333046 r333085 r333086 r333132
sbruno [Wed, 9 May 2018 16:14:12 +0000 (16:14 +0000)]
MFC r333019 r333046 r333085 r333086 r333132

smartpqi(4):
- Microsemi SCSI driver for PQI controllers.
- Found on newer model HP servers.
- Restrict to AMD64 only as per developer request.

The driver provides support for the new generation of PQI controllers
from Microsemi. This driver is the first SCSI driver to implement the
PQI queuing model and it will replace the aacraid driver for Adaptec
Series 9 controllers.  HARDWARE Controllers supported by the driver include:

    HPE Gen10 Smart Array Controller Family
    OEM Controllers based on the Microsemi Chipset.

Approved by: re (gjb@)
Relnotes: yes

6 years agoMFC r333158:
mav [Wed, 9 May 2018 15:22:40 +0000 (15:22 +0000)]
MFC r333158:
Clean enclosure_table when resetting num_enc_table_entries to zero.

Garbage left there by r325363 in some scenarios found to lead to later
enclosure mapping failures.

Approved by: re@ (gjb)
Sponsored by: iXsystems, Inc.

6 years agoMFC r332966: Add deprecation notice for lmc(4)
emaste [Wed, 9 May 2018 14:50:32 +0000 (14:50 +0000)]
MFC r332966: Add deprecation notice for lmc(4)

We intend to remove support before FreeBSD 12 is branched.  These are
available only as 32-bit PCI devices.  The driver has an ambiguous
license and I have not been successful in contacting the driver's author
in order to address this.

The planned deprecation has been announced on -current and -stable; if
we receive feedback that the driver is still useful and we are able to
resolve the license issue this deprecation notice can be reverted.

Relnotes: Yes
Approved by: re
Sponsored by: The FreeBSD Foundation

6 years agoMFC r332446: switch i386 memstick installer images to MBR
emaste [Wed, 9 May 2018 14:38:07 +0000 (14:38 +0000)]
MFC r332446: switch i386 memstick installer images to MBR

Some BIOSes have trouble booting from GPT in non-UEFI mode.  This is
commonly reported with Lenovo laptops, including my x220.  As we do not
currently support booting FreeBSD/i386 via UEFI there's no reason to
prefer GPT.

The "vestigial swap partition" was added in r265017 to work around an
issue with loader's GPT support, so we should not need it when using
MBR.

We may want to make the same change to amd64, although the issue there is
mitigated by such systems booting via UEFI in the common case.

PR: 227422
Approved by: re
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333182:
kib [Wed, 9 May 2018 11:47:05 +0000 (11:47 +0000)]
MFC r333182:
mlx5en: Always allow VLAN id 0.

Sponsored by: Mellanox Technologies
Approved by: re (marius)

6 years agoBelatedly bump copyright year.
gjb [Tue, 8 May 2018 18:03:08 +0000 (18:03 +0000)]
Belatedly bump copyright year.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoDocument EN-18:05, EN-18:06, SA-18:06.
gjb [Tue, 8 May 2018 17:59:25 +0000 (17:59 +0000)]
Document EN-18:05, EN-18:06, SA-18:06.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333368: Prepare DB# handler for deferred trigger of watchpoints.
emaste [Tue, 8 May 2018 17:03:33 +0000 (17:03 +0000)]
MFC r333368: Prepare DB# handler for deferred trigger of watchpoints.

Prepare DB# handler for deferred trigger of watchpoints.

Since pop %ss/mov %ss instructions defer all interrupts and exceptions
for the next instruction, it is possible that the userspace watchpoint
trap executes on the first instruction of the kernel entry for
syscall/bpt.

In this case, DB# should be treated similarly to NMI: on amd64 we must
always load GSBASE even if the trap comes from kernel mode, and load
the kernel page table root into %cr3.  Moreover, the trap must
use the dedicated stack, because we are still on the user stack when
trapped on syscall entry.

For i386, we must reload %cr3.  The syscall instruction is not configured,
so there is no issue with executing on user stack when trapping.

Due to some CPU erratas it is not always possible to detect that the
userspace watchpoint triggered by inspecting %dr6.  In trap(), compare the
trap %rip with the known unsafe entry points and if matched pretend that
the watchpoint did not fire at all.

Thank you to the MSRC Incident Response Team, and in particular Greg
Lenti and Nate Warfield, for coordinating the response to this issue
across multiple vendors.

Thanks to Computer Recycling at The Working Center of Kitchener for
making hardware available to allow us to test the patch on additional
CPU families.

Reviewed by: jhb
Discussed with: Matthew Dillon
Tested by: emaste
Approved by: re (so blanket)
Security: CVE-2018-8897
Security: FreeBSD-SA-18:06.debugreg
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333210
sbruno [Tue, 8 May 2018 16:56:14 +0000 (16:56 +0000)]
MFC r333210

Deprecation notice for nxge(4).  This driver will not appear
in FreeBSD 12 or later.

Approved by: re (gjb@)
Relnotes: yes

6 years agoMFC: r308728, r314369, r315243, r316026, r316581, r316616, r318359,
shurd [Tue, 8 May 2018 15:51:40 +0000 (15:51 +0000)]
MFC: r308728, r314369, r315243, r316026, r316581, r316616, r318359,
r319922, r319990, r321481, r323232-323233, r323321, r323874, r323955,
r324323, r324964, r325169, r325488, r325620, r326985, r326999-327001,
r327003, r329335

Update bnxt to latest -CURRENT.

Approved by: re (gjb@)
Differential Revision: https://reviews.freebsd.org/D15143

6 years agoMFC r333125:
kib [Tue, 8 May 2018 10:56:06 +0000 (10:56 +0000)]
MFC r333125:
Turn off IBRS on suspend.

Approved by: re (marius)

6 years agoMFC r333091:
kib [Tue, 8 May 2018 10:18:24 +0000 (10:18 +0000)]
MFC r333091:
Eliminate some vm object relocks in vm fault.

Approved by: re (marius)

6 years agoMFC r333208:
kib [Tue, 8 May 2018 10:03:32 +0000 (10:03 +0000)]
MFC r333208:
Style.

Approved by: re (marius)

6 years agoMFC r332877: Correct size for allocation and bzero of fdsr.
delphij [Tue, 8 May 2018 05:10:06 +0000 (05:10 +0000)]
MFC r332877: Correct size for allocation and bzero of fdsr.

Approved by: re (gjb)

6 years agoMFC r333149: ixl(4): Update to 1.9.9-k
erj [Mon, 7 May 2018 23:23:11 +0000 (23:23 +0000)]
MFC r333149: ixl(4): Update to 1.9.9-k

Major changes:

- Support for descriptor writeback mode (required by ixlv(4) for AVF support)
- Ability to disable firmware LLDP agent by user
- Fix for TX queue hang when using TSO
- Separate descriptor ring sizes for TX and RX rings

Approved by: re (marius)
Relnotes: yes
Sponsored by: Intel Corporation

6 years agoMFC r333253-r333254
shurd [Mon, 7 May 2018 23:10:02 +0000 (23:10 +0000)]
MFC r333253-r333254

Fixes invalid free()s when iflib_queues_alloc() fails, and remove unused
brscp variable.

Approved by: re (gjb@)

6 years agoDirect commit to stable/11 to fix botched r333338
shurd [Mon, 7 May 2018 22:33:40 +0000 (22:33 +0000)]
Direct commit to stable/11 to fix botched r333338

netmap nm_intr is not part of stable/11

Approved by: re (marius@)
Sponsored by: Limelight Networks

6 years agoMerge iflib changes to 11-STABLE
shurd [Mon, 7 May 2018 21:42:22 +0000 (21:42 +0000)]
Merge iflib changes to 11-STABLE

MFC r300147, r300153, r300154, r300215, r301563, r301567,
r302372, r307560, r307562, r307563, r307568, r308792, r311039,
r311837, r312755, r312903, r312905, r312924, r313248, r315217,
r315245, r315288, r316278, r316281, r316502, r316596, r317756,
r319917, r319921, r319984, r319989, r320059, r320609, r320611,
r321253, r321629, r321630, r322337, r322338, r322823, r323077,
r323825, r323876, r323879, r323887, r323941, r323942, r323943,
r323944, r323954, r324038, r324318, r324937, r325166, r325167,
r325168, r325201, r325241, r325245, r325487, r325494, r325901,
r326033, r326369, r326370, r326432, r326577, r326578, r326702,
r326706, r326775, r327013, r327017, r327052, r327072, r327098,
r327242, r327244, r327247, r329651, r329742, r330289, r330715,
r330721, r332419, r332422, r332729

Reviewed by: sbruno
Approved by: re (delphij@)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15142

6 years agoMFC r326571: ifconfig(8): Display extended compliance code string for SFP transceivers
erj [Mon, 7 May 2018 21:26:05 +0000 (21:26 +0000)]
MFC r326571:  ifconfig(8): Display extended compliance code string for SFP transceivers

Approved by: re (marius, gjb)

6 years agoMFC r319797, r320972:
erj [Mon, 7 May 2018 20:41:24 +0000 (20:41 +0000)]
MFC r319797, r320972:

r319797:
ixl(4)/ixlv(4): Fix some busdma tags and improper map NULL.

r320972:
ixl(4)/ixlv(4): Stop leaking every busdma entry in receive path

Approved by: re (marius)

6 years agoMFC r333262, r333264:
gjb [Mon, 7 May 2018 16:21:53 +0000 (16:21 +0000)]
MFC r333262, r333264:

 r333262:
  Ensure the ports and src trees are available on GCE images,
  satisfying a requirement to allow FreeBSD to be considered
  a top-tier supported OS in Google Compute Engine.

 r333264:
  Fix a typo.

Approved by: re (kib)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r333108:
hselasky [Mon, 7 May 2018 15:07:26 +0000 (15:07 +0000)]
MFC r333108:
Define USEC_PER_MSEC and USEC_PER_SEC in the LinuxKPI.

Approved by: re (marius)
Sponsored by: Mellanox Technologies

6 years agoMFC r333247: Import tzdata 2018e
philip [Mon, 7 May 2018 06:58:19 +0000 (06:58 +0000)]
MFC r333247: Import tzdata 2018e

North Korea switches back to +09 on 2018-05-05.

This version more correctly models time stamps in time zones with
negative DST such as Europe/Dublin (from 1971 on), Europe/Prague
(1946/7), and Africa/Windhoek (1994/2017).  This does not affect the
UT offsets, only time zone abbreviations and the tm_isdst flag.

Approved by: re (kib)

6 years agoMFC r333234: zfs_ioctl: avoid out-of-bound read
emaste [Fri, 4 May 2018 14:49:37 +0000 (14:49 +0000)]
MFC r333234: zfs_ioctl: avoid out-of-bound read

admbugs: 796
Submitted by: Domagoj Stolfa <ds815@cam.ac.uk>
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Approved by: re (early MFC as an EN candidate)

6 years agoMFC r332997:
brooks [Thu, 3 May 2018 20:05:57 +0000 (20:05 +0000)]
MFC r332997:

Translate 32-bit ifmedia requests into native ones.

We use transformation rather than accessors as virtually ever driver
implements SIOCGIFMEDIA and all would have to be touched.

Keep the code readable by always performing copies and (possiably no-op)
transforms.

Reviewed by: jhb, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14996

6 years agoMFC r333092: sh: Don't have [ match any [[:class:]]
jilles [Thu, 3 May 2018 19:47:25 +0000 (19:47 +0000)]
MFC r333092: sh: Don't have [ match any [[:class:]]

6 years agoMFC r333115:
slavash [Thu, 3 May 2018 16:19:47 +0000 (16:19 +0000)]
MFC r333115:
libibumad/umad.c: In get_port, ignore sysctl get rate errors

This can cause ibpanic in ibstat when width is not set properly
as can occur when Ethernet port is connected to InfiniBand fabric.

ibpanic: [8167] main: stat of IB device 'mlx5_0' failed: m

With this change, Rate is displayed as 0 with ibstat for
this scenario.

Approved by:    hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies

6 years agoMFC: r330803
marius [Thu, 3 May 2018 15:47:42 +0000 (15:47 +0000)]
MFC: r330803

Use FALLTHROUGH.

6 years agoMFC: r327312, r327842, r327865
marius [Thu, 3 May 2018 15:40:56 +0000 (15:40 +0000)]
MFC: r327312, r327842, r327865

- Add initial support for Intel Ice Lake and Cannon Lake Ethernet MACs.
- Add workaround for Intel Sky Lake and Kabby Lake Ethernet MAC erratum
  1.5.4.5.
- Fix uses of 1 << 31.

6 years agoMFC r333016:
ae [Thu, 3 May 2018 08:17:12 +0000 (08:17 +0000)]
MFC r333016:
  Merge r1.22-1.23 from NetBSD:
    Don't assume M_PKTHDR is set only on the first mbuf of the chain.
    The check is replaced by (m1 != m), which is equivalent to the previous
    code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
    m_adj().

    Fix a pretty bad mistake, that has always been there:
     m_adj(m1, -(m1->m_len - roff));
     if (m1 != m)
   m->m_pkthdr.len -= (m1->m_len - roff);

    This is wrong: m_adj() will modify m1->m_len, so we're using a wrong
    value when manually adjusting m->m_pkthdr.len.

  Reported by: Maxime Villard <max at m00nbsd dot net>
  Obtained from: NetBSD

6 years agoMFC r332886:
ae [Thu, 3 May 2018 08:15:32 +0000 (08:15 +0000)]
MFC r332886:
  icmp6_reflect() sends ICMPv6 message with new IPv6 header. So, it is
  considered as originated by our host packet. And thus rcvif should be
  NULL, since it is used by ipfw(4) to determine that packet was originated
  from this host. Some of icmp6_reflect() consumers reuse mbuf and m_pkthdr
  without resetting rcvif pointer. To avoid this always reset m_pkthdr.rcvif
  pointer to NULL in icmp6_reflect(). Also remove such line and comment
  describing this from icmp6_error(), since it does not longer matters.

  PR: 227674

6 years agoMFC r332752: set kdb_why to "trap" when calling kdb_trap from trap_fatal
avg [Thu, 3 May 2018 07:47:03 +0000 (07:47 +0000)]
MFC r332752: set kdb_why to "trap" when calling kdb_trap from trap_fatal

This will allow to hook a ddb script to "kdb.enter.trap" event.
Previously there was no specific name for this event, so it could only
be handled by either "kdb.enter.unknown" or "kdb.enter.default" hooks.
Both are very unspecific.

Having a specific event is useful because the fatal trap condition is
very similar to panic but it has an additional property that the current
stack frame is the frame where the trap occurred.  So, both a register
dump and a stack bottom dump have additional information that can help
analyze the problem.

I have added the event only on architectures that have trap_fatal()
function defined.  I haven't looked at other architectures.  Their
maintainers can add support for the event later.

Sample script:
kdb.enter.trap=bt; show reg; x/aS $rsp,20; x/agx $rsp,20

Sponsored by: Panzura

6 years agoMFC r332730: don't check for kdb reentry in trap_fatal(), it's impossible
avg [Thu, 3 May 2018 07:31:09 +0000 (07:31 +0000)]
MFC r332730: don't check for kdb reentry in trap_fatal(), it's impossible

Sponsored by: Panzura

6 years agoMFC r333100:
hselasky [Thu, 3 May 2018 07:29:08 +0000 (07:29 +0000)]
MFC r333100:
Improve fix in r304629 by allowing configuration of the behaviour
through a SYSCTL instead of a compile time define.

Add quirk by default for all LynxPoint XHCI controllers.

PR: 227602
Sponsored by: Mellanox Technologies

6 years agoMFC r332559: mountd: fix a crash when getgrouplist reports too many groups
avg [Thu, 3 May 2018 07:28:04 +0000 (07:28 +0000)]
MFC r332559: mountd: fix a crash when getgrouplist reports too many groups

Sponsored by: Panzura

6 years agoMFC r332426: allow ZFS pool to have temporary name for duration of current import
avg [Thu, 3 May 2018 06:34:07 +0000 (06:34 +0000)]
MFC r332426: allow ZFS pool to have temporary name for duration of current import

The change adds -t <name> option to zpool create and -t option to zpool
import in its form with an old name and a new name.  This allows to
import (or create) a pool under a name that's different from its real,
permanent name without affecting that name.  This is useful when working
with VM images or images of other physical systems if they happen to
have a ZFS pool with the same name as the host system.

Sponsored by: Panzura (porting)

6 years agoMFC r333084:
kp [Wed, 2 May 2018 20:15:02 +0000 (20:15 +0000)]
MFC r333084:

pfctl: Don't break connections on skipped interfaces on reload

On reload we used to first flush everything, including the list of skipped
interfaces.  This can lead to termination of these connections if they send
packets before the new configuration is applied.

Note that this doesn't currently happen on 12 or 11, because of special EACCES
handling introduced in r315514. This special behaviour in tcp_output() may
change, hence the fix in pfctl.

PR: 214613
Submitted by: Andreas Longwitz <longwitz at incore.de>

6 years agoMFC r333137:
sbruno [Wed, 2 May 2018 15:21:51 +0000 (15:21 +0000)]
MFC r333137:

ixgb(4):  Add deprecation notice for this old and busted 10GE adapter.

This is a prequisite before we remove the driver from -current.

6 years agoMFC r332940:
kib [Wed, 2 May 2018 08:26:59 +0000 (08:26 +0000)]
MFC r332940:
Carefully update stack guard bytes inside __guard_setup().

6 years agoMFC r332932:
kib [Wed, 2 May 2018 08:24:59 +0000 (08:24 +0000)]
MFC r332932:
Correct undesirable interaction between caching of %cr4 in bhyve and
invltlb_glob().

6 years agoMFC r333026:
kib [Wed, 2 May 2018 08:19:06 +0000 (08:19 +0000)]
MFC r333026:
Handle Apollo Lake errata APL31.

MFC r333034:
Tweaks for r333026.

6 years agoMFC r333025:
kib [Wed, 2 May 2018 08:16:38 +0000 (08:16 +0000)]
MFC r333025:
Some style and minor code improvements for idle selection.

6 years agoMFC r332973:
kib [Wed, 2 May 2018 08:12:25 +0000 (08:12 +0000)]
MFC r332973:
Make the sysctl machdep.idle also a tunable.

6 years agoMFC r332934:
kib [Wed, 2 May 2018 08:00:57 +0000 (08:00 +0000)]
MFC r332934:
Use relaxed atomics to access the monitor line.

6 years agoMFC r332740:
kib [Wed, 2 May 2018 07:57:36 +0000 (07:57 +0000)]
MFC r332740:
Add PROC_PDEATHSIG_SET to procctl interface.

MFC r332825:
Rename PROC_PDEATHSIG_SET -> PROC_PDEATHSIG_CTL.

MFC r333067:
Remove redundant pipe from pdeathsig.c test.

6 years agoMFC r333002:
kib [Wed, 2 May 2018 07:42:47 +0000 (07:42 +0000)]
MFC r333002:
Use CPUID leaf 0x15 to get TSC frequency when the calibration is
disabled.

6 years agoMFC r332972:
kib [Wed, 2 May 2018 07:40:04 +0000 (07:40 +0000)]
MFC r332972:
Extend ap_boot_mtx scope to also cover mca_init().

6 years agoMFC r332971:
kib [Wed, 2 May 2018 07:38:38 +0000 (07:38 +0000)]
MFC r332971:
Ensure that cmci_monitor() is not executed in parallel.

6 years agoMFC r332849: lldb: propagate error to user if memory read fails
emaste [Tue, 1 May 2018 19:34:33 +0000 (19:34 +0000)]
MFC r332849: lldb: propagate error to user if memory read fails

Previously, an attempt to read an unreadable access reported zeros:

(lldb) memory read -format hex -size 8 0
0x00000000: 0x0000000000000000 0x0000000000000000
0x00000010: 0x0000000000000000 0x0000000000000000
...

Now, if DoReadMemory encounters error then return 0 (bytes read) so we
report the error to the user:

(lldb) memory read -format hex -size 8 0
error: Bad address

LLVM PR: 37190

Sponsored by: The FreeBSD Foundation

6 years agoMFC 332975: Document the TRAP_CAP code for SIGTRAP.
jhb [Mon, 30 Apr 2018 21:56:08 +0000 (21:56 +0000)]
MFC 332975: Document the TRAP_CAP code for SIGTRAP.

6 years agoMFC 332735:
jhb [Mon, 30 Apr 2018 20:29:28 +0000 (20:29 +0000)]
MFC 332735:
Fix two off-by-one errors when allocating MSI and MSI-X interrupts.

x86 enforces an (arbitray) limit on the number of available MSI and
MSI-X interrupts to simplify code (in particular, interrupt_source[]
is statically sized).  This means that an attempt to allocate an MSI
vector needs to fail if it would go beyond the limit, but the checks
for exceeding the limit had an off-by-one error.  In the case of MSI-X
which allocates interrupts one at a time this meant that IRQ 768 kept
getting handed out multiple times for msix_alloc() instead of failing
because all MSI IRQs were in use.

6 years agoMFC r332003:
slavash [Mon, 30 Apr 2018 08:51:04 +0000 (08:51 +0000)]
MFC r332003:
Bump driver version number in mlx5en(4).

Approved by:    hselasky (mentor), kib (mentor)
Sponsored by: Mellanox Technologies

6 years agoMFC r333015:
hselasky [Mon, 30 Apr 2018 08:13:30 +0000 (08:13 +0000)]
MFC r333015:
Add network device event for priority code point, PCP, changes.

When the PCP is changed for either a VLAN network interface or when
prio tagging is enabled for a regular ethernet network interface,
broadcast the IFNET_EVENT_PCP event so applications like ibcore can
update its GID tables accordingly.

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

6 years agoMFC r332902: pwd_mkdb: default to network (big) endian hash order
emaste [Mon, 30 Apr 2018 00:07:41 +0000 (00:07 +0000)]
MFC r332902: pwd_mkdb: default to network (big) endian hash order

For cross-architecture reproducibility. The db(3) functions work with
hashes of either endianness, and the current (v4) version password db
entries already store integers in network order.  Do so with the hash as
well so that identical password databases can be created on big- and
little-endian hosts.

The -B and -L flags exist to set the endianness for legacy (v3) entries
when the -l flag is used, and they will still control hash endianness
(at least until the backwards compatibility infrastructure is removed
[a change that will not be merged to stable/11]).

Sponsored by: The FreeBSD Foundation

6 years agoMFC r332986:
pfg [Sat, 28 Apr 2018 02:32:05 +0000 (02:32 +0000)]
MFC r332986:
makefs: Use ENODATA instead of ENOMSG as a translation for missing ENOATTR.

This is consistent with what some linux filesystems do and has been
adopted in our linuxulator.

6 years agoMFC 332733:
jhb [Sat, 28 Apr 2018 00:16:54 +0000 (00:16 +0000)]
MFC 332733:
Workaround fixed I/O port resources encoded as I/O port ranges in _CRS.

ACPI I/O port descriptors use _MIN and _MAX fields to specify the set
of allowable base (start) addresses for an I/O port resource along with
a _LEN field specifying the length.  A fixed resource is supposed to be
encoded with _MIN == _MAX, but some buggy firmwares instead set _MAX to
the end of the fixed range.  Relocating I/O ranges only make sense in
_PRS (possible resource settings), not in _CRS (current resource settings),
so if an I/O port range with _MAX set set to the end of the range is
present in _CRS, treat it as a fixed I/O port resource starting at
_MIN.

PR: 224096

6 years agoMFC r332833:
dim [Fri, 27 Apr 2018 19:21:39 +0000 (19:21 +0000)]
MFC r332833:

Recommit r332501, with an additional upstream fix for "Cannot lower
EFLAGS copy that lives out of a basic block!" errors on i386.

Pull in r325446 from upstream clang trunk (by me):

  [X86] Add 'sahf' CPU feature to frontend

  Summary:
  Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
  `+sahf` feature for the backend, for bug 36028 (Incorrect use of
  pushf/popf enables/disables interrupts on amd64 kernels).  This was
  originally submitted in bug 36037 by Jonathan Looney
  <jonlooney@gmail.com>.

  As described there, GCC also uses `-msahf` for this feature, and the
  backend already recognizes the `+sahf` feature. All that is needed is
  to teach clang to pass this on to the backend.

  The mapping of feature support onto CPUs may not be complete; rather,
  it was chosen to match LLVM's idea of which CPUs support this feature
  (see lib/Target/X86/X86.td).

  I also updated the affected test case (CodeGen/attr-target-x86.c) to
  match the emitted output.

  Reviewers: craig.topper, coby, efriedma, rsmith

  Reviewed By: craig.topper

  Subscribers: emaste, cfe-commits

  Differential Revision: https://reviews.llvm.org/D43394

Pull in r328944 from upstream llvm trunk (by Chandler Carruth):

  [x86] Expose more of the condition conversion routines in the public
  API for X86's instruction information. I've now got a second patch
  under review that needs these same APIs. This bit is nicely
  orthogonal and obvious, so landing it. NFC.

Pull in r329414 from upstream llvm trunk (by Craig Topper):

  [X86] Merge itineraries for CLC, CMC, and STC.

  These are very simple flag setting instructions that appear to only
  be a single uop. They're unlikely to need this separation.

Pull in r329657 from upstream llvm trunk (by Chandler Carruth):

  [x86] Introduce a pass to begin more systematically fixing PR36028
  and similar issues.

  The key idea is to lower COPY nodes populating EFLAGS by scanning the
  uses of EFLAGS and introducing dedicated code to preserve the
  necessary state in a GPR. In the vast majority of cases, these uses
  are cmovCC and jCC instructions. For such cases, we can very easily
  save and restore the necessary information by simply inserting a
  setCC into a GPR where the original flags are live, and then testing
  that GPR directly to feed the cmov or conditional branch.

  However, things are a bit more tricky if arithmetic is using the
  flags.  This patch handles the vast majority of cases that seem to
  come up in practice: adc, adcx, adox, rcl, and rcr; all without
  taking advantage of partially preserved EFLAGS as LLVM doesn't
  currently model that at all.

  There are a large number of operations that techinaclly observe
  EFLAGS currently but shouldn't in this case -- they typically are
  using DF.  Currently, they will not be handled by this approach.
  However, I have never seen this issue come up in practice. It is
  already pretty rare to have these patterns come up in practical code
  with LLVM. I had to resort to writing MIR tests to cover most of the
  logic in this pass already.  I suspect even with its current amount
  of coverage of arithmetic users of EFLAGS it will be a significant
  improvement over the current use of pushf/popf. It will also produce
  substantially faster code in most of the common patterns.

  This patch also removes all of the old lowering for EFLAGS copies,
  and the hack that forced us to use a frame pointer when EFLAGS copies
  were found anywhere in a function so that the dynamic stack
  adjustment wasn't a problem. None of this is needed as we now lower
  all of these copies directly in MI and without require stack
  adjustments.

  Lots of thanks to Reid who came up with several aspects of this
  approach, and Craig who helped me work out a couple of things
  tripping me up while working on this.

  Differential Revision: https://reviews.llvm.org/D45146

Pull in r329673 from upstream llvm trunk (by Chandler Carruth):

  [x86] Model the direction flag (DF) separately from the rest of
  EFLAGS.

  This cleans up a number of operations that only claimed te use EFLAGS
  due to using DF. But no instructions which we think of us setting
  EFLAGS actually modify DF (other than things like popf) and so this
  needlessly creates uses of EFLAGS that aren't really there.

  In fact, DF is so restrictive it is pretty easy to model. Only STD,
  CLD, and the whole-flags writes (WRFLAGS and POPF) need to model
  this.

  I've also somewhat cleaned up some of the flag management instruction
  definitions to be in the correct .td file.

  Adding this extra register also uncovered a failure to use the
  correct datatype to hold X86 registers, and I've corrected that as
  necessary here.

  Differential Revision: https://reviews.llvm.org/D45154

Pull in r330264 from upstream llvm trunk (by Chandler Carruth):

  [x86] Fix PR37100 by teaching the EFLAGS copy lowering to rewrite
  uses across basic blocks in the limited cases where it is very
  straight forward to do so.

  This will also be useful for other places where we do some limited
  EFLAGS propagation across CFG edges and need to handle copy rewrites
  afterward. I think this is rapidly approaching the maximum we can and
  should be doing here. Everything else begins to require either heroic
  analysis to prove how to do PHI insertion manually, or somehow
  managing arbitrary PHI-ing of EFLAGS with general PHI insertion.
  Neither of these seem at all promising so if those cases come up,
  we'll almost certainly need to rewrite the parts of LLVM that produce
  those patterns.

  We do now require dominator trees in order to reliably diagnose
  patterns that would require PHI nodes. This is a bit unfortunate but
  it seems better than the completely mysterious crash we would get
  otherwise.

  Differential Revision: https://reviews.llvm.org/D45673

Together, these should ensure clang does not use pushf/popf sequences to
save and restore flags, avoiding problems with unrelated flags (such as
the interrupt flag) being restored unexpectedly.

Requested by: jtl
PR: 225330

MFC r332898:

Pull in r329771 from upstream llvm trunk (by Craig Topper):

  [X86] In X86FlagsCopyLowering, when rewriting a memory setcc we need
  to emit an explicit MOV8mr instruction.

  Previously the code only knew how to handle setcc to a register.

  This should fix a crash in the chromium build.

This fixes various assertion failures while building ports targeting
i386:
* www/firefox: isReg() && "This is not a register operand!"
* www/iridium, www/qt5-webengine: (I.atEnd() || std::next(I) ==
  def_instr_end()) && "getVRegDef assumes a single definition or no
  definition"
* devel/powerpc64-gcc: FromReg != ToReg && "Cannot replace a reg with
  itself"

Reported by: jbeich
PR: 225330, 227686, 227698, 227699

6 years agoMFC 332657:
jhb [Fri, 27 Apr 2018 18:07:31 +0000 (18:07 +0000)]
MFC 332657:
Properly do a deep copy of the ioctls capability array for fget_cap().

fget_cap() tries to do a cheaper snapshot of a file descriptor without
holding the file descriptor lock.  This snapshot does not do a deep
copy of the ioctls capability array, but instead uses a different
return value to inform the caller to retry the copy with the lock
held.  However, filecaps_copy() was returning 1 to indicate that a
retry was required, and fget_cap() was checking for 0 (actually
'!filecaps_copy()').  As a result, fget_cap() did not do a deep copy
of the ioctls array and just reused the original pointer.  This cause
multiple file descriptor entries to think they owned the same pointer
and eventually resulted in duplicate frees.

The only code path that I'm aware of that triggers this is to create a
listen socket that has a restricted list of ioctls and then call
accept() which calls fget_cap() with a valid filecaps structure from
getsock_cap().

To fix, change the return value of filecaps_copy() to return true if
it succeeds in copying the caps and false if it fails because the lock
is required.  I find this more intuitive than fixing the caller in
this case.  While here, change the return type from 'int' to 'bool'.

Finally, make filecaps_copy() more robust in the failure case by not
copying any of the source filecaps structure over.  This avoids the
possibility of leaking a pointer into a structure if a similar future
caller doesn't properly handle the return value from filecaps_copy()
at the expense of one more branch.

I also added a test case that panics before this change and now passes.

6 years agoMFC: r332813
rmacklem [Fri, 27 Apr 2018 12:57:39 +0000 (12:57 +0000)]
MFC: r332813
Fix use of pointer after being set NULL.

Using a pointer after setting it NULL is probably not a good plan.
Spotted by inspection during changes for Flexible File Layout Ioerr handling.
This code path obviously isn't normally executed.

6 years agoMFC: r332790
rmacklem [Fri, 27 Apr 2018 12:50:17 +0000 (12:50 +0000)]
MFC: r332790
Fix OpenDowngrade for NFSv4.1 if a client sets the OPEN_SHARE_ACCESS_WANT* bits.

The NFSv4.1 RFC specifies that the OPEN_SHARE_ACCESS_WANT bits can be set
in the OpenDowngrade share_access argument and are basically ignored.
I do not know of a extant NFSv4.1 client that does this, but this little
patch fixes it just in case.
It also changes the error from NFSERR_BADXDR to NFSERR_INVAL since the NFSv4.1
RFC specifies this as the error to be returned if bogus bits are set.
(The NFSv4.0 RFC didn't specify any error for this, so the error reply can
 be changed for NFSv4.0 as well.)
Found by inspection while looking at a problem with OpenDowngrade reported
for the ESXi 6.5 NFSv4.1 client.

6 years agoMFC r332812:
ae [Fri, 27 Apr 2018 11:00:12 +0000 (11:00 +0000)]
MFC r332812:
  Add dead_bpf_if structure, that should be used as fake bpf_if
  during ifnet detach.

  Since destroying interface is not atomic operation and due to the
  lack of synhronization during destroy, it is possible, that in the
  time between bpfdetach() and if_free() some queued on destroying
  interface mbuf will be used by ether_input_internal() and
  bpf_peers_present() can dereference NULL bpf_if pointer. To protect
  from this, assign pointer to empty bpf_if_ext structure instead of
  NULL pointer after bpfdetach().

MFC r332949 (by markj):
  Use dead_bpf_if instead of bp_null.

  This fixes a -Wunused error when DEV_BPF and NETGRAPH_BPF are not
  defined.

  Also remove a stray semicolon added in r332812.

6 years agoMFC r332970:
kib [Fri, 27 Apr 2018 08:56:17 +0000 (08:56 +0000)]
MFC r332970:
Use IS_BSP() macro.

MFC r332989 (by lwhsu):
Add i386 IS_BSP().

6 years agowhitespace changes to reduce diffs from i386.
nyan [Fri, 27 Apr 2018 02:39:36 +0000 (02:39 +0000)]
whitespace changes to reduce diffs from i386.
still broken pc98 boot.

6 years agoMFC r332090: stand: pass --no-rosegment for i386 bits when linking with lld
emaste [Fri, 27 Apr 2018 01:21:52 +0000 (01:21 +0000)]
MFC r332090: stand: pass --no-rosegment for i386 bits when linking with lld

btxld does not correctly handle input with other than 2 PT_LOAD
segments.  Passing --no-rosegment lets lld produce output eqivalent to
ld.bfd: 2 PT_LOAD segments and no PT_GNU_RELRO.

PR: 225775
Sponsored by: The FreeBSD Foundation

6 years agoMFC r308767 by br:
ian [Thu, 26 Apr 2018 16:40:59 +0000 (16:40 +0000)]
MFC r308767 by br:

Make gpiobus early driver at BUS_PAS_BUS.

The gpiobus driver is attached explicitly and generally should be
at the same pass as its parent. Making it use BUS_PAS_BUS ensures
that it attaches immediately after parent adds it (assuming the
parent itself attached at BUS_PAS_BUS and above).

Submitted by: kan
Sponsored by: DARPA, AFRL

6 years agoMFC r333007
benno [Wed, 25 Apr 2018 18:58:38 +0000 (18:58 +0000)]
MFC r333007

 Update release version of FreeBSD.

Sponsored by: iXsystems, Inc.

6 years agoMFC r332345, r332346, r332661, r333005
benno [Wed, 25 Apr 2018 18:53:02 +0000 (18:53 +0000)]
MFC r332345, r332346, r332661, r333005

r332345:
 Fix makefs invocation after r331843.

r332346:
 Fix the position of $bootable so that -o platformid=efi applies correctly.

r332661:
 Generate hybrid ISO images for amd64.

 This keeps the existing El Torito entries for BIOS and UEFI boot code and
 adds a GPT in the ISO image's System Area containing boot code for BIOS that
 will load /boot/loader from the ISO filesystem and execute it. We then use
 etdump to find the EFI System Partition image in the El Torito catalog and
 add an entry to the GPT that allows EFI to find it.

r333005:
 Allow etdump, makefs and mkimg to be overridden.

 Recent changes to makefs and mkimg have led to situations where the
 disconnect between this script and the versions installed on the host cause
 failures. Provide a way to work around this that doesn't require the
 installation of new versions to the host system if that's not desired.

 With this change mkisoimages.sh will honour the $ETDUMP, $MAKEFS and $MKIMG
 environment variables but fall back to the previous behaviour of finding them
 within $PATH.

Sponsored by: iXsystems, Inc.

6 years agoMFC r332737:
kib [Wed, 25 Apr 2018 12:23:35 +0000 (12:23 +0000)]
MFC r332737:
For fatal traps other than pagefaults, print raw fault error codes.

6 years agoMFC r331622:
kib [Wed, 25 Apr 2018 12:21:13 +0000 (12:21 +0000)]
MFC r331622:
Allow to specify PCP on packets not belonging to any VLAN.

Sponsored by: Mellanox Technologies

6 years agoMFC r332869:
hselasky [Wed, 25 Apr 2018 06:29:07 +0000 (06:29 +0000)]
MFC r332869:
Remove the "load drivers" logic from libibverbs.

The "load drivers" logic in the libibverbs configuration file is relevant
for Linux only.

Sponsored by: Mellanox Technologies

6 years agoMFC r331463 (partial), r331467, r331468, r331843
benno [Wed, 25 Apr 2018 01:59:15 +0000 (01:59 +0000)]
MFC r331463 (partial), r331467, r331468, r331843

r331463, r331467, and r331468 are all replaced by r331843 but are included for
completeness' sake. r331463 also contained a change to
release/amd64/mkisoimages.sh which I've left out since those changes were
also obsoleted by a later commit which will be merged later.

r331843:

 Synchronise with NetBSD's version of EFI handling for El Torito images.

Sponsored by: iXsystems, Inc.

6 years agoMFC r332663: Move panic-related settings from sysctl.conf to loader.conf so
cperciva [Wed, 25 Apr 2018 01:54:24 +0000 (01:54 +0000)]
MFC r332663: Move panic-related settings from sysctl.conf to loader.conf so
that they apply if an EC2 instance panics while booting.

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

6 years agoMFC r316579
benno [Wed, 25 Apr 2018 01:48:15 +0000 (01:48 +0000)]
MFC r316579

 makefs: use emalloc and friends

 The emalloc set of error-checking memory allocation routines were added
 to libnetbsd in r316572. Use them in makefs to reduce differences with
 NetBSD.

 NetBSD revs:
 cd9660.c 1.39
 ffs.c 1.56
 makefs.c 1.42
 walk.c 1.27
 cd9660/cd9660_archimedes.c 1.2
 cd9660/cd9660_eltorito.c 1.20
 cd9660/cd9660_write.c 1.16
 cd9660/iso9660_rrip.c 1.12
 ffs/buf.c 1.17
 ffs/mkfs.c 1.26

Sponsored by: iXsystems, Inc.

6 years agoMFC r307927
benno [Wed, 25 Apr 2018 01:35:06 +0000 (01:35 +0000)]
MFC r307927

 Be more precise when including headers so that we're less likely to
 depend on namespace pollution and as such become more portable. This
 means including headers like <sys/types.h> or <stdlib.h>, but also
 making sure we include system/host headers before local headers.

 While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
 on Linux.

 With this, makefs is ready for compilation on macOS and Linux.

Sponsored by: iXsystems, Inc.