]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
6 years agoMFC r331015:
dab [Mon, 19 Mar 2018 17:38:35 +0000 (17:38 +0000)]
MFC r331015:

Modify rc.d/fsck to handle new status from fsck/fsck_ffs

r328013 introduced a new error code from fsck_ffs that indicates that
it could not completely fix the file system; this happens when it
prints the message PLEASE RERUN FSCK. However, this status can happen
when fsck is run in "preen" mode and the rc.d/fsck script does not
handle that error code. Modify rc.d/fsck so that if "fsck -p"
("preen") returns the new status code (16) it will run "fsck -y", as
it currently does for a status code of 8 (the "standard error exit").

Reported by:    markj
Sponsored by:   Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@331217 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r328834
marius [Mon, 19 Mar 2018 14:28:58 +0000 (14:28 +0000)]
MFC: r328834

o Let rtld(1) set up psABI user trap handlers prior to executing the
  objects' init functions instead of doing the setup via a constructor
  in libc as the init functions may already depend on these handlers
  to be in place. This gets us rid of:
  - the undefined order in which libc constructors as __guard_setup()
    and jemalloc_constructor() are executed WRT __sparc_utrap_setup(),
  - the requirement to link libc last so __sparc_utrap_setup() gets
    called prior to constructors in other libraries (see r122883).
  For static binaries, crt1.o still sets up the user trap handlers.
o Move misplaced prototypes for MD functions in to the MD prototype
  section of rtld.h.
o Sprinkle nitems().

git-svn-id: svn://svn.freebsd.org/base/stable/10@331206 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330792:
ae [Mon, 19 Mar 2018 09:54:16 +0000 (09:54 +0000)]
MFC r330792:
  Do not try to reassemble IPv6 fragments in "reass" rule.

  ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets
  that it gets. Until proper IPv6 fragments handling function will be
  implemented, pass IPv6 packets to next rule.

  PR: 170604

git-svn-id: svn://svn.freebsd.org/base/stable/10@331202 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329950:
kp [Sun, 18 Mar 2018 11:26:07 +0000 (11:26 +0000)]
MFC r329950:

pf: Cope with overly large net.pf.states_hashsize

If the user configures a states_hashsize or source_nodes_hashsize value we may
not have enough memory to allocate this. This used to lock up pf, because these
allocations used M_WAITOK.

Cope with this by attempting the allocation with M_NOWAIT and falling back to
the default sizes (with M_WAITOK) if these fail.

PR: 209475
Submitted by: Fehmi Noyan Isi <fnoyanisi AT yahoo.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@331117 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329279: add support for user-supplied Host-Uniq tag to ng_pppoe(4).
eugen [Fri, 16 Mar 2018 15:10:13 +0000 (15:10 +0000)]
MFC r329279: add support for user-supplied Host-Uniq tag to ng_pppoe(4).

Submitted by: ale
Approved by: mav (mentor)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9270

git-svn-id: svn://svn.freebsd.org/base/stable/10@331059 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327929
marius [Thu, 15 Mar 2018 23:02:52 +0000 (23:02 +0000)]
MFC: r327929

Use the correct revision specifier (EXT_CSD revision rather than
system specification version) for deciding whether the EXT_CSD
register includes the EXT_CSD_GEN_CMD6_TIME field.

Submitted by: Masanobu SAITOH

git-svn-id: svn://svn.freebsd.org/base/stable/10@331039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327355, r327926
marius [Thu, 15 Mar 2018 23:01:04 +0000 (23:01 +0000)]
MFC: r327355, r327926

- Don't allow userland to switch partitions; it's next to impossible
  to recover from that, especially when something goes wrong.
- When userland changes EXT_CSD, update the kernel copy before using
  relevant EXT_CSD bits in mmcsd_switch_part().

git-svn-id: svn://svn.freebsd.org/base/stable/10@331037 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327339, r327924
marius [Thu, 15 Mar 2018 22:58:34 +0000 (22:58 +0000)]
MFC: r327339, r327924

- There is no need to keep the tuning error and re-tuning interrupts
  enabled (though, no interrupt generation enabled for them) all the
  time as soon as (re-)tuning is supported; only enable them and let
  them generate interrupts when actually using (re-)tuning.
- Also disable all interrupts except SDHCI_INT_DATA_AVAIL ones while
  executing tuning and not just their signaling.
- Set the tuning error and re-tuning interrupt enable bits based on
  the SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag,
  i. e. only when (re-)tuning is actually used. Currently, this change
  makes no net difference, though.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327315
marius [Thu, 15 Mar 2018 22:51:13 +0000 (22:51 +0000)]
MFC: r327315

Add quirks for Intel Denverton eMMC 5.0 controllers.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331033 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r287805
marius [Thu, 15 Mar 2018 22:42:28 +0000 (22:42 +0000)]
MFC: r287805

Unconditionally build CTF tools in the bootstrap-tools phase of the build.

Stale CTF tools are a frequent source of DTrace issues, and they compile
quickly enough that the increase in build time is negligible.

Apart from what's described in the original commit message above, this
change also fixes building GENERIC kernels, i. e. kernel configurations
having "makeoptions WITH_CTF=1", when the host world has been built with
WITHOUT_CDDL.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it
avg [Thu, 15 Mar 2018 11:04:30 +0000 (11:04 +0000)]
MFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it

git-svn-id: svn://svn.freebsd.org/base/stable/10@330989 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322245,r329717: MFV r322242: 8373 TXG_WAIT in ZIL commit path
avg [Thu, 15 Mar 2018 11:00:55 +0000 (11:00 +0000)]
MFC r322245,r329717: MFV r322242: 8373 TXG_WAIT in ZIL commit path

MFC r322245: MFV r322242: 8373 TXG_WAIT in ZIL commit path
MFC r329717: MFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue

git-svn-id: svn://svn.freebsd.org/base/stable/10@330987 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330667: asmc: update temperature sensor name/description
emaste [Thu, 15 Mar 2018 00:44:34 +0000 (00:44 +0000)]
MFC r330667: asmc: update temperature sensor name/description

PR: 225911
Submitted by: Trev

git-svn-id: svn://svn.freebsd.org/base/stable/10@330961 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: 327314
marius [Wed, 14 Mar 2018 23:59:52 +0000 (23:59 +0000)]
MFC: 327314

With the advent of interrupt remapping, Intel has repurposed bit 11
(now: Interrupt_Index[15]) and assigned the previously reserved bits
55:48 (Interrupt_Index[14:0] goes into 63:49 while Destination Field
used 63:56 and bit 48 now is Interrupt_Format) in the IO redirection
tables (see the VT-d specification, "5.1.5.1 I/OxAPIC Programming").
Thus, when not using interrupt remapping, ensure that all previously
reserved bits in the high part of the RTEs are zero instead of doing
a read-modify-write for their Destination Field bits only.
Otherwise, on machines based on Apollo Lake and its derivatives such
as Denverton, typically some of the previously preserved bits remain
set after boot when not employing interrupt remapping. The result is
that INTx interrupts are not getting delivered.
Note: With an AMD IOMMU, interrupt remapping apparently bypasses the
IO APIC altogether.

Submitted by: loos (modulo comment)
Reviewed by: jhb (modulo comment)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330959 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoConvert pci_delete_child() to a bus_child_deleted() method.
jhb [Wed, 14 Mar 2018 19:04:40 +0000 (19:04 +0000)]
Convert pci_delete_child() to a bus_child_deleted() method.

Instead of providing a wrapper around device_delete_child() that the PCI
bus and child bus drivers must call explicitly, move the bulk of the logic
from pci_delete_child() into a bus_child_deleted() method
(pci_child_deleted()).  This allows PCI devices to be safely deleted via
device_delete_child().
- Add a bus_child_deleted method to the ACPI PCI bus which clears the
  device_t associated with the corresponding ACPI handle in addition to
  the normal PCI bus cleanup.
- Change cardbus_detach_card to call device_delete_children() and move
  CardBus-specific delete logic into a new cardbus_child_deleted() method.
- Use device_delete_child() instead of pci_delete_child() in the SRIOV code.
- Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which
  frees the OpenFirmware device info for each PCI device.

To preserve KBI, a pci_delete_child() function is left in place that
just calls device_delete_child().

PR: 226562
Requested by: dexuan

git-svn-id: svn://svn.freebsd.org/base/stable/10@330938 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329105: ppp(8): fix code producing debugging logs
eugen [Mon, 12 Mar 2018 17:37:38 +0000 (17:37 +0000)]
MFC r329105: ppp(8): fix code producing debugging logs

  ppp(8): fix code producing debugging logs

  Fix several cases when long buffer is copied to shorter one
  using snprintf that results in contents truncation and
  clobbering unsaved errno value and creation of misleading logs.

PR: 218517
Approved by: mav (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330805 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330409:
brooks [Mon, 12 Mar 2018 16:04:10 +0000 (16:04 +0000)]
MFC r330409:

Refer to SysV IPC permissions as numeric constants.

POSIX defines no macros for these permissions.

Also remove unneeded headers from synopsis.

PR: 225905
Reviewed by: wblock
Differential Revision: https://reviews.freebsd.org/D14461

git-svn-id: svn://svn.freebsd.org/base/stable/10@330801 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323314, r323338, r328849
asomers [Sat, 10 Mar 2018 04:17:01 +0000 (04:17 +0000)]
MFC r323314, r323338, r328849

r323314:
Audit userspace geom code for leaking memory to disk

Any geom class using g_metadata_store, as well as geom_virstor which
duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes
of userspace memory following the metadata block stored. This is most or all
geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath,
graid3, gshsec, gstripe, and geom_virstor).

PR: 222077 (comment #3)
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: des
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12269

r323338:
Fix information leak in geli(8) integrity mode

In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several
physical sectors (e.g., 512 bytes) on the backing device.  Due to hash
overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors.
This means that only 288 bytes (256 data + 32 hash) of the last 512 byte
sector are used.

The memory allocation used to store the encrypted data to be written to the
physical sectors comes from malloc(9) and does not use M_ZERO.

Previously, nothing initialized the final physical sector backing each
logical sector, aside from the hash + encrypted data portion.  So 224 bytes
of kernel heap memory was leaked to every block :-(.

This patch addresses the issue by initializing the trailing portion of the
physical sector in every logical sector to zeros before use.  A much simpler
but higher overhead fix would be to tag the entire allocation M_ZERO.

PR: 222077
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: emaste
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12272

r328849:
geom: don't write stack garbage in disk labels

Most consumers of g_metadata_store were passing in partially unallocated
memory, resulting in stack garbage being written to disk labels. Fix them by
zeroing the memory first.

gvirstor repeated the same mistake, but in the kernel.

Also, glabel's label contained a fixed-size string that wasn't
initialized to zero.

PR: 222077
Reported by: Maxim Khitrov <max@mxcrypt.com>
Reviewed by: cem
X-MFC-With: 323314
X-MFC-With: 323338
Differential Revision: https://reviews.freebsd.org/D14164

git-svn-id: svn://svn.freebsd.org/base/stable/10@330737 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329265, r329384
asomers [Sat, 10 Mar 2018 04:10:57 +0000 (04:10 +0000)]
MFC r329265, r329384

r329265:
Implement .vop_pathconf and .vop_getacl for the .zfs ctldir

zfsctl_common_pathconf will report all the same variables that regular ZFS
volumes report. zfsctl_common_getacl will report an ACL equivalent to 555,
except that you can't read xattrs or edit attributes.

Fixes a bug where "ls .zfs" will occasionally print something like:
ls: .zfs/.: Operation not supported

PR: 225793
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14365

r329384:
Handle generic pathconf attributes in the .zfs ctldir

MFC instructions: change the value of _PC_LINK_MAX to INT_MAX

Reported by: jhb
X-MFC-With: 329265
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@330736 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329067:
asomers [Sat, 10 Mar 2018 04:02:51 +0000 (04:02 +0000)]
MFC r329067:

Fix "zpool add" crash when a replacing vdev has a spare child

Fix an assertion in zpool that causes a crash when running any "zpool add"
command on a spare that contains a replacing vdev with a spare child.

This likely affects Illumos, too.

PR: 225546
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14138

git-svn-id: svn://svn.freebsd.org/base/stable/10@330735 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328011,329162
tychon [Sat, 10 Mar 2018 00:44:33 +0000 (00:44 +0000)]
MFC r328011,329162

r328011:

Provide some mitigation against CVE-2017-5715 by clearing registers
upon returning from the guest which aren't immediately clobbered by
the host.  This eradicates any remaining guest contents limiting their
usefulness in an exploit gadget.

r329162:

Provide further mitigation against CVE-2017-5715 by flushing the
return stack buffer (RSB) upon returning from the guest.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330713 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r285885 by brueffer:
emaste [Fri, 9 Mar 2018 17:59:22 +0000 (17:59 +0000)]
MFC r285885 by brueffer:

In tmpfs_chtimes(), remove checks on the nanosecond level when
determining whether a node changed.

Other filesystems, e.g., UFS, only check on seconds, when determining
whether something changed.

This also corrects the birthtime case, where we checked tv_nsec
twice, instead of tv_sec and tv_nsec (PR).

PR: 201284

git-svn-id: svn://svn.freebsd.org/base/stable/10@330700 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330245:
dab [Fri, 9 Mar 2018 14:45:47 +0000 (14:45 +0000)]
MFC r330245:

Allow the "@" and "!" characters in passwd file GECOS fields.

Two PRs (152084 & 210187) request allowing the "@" and/or "!"
characters in the passwd file GECOS field. The man page for pw does
not mention that those characters are disallowed, Linux supports those
characters in this field, and the "@" character in particular would be
useful for storing email addresses in that field.

PR:             152084, 210187
Submitted by:   jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reported by:    jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Sponsored by:   Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@330695 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330085:
dab [Fri, 9 Mar 2018 14:39:28 +0000 (14:39 +0000)]
MFC r330085:

dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP

When dhclient first starts, if an old IP address exists in the
dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s)
in an attempt to re-obtain the old IP address again. These messages
contain the old IP as a requested-IP-address option in the message
body (correct) but also use the old IP address as the packet's source
IP (incorrect).

RFC2131 sec 4.1 states:

  DHCP messages broadcast by a client prior to that client obtaining
  its IP address must have the source address field in the IP header
  set to 0.

The use of the old IP as the packet's source address is incorrect if
(a) the computer is now on a different network or (b) it is on the
same network, but the old IP has been reallocated to another host.

Fix dhclient to use 0.0.0.0 as the source IP in this circumstance
without removing any existing functionality. Any previously-used old
IP is still requested in the body of an early DHCPREQUEST message.

PR:             199378
Submitted by:   J.R. Oldroyd <fbsd@opal.com>
Reported by:    J.R. Oldroyd <fbsd@opal.com>
Sponsored by:   Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@330693 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330304: imcsmb(4): Intel integrated Memory Controller (iMC) SMBus
rpokala [Fri, 9 Mar 2018 02:55:27 +0000 (02:55 +0000)]
MFC r330304: imcsmb(4): Intel integrated Memory Controller (iMC) SMBus
controller driver

imcsmb(4) provides smbus(4) support for the SMBus controller functionality
in the integrated Memory Controllers (iMCs) embedded in Intel Sandybridge-
Xeon, Ivybridge-Xeon, Haswell-Xeon, and Broadwell-Xeon CPUs. Each CPU
implements one or more iMCs, depending on the number of cores; each iMC
implements two SMBus controllers (iMC-SMBs).

*** IMPORTANT NOTE ***
Because motherboard firmware or the BMC might try to use the iMC-SMBs for
monitoring DIMM temperatures and/or managing an NVDIMM, the driver might
need to temporarily disable those functions, or take a hardware interlock,
before using the iMC-SMBs. Details on how to do this may vary from board to
board, and the procedure may be proprietary. It is strongly suggested that
anyone wishing to use this driver contact their motherboard vendor, and
modify the driver as described in the manual page and in the driver itself.
(For what it's worth, the driver as-is has been tested on various SuperMicro
motherboards.)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330680 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330527:
brooks [Fri, 9 Mar 2018 01:21:22 +0000 (01:21 +0000)]
MFC r330527:

Use umtx_copyin_umtx_time32() in __umtx_op_lock_umutex_compat32().

Non-NULL timeouts where copied in improperly and could produce failures
due to incompatible data structures.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@330678 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330034
dab [Thu, 8 Mar 2018 17:14:16 +0000 (17:14 +0000)]
MFC r330034

Fix a memory leak in syslogd

A memory leak in syslogd for processing of forward actions was
reported. This modification adapts the patch submitted with that bug
to fix the leak.

PR: 198385
Submitted by: Sreeram <sreeramabs@yahoo.com>
Reported by: Sreeram <sreeramabs@yahoo.com>
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@330664 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFixup the AH patch to properly compile.
gordon [Wed, 7 Mar 2018 16:55:15 +0000 (16:55 +0000)]
Fixup the AH patch to properly compile.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330609 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument EN-18:01, EN-18:02, SA-18:01, SA-18:02.
gjb [Wed, 7 Mar 2018 15:02:13 +0000 (15:02 +0000)]
Document EN-18:01, EN-18:02, SA-18:01, SA-18:02.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@330605 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329714: MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks
avg [Wed, 7 Mar 2018 13:40:15 +0000 (13:40 +0000)]
MFC r329714: MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks

git-svn-id: svn://svn.freebsd.org/base/stable/10@330589 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316339,317396,317829,326010,329554: less v530.
delphij [Wed, 7 Mar 2018 06:39:00 +0000 (06:39 +0000)]
MFC r316339,317396,317829,326010,329554: less v530.

Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/10@330571 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoPort r329561 to stable/10. There were structural changes preventing MFC.
gordon [Wed, 7 Mar 2018 05:47:48 +0000 (05:47 +0000)]
Port r329561 to stable/10. There were structural changes preventing MFC.

Check packet length to not make an out of bounds access. Also, save ah_nxt
value to use later, since the ah pointer can become invalid.

Reviewed by: ae@
Approved by: so
Security: CVE-2018-6916
Security: FreeBSD-SA-18:01.ipsec

git-svn-id: svn://svn.freebsd.org/base/stable/10@330565 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329855
davidcs [Tue, 6 Mar 2018 23:17:56 +0000 (23:17 +0000)]
MFC r329855
  1. Added support to offline a port if is error recovery on successful.
  2. Sysctls to enable/disable driver_state_dump and error_recovery.
  3. Sysctl to control the delay between hw/fw reinitialization and
     restarting the fastpath.
  4. Stop periodic stats retrieval if interface has IFF_DRV_RUNNING flag off.
  5. Print contents of PEG_HALT_STATUS1 and PEG_HALT_STATUS2 on heartbeat
     failure.
  6. Speed up slowpath shutdown during error recovery.
  7. link_state update using atomic_store.
  8. Added timestamp information on driver state and minidump captures.
  9. Added support for Slowpath event logging
  10.Added additional failure injection types to simulate failures.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330556 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r324940:
asomers [Mon, 5 Mar 2018 20:43:43 +0000 (20:43 +0000)]
MFC r324940:

Fix the error message when creating a zpool on a too-small device

Don't check for SPA_MINDEVSIZE in vdev_geom_attach when opening by path.
It's redundant with the check in vdev_open, and failing to attach here
results in the wrong error message being printed.  However, still check for
it in some other situations:

* When opening by guids, so we don't get bogged down reading from slow
  devices like floppy drives.
* In vdev_geom_read_pool_label for the same reason, because we iterate over
  all providers.
* If the caller requests that we verify the guid, because then we'll have to
  read from the device before vdev_open verifies the size.

PR: 222227
Reported by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Reviewed by: avg, mav
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12531

git-svn-id: svn://svn.freebsd.org/base/stable/10@330524 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326401:
asomers [Mon, 5 Mar 2018 20:28:49 +0000 (20:28 +0000)]
MFC r326401:

Fix assertion when ZFS fails to open certain devices

"panic: vdev_geom_close_locked: cp->private is NULL"
This panic will result if ZFS fails to open a device due to either of the
following reasons:

1) The device's sector size is greater than 8KB.
2) ZFS wants to open the device RW, but it can't be opened for writing.

The solution is to change the initialization order to ensure that the
assertion will be satisfied.

PR: 221066
Reported by: David NewHamlet <wheelcomplex@gmail.com>
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13278

git-svn-id: svn://svn.freebsd.org/base/stable/10@330522 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r320726, r320727
asomers [Mon, 5 Mar 2018 19:02:32 +0000 (19:02 +0000)]
MFC r320726, r320727

r320726:
Expect :snprintf_float to segfault

This issue started occurring within the past month or so.

PR:   220502
Reported by:  Jenkins (amd64-head job)

r320727:
:snprintf_float: don't blindly set RLIMIT_DATA and RLIMIT_AS to 1 MB -- raise
the limit to 32MB instead.

Require user=root and memory=64MB+ first so one can be reasonably sure that
the test will function appropriately.

MFC with:     r320726
PR:   220502

git-svn-id: svn://svn.freebsd.org/base/stable/10@330520 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330027
dab [Mon, 5 Mar 2018 16:00:05 +0000 (16:00 +0000)]
MFC r330027

iconv uses strlen directly on user supplied memory

`iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the
size of user strings, such that several out of bounds reads could have
been possible.

static int
iconv_sysctl_add(SYSCTL_HANDLER_ARGS)
{
struct iconv_converter_class *dcp;
struct iconv_cspair *csp;
struct iconv_add_in din;
struct iconv_add_out dout;
int error;

error = SYSCTL_IN(req, &din, sizeof(din));
if (error)
return error;
if (din.ia_version != ICONV_ADD_VER)
return EINVAL;
if (din.ia_datalen > ICONV_CSMAXDATALEN)
return EINVAL;
if (strlen(din.ia_from) >= ICONV_CSNMAXLEN)
return EINVAL;
if (strlen(din.ia_to) >= ICONV_CSNMAXLEN)
return EINVAL;
if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN)
return EINVAL;
...

Since the `din` struct is directly copied from userland, there is no
guarantee that the strings supplied will be NULL terminated. The
`strlen` calls could continue reading past the designated buffer
sizes.

Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`:

struct iconv_add_in {
int ia_version;
char ia_converter[ICONV_CNVNMAXLEN];
char ia_to[ICONV_CSNMAXLEN];
char ia_from[ICONV_CSNMAXLEN];
int ia_datalen;
const void *ia_data;
};

Our strings are followed by the `ia_datalen` member, which is checked
before the `strlen` calls:

if (din.ia_datalen > ICONV_CSMAXDATALEN)

Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`),
this ensures that `din.ia_datalen` contains at least 1 byte of 0, so
it is not possible to trigger a read out of bounds of the `struct`
however, this code is fragile and could introduce subtle bugs in the
future if the `struct` is ever modified.

PR: 207302
Submitted by: CTurt <cturt@hardenedbsd.org>
Reported by: CTurt <cturt@hardenedbsd.org>
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@330512 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko
eugen [Mon, 5 Mar 2018 12:21:36 +0000 (12:21 +0000)]
MFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko
when kernel already has options MAC_PORTACL.

PR: 183817
Approved by: avg (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330500 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329930: route(8): make it possible to manually delete pinned route
eugen [Mon, 5 Mar 2018 12:06:41 +0000 (12:06 +0000)]
MFC r329930: route(8): make it possible to manually delete pinned route

Reported by: Andreas Longwitz <longwitz@incore.de>
Approved by: avg (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330498 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r325776:
bdrewery [Sun, 4 Mar 2018 23:36:58 +0000 (23:36 +0000)]
MFC r325776:

  Rework r325568 so all 'make LINT' targets work.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330428 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330127:
bdrewery [Sun, 4 Mar 2018 23:34:04 +0000 (23:34 +0000)]
MFC r330127:

  Allow overriding .MAKE.MAKEFILE_PREFERENCE.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330425 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329271:
bdrewery [Sun, 4 Mar 2018 23:31:25 +0000 (23:31 +0000)]
MFC r329271:

  nanosleep(2): Fix bogus incrementing of rmtp by tc_tick_sbt on [EINTR].

git-svn-id: svn://svn.freebsd.org/base/stable/10@330422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument SA-17:12 and correct EN-17:09 link [1]
delphij [Sat, 3 Mar 2018 08:52:02 +0000 (08:52 +0000)]
Document SA-17:12 and correct EN-17:09 link [1]

Reported by: eadler [1]

git-svn-id: svn://svn.freebsd.org/base/stable/10@330313 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 328608: Export tcp_always_keepalive for use by the Chelsio TOM module.
jhb [Sat, 3 Mar 2018 00:54:12 +0000 (00:54 +0000)]
MFC 328608: Export tcp_always_keepalive for use by the Chelsio TOM module.

This used to work by accident with ld.bfd even though always_keepalive
was marked as static. LLD honors static more correctly, so export this
variable properly (including moving it into the tcp_* namespace).

Relative to HEAD the MFC includes two additional changes:
- The t3_tom module used for cxgb(4) is also patched.
- A strong reference from the new name (tcp_always_keepalive) to the old
  name (always_keepalive) has been added to preserve the KBI for existing
  modules.

Suggested by: kib (strong reference)
Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@330303 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 329880.
mckusick [Fri, 2 Mar 2018 04:43:07 +0000 (04:43 +0000)]
MFC of 329880.

Add error number to "fsync: giving up on dirty" message.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330266 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330033:
gjb [Thu, 1 Mar 2018 16:41:37 +0000 (16:41 +0000)]
MFC r330033:
 Bump the size of virtual machine disk images from 20G to 30G,
 providing more space for a local buildworld to succeed without
 attaching separate disks for /usr/src and /usr/obj.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@330243 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329314: MFV r329313: 8857 zio_remove_child() panic due to already destroyed...
avg [Thu, 1 Mar 2018 10:57:50 +0000 (10:57 +0000)]
MFC r329314: MFV r329313: 8857 zio_remove_child() panic due to already destroyed parent zio

PR: 223803

git-svn-id: svn://svn.freebsd.org/base/stable/10@330238 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329711: MFV r329710: 8966 use after end of the lifetime of a local variable
avg [Thu, 1 Mar 2018 08:30:08 +0000 (08:30 +0000)]
MFC r329711: MFV r329710: 8966 use after end of the lifetime of a local variable

PR: 225162

git-svn-id: svn://svn.freebsd.org/base/stable/10@330234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330104: MFV r330102: ntp 4.2.8p11
delphij [Thu, 1 Mar 2018 04:06:49 +0000 (04:06 +0000)]
MFC r330104: MFV r330102: ntp 4.2.8p11

git-svn-id: svn://svn.freebsd.org/base/stable/10@330141 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 328630:
jhb [Wed, 28 Feb 2018 22:39:47 +0000 (22:39 +0000)]
MFC 328630:
Clarify that the additional arguments to makecontext() are of type int.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330133 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 328610: Ensure 'name' is not NULL before passing to strcmp().
jhb [Wed, 28 Feb 2018 22:33:07 +0000 (22:33 +0000)]
MFC 328610: Ensure 'name' is not NULL before passing to strcmp().

This avoids a nested page fault when obtaining a stack trace in DDB if
the address from the first frame does not resolve to a known symbol.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330132 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329843:
rpokala [Wed, 28 Feb 2018 10:00:02 +0000 (10:00 +0000)]
MFC r329843:

jedec_dimm(4): report asset info and temperatures for DDR3 and DDR4 DIMMs

A super-set of the functionality of jedec_ts(4). jedec_dimm(4) reports asset
information (Part Number, Serial Number) encoded in the "Serial Presence
Detect" (SPD) data on JEDEC DDR3 and DDR4 DIMMs. It also calculates and
reports the memory capacity of the DIMM, in megabytes. If the DIMM includes
a "Thermal Sensor On DIMM" (TSOD), the temperature is also reported.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330109 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329848:
pfg [Wed, 28 Feb 2018 02:49:48 +0000 (02:49 +0000)]
MFC r329848:
__printf_render_int(): small type change to match use.

Variable l is consistently used as an int rather than a char.
Sort names while here.

Obtained from: Apple's Libc-1244.30.3

git-svn-id: svn://svn.freebsd.org/base/stable/10@330097 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329846:
pfg [Wed, 28 Feb 2018 02:39:38 +0000 (02:39 +0000)]
MFC r329846:
getpeereid(3): Fix behavior on failure to match documentation.

According to the getpeereid(3) documentation, on failure the value -1 is
returned and the global variable errno is set to indicate the error. We
were returning the error instead.

Obtained from: Apple's Libc-1244.30.3

git-svn-id: svn://svn.freebsd.org/base/stable/10@330095 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329682:
rpokala [Wed, 28 Feb 2018 00:30:03 +0000 (00:30 +0000)]
MFC r329682:

mountd: Return proper errno values in a few error paths

When attempting to mount a non-directory which exists, return ENOTDIR
instead of ENOENT. If stat() or statfs() failed, don't pass part of the
invalid (struct statfs) to ex_search(). In that same case, preserve the
value of "bad" rather than overwriting with EACCES.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330093 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoAvoid using the C++11 auto keyword, which was introduced in r328555, as
dim [Tue, 27 Feb 2018 19:02:49 +0000 (19:02 +0000)]
Avoid using the C++11 auto keyword, which was introduced in r328555, as
part of an upstream change.  This is not supported by gcc 4.2.1, which
is still the default system compiler for some architectures.

Direct commit to stable/9 and stable/10, since this does not apply to
stable/11 and head.

Reported by: jau@iki.fi
PR: 202665,226068

git-svn-id: svn://svn.freebsd.org/base/stable/10@330080 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329556,r329820 remove an assert in zfsctl_snapdir_lookup to match r323578
avg [Tue, 27 Feb 2018 14:51:21 +0000 (14:51 +0000)]
MFC r329556,r329820 remove an assert in zfsctl_snapdir_lookup to match r323578

git-svn-id: svn://svn.freebsd.org/base/stable/10@330071 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329364: move vintr_intercept_enabled under INVARIANTS
avg [Tue, 27 Feb 2018 14:47:56 +0000 (14:47 +0000)]
MFC r329364: move vintr_intercept_enabled under INVARIANTS

git-svn-id: svn://svn.freebsd.org/base/stable/10@330069 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328996: exec_map_first_page: fix an inverse condition introduced in r254138
avg [Tue, 27 Feb 2018 14:45:55 +0000 (14:45 +0000)]
MFC r328996: exec_map_first_page: fix an inverse condition introduced in r254138

git-svn-id: svn://svn.freebsd.org/base/stable/10@330067 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329016: remove a duplicate assignment
avg [Tue, 27 Feb 2018 14:43:19 +0000 (14:43 +0000)]
MFC r329016: remove a duplicate assignment

git-svn-id: svn://svn.freebsd.org/base/stable/10@330065 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328881: zfs: move a utility function, ioflags, closer to its consumers
avg [Tue, 27 Feb 2018 14:41:35 +0000 (14:41 +0000)]
MFC r328881: zfs: move a utility function, ioflags, closer to its consumers

git-svn-id: svn://svn.freebsd.org/base/stable/10@330063 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328217: zfs: no need to check that size of zfs_cmd_t is not greater than IOCPARM_MAX
avg [Tue, 27 Feb 2018 14:23:43 +0000 (14:23 +0000)]
MFC r328217: zfs: no need to check that size of zfs_cmd_t is not greater than IOCPARM_MAX

git-svn-id: svn://svn.freebsd.org/base/stable/10@330059 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 328134: Update various statements in vmstat(8) to match reality.
jhb [Tue, 27 Feb 2018 01:28:19 +0000 (01:28 +0000)]
MFC 328134: Update various statements in vmstat(8) to match reality.

- The process stats are actually thread counts rather than process
  counts.
- Simplify various descriptions to remove mention of stats that are
  updated every 5 seconds (all VM related stats are now "instant",
  only the load average is updated every 5 seconds).
- Don't make any mention of special treatment for processes that have
  been active in the last 20 seconds.  We don't track that stat.
- Rework the description of active virtual memory.  Call it mapped
  virtual memory and explicitly point out it is not the same as the
  active page queue (which corresponds to "Active" in top(1)), and
  also hint at the possible bogusness of the value (e.g. if a process
  maps a single page out of a multiple GB file, the entire file's size
  is considered mapped).
- Simplify a few descriptions that implied their output was a value
  per interval.  All of the "rate" values are per-second rates scaled
  across the interval.
- Update a few comments for 'struct vmtotal' along similar lines.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330047 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329195:
hselasky [Mon, 26 Feb 2018 07:57:56 +0000 (07:57 +0000)]
MFC r329195:
Add new USB quirk.

PR: 225844
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@330014 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix for LINT-{NOINET,NOINET6,NOIP} kernel builds.
hselasky [Sun, 25 Feb 2018 11:29:55 +0000 (11:29 +0000)]
Fix for LINT-{NOINET,NOINET6,NOIP} kernel builds.

This is a direct commit.

Reported by: rpokala@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@329982 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix after incomplete MFC r326012: correctly delete loopback route
eugen [Sat, 24 Feb 2018 16:50:57 +0000 (16:50 +0000)]
Fix after incomplete MFC r326012: correctly delete loopback route
while removing interface address.

Reported by: Andreas Longwitz <longwitz@incore.de>
Approved by: avg (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@329913 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 329749.
mckusick [Fri, 23 Feb 2018 23:07:41 +0000 (23:07 +0000)]
MFC of 329749.

Fix a read past the end of a buffer in fsck.

git-svn-id: svn://svn.freebsd.org/base/stable/10@329883 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323508:
rpokala [Fri, 23 Feb 2018 16:46:49 +0000 (16:46 +0000)]
MFC r323508:

When doing a non-interactive installation, don't display an interactive
warning about a filesystem which doesn't have a mountpoint. Presumably, the
person who wrote the install script knew what they were doing.

git-svn-id: svn://svn.freebsd.org/base/stable/10@329870 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix for LINT kernel build.
hselasky [Thu, 22 Feb 2018 20:48:02 +0000 (20:48 +0000)]
Fix for LINT kernel build.

This is a direct commit.

Discussed with: np@
Reported by: rpokala@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@329838 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix for LINT-NOINET kernel build.
hselasky [Thu, 22 Feb 2018 20:09:21 +0000 (20:09 +0000)]
Fix for LINT-NOINET kernel build.

This is a direct commit.

Reported by: rpokala@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@329835 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329295:
rpokala [Thu, 22 Feb 2018 19:40:03 +0000 (19:40 +0000)]
MFC r329295:

Panasas discovered that ioctl(SIOCGLAGGPORT) returns ENOTTY for mxge(4) when
the NIC is not a member of a lagg. This came as a surprise, because the
SIOCGLAGGPORT handler in if_lagg.c only returns ENOENT (if run against the
laggX interface, rather than a physical port) or EINVAL (if run against a
non-member physical port). This behavior was not seen with other drivers,
such as bge(4), igb(4), and cxl(4). When I compared their respective ioctl
handlers, I found that they all called ether_ioctl() for the default (i.e.
unhandled) case; by contrast, mxge(4) only calls ether_ioctl() for two
specific cases, and returns ENOTTY for the default case.

Remove the two cases which explicitly call ether_ioctl(), and let the
default case call it instead. This matches what the vast majority of the NIC
drivers do.

git-svn-id: svn://svn.freebsd.org/base/stable/10@329834 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329525:
brooks [Wed, 21 Feb 2018 18:32:57 +0000 (18:32 +0000)]
MFC r329525:

Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids).

The description of kern.ipc.shmsegs was wrong since 2005.  I updated the
others (which were more correct) to match.

PR: 225933
Reviewed by: cem
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14391

git-svn-id: svn://svn.freebsd.org/base/stable/10@329741 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329254:
kib [Wed, 21 Feb 2018 11:31:29 +0000 (11:31 +0000)]
MFC r329254:
Ensure memory consistency on COW.

git-svn-id: svn://svn.freebsd.org/base/stable/10@329707 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328864 (Synaptics part only):
wulf [Sun, 18 Feb 2018 22:12:20 +0000 (22:12 +0000)]
MFC r328864 (Synaptics part only):

psm(4): Fix panic occuring soon after PS/2 packet has been rejected by
synaptics sanity checker.

After packet has been rejected contents of packet buffer is not cleared
with setting of inputbytes counter to 0. So when this packet buffer is
filled again being an element of circular queue, new data appends to old
data rather than overwrites it. This leads to packet buffer overflow
after 10 rounds.

Fix it with setting of packet's inputbytes counter to 0 after rejection.

While here add extra logging of rejected packets.

PR: 222667 (for reference)
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>

git-svn-id: svn://svn.freebsd.org/base/stable/10@329533 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328622: vmm/svm: post LAPIC interrupts using event injection
avg [Thu, 15 Feb 2018 17:10:42 +0000 (17:10 +0000)]
MFC r328622: vmm/svm: post LAPIC interrupts using event injection

PR: 215972

git-svn-id: svn://svn.freebsd.org/base/stable/10@329321 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing
avg [Thu, 15 Feb 2018 16:31:35 +0000 (16:31 +0000)]
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected.  A new disk(9) flag is added to mark write protected
disks.  A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page.  We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037

git-svn-id: svn://svn.freebsd.org/base/stable/10@329319 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328163:
hselasky [Thu, 15 Feb 2018 08:57:14 +0000 (08:57 +0000)]
MFC r328163:
Add new USB ID to U3G driver.

PR: 134299
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@329304 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328830:
hselasky [Thu, 15 Feb 2018 08:52:58 +0000 (08:52 +0000)]
MFC r328830:
Add new USB ID.

PR: 225641
Submitted by: Ryan <ryanwinter@outlook.com>
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@329302 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328591:
hselasky [Thu, 15 Feb 2018 08:48:04 +0000 (08:48 +0000)]
MFC r328591:
Move the mlx5 core device pointer first in the mlx5en priv. This help simplify
checks to recognize own network devices when using mlx5ib. This patch fixes
an issues where mlx5ib fails to recognize mceX network devices for use with
RoCE.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@329300 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328876:
ae [Mon, 12 Feb 2018 13:52:58 +0000 (13:52 +0000)]
MFC r328876:
  Modify ip6_get_prevhdr() to be able use it safely.

  Instead of returning pointer to the previous header, return its offset.
  In frag6_input() use m_copyback() and determined offset to store next
  header instead of accessing to it by pointer and assuming that the memory
  is contiguous.

  In rip6_input() use offset returned by ip6_get_prevhdr() instead of
  calculating it from pointers arithmetic, because IP header can belong
  to another mbuf in the chain.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@329158 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328895: Correct Russia spelling in regdomain.xml
emaste [Sat, 10 Feb 2018 22:36:42 +0000 (22:36 +0000)]
MFC r328895: Correct Russia spelling in regdomain.xml

PR: 225658

git-svn-id: svn://svn.freebsd.org/base/stable/10@329113 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agojedec_ts(4) uses a sysctl format specifier of "IK4", to indicate that it
rpokala [Thu, 8 Feb 2018 09:24:23 +0000 (09:24 +0000)]
jedec_ts(4) uses a sysctl format specifier of "IK4", to indicate that it
reports milliKelvin. However, sysctl(8) on stable/10 only knows about "IK",
without a numeric suffix, which represents deciKelvin.

Adjust the format specifier, and round the temperature value reported.

Reviewed by: avg
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D14055

git-svn-id: svn://svn.freebsd.org/base/stable/10@329015 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328412: vt: add Ctrl+/ key mapping
emaste [Thu, 8 Feb 2018 00:42:02 +0000 (00:42 +0000)]
MFC r328412: vt: add Ctrl+/ key mapping

This matches Xorg's handling of Ctrl+/ and may be useful as a tmux
escape.

PR: 212197
Submitted by: martin at sugioarto.com

git-svn-id: svn://svn.freebsd.org/base/stable/10@329006 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoAdjust MFC in r328946 to stable/10.
mckusick [Wed, 7 Feb 2018 22:50:10 +0000 (22:50 +0000)]
Adjust MFC in r328946 to stable/10.
This is a direct commit to the branch.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328997 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 328647.
mckusick [Tue, 6 Feb 2018 19:17:40 +0000 (19:17 +0000)]
MFC of 328647.

avoid segment fault in g_journal

git-svn-id: svn://svn.freebsd.org/base/stable/10@328948 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 328643.
mckusick [Tue, 6 Feb 2018 19:14:53 +0000 (19:14 +0000)]
MFC of 328643.

fix vn_printf listing of its union

git-svn-id: svn://svn.freebsd.org/base/stable/10@328946 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 328304 and 328382.
mckusick [Tue, 6 Feb 2018 19:09:49 +0000 (19:09 +0000)]
MFC of 328304 and 328382.

Do not dedup egid (group entry 0)

git-svn-id: svn://svn.freebsd.org/base/stable/10@328943 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328273 (kevlo): Document how to load nmdm(4) from a kernel module.
delphij [Tue, 6 Feb 2018 07:50:30 +0000 (07:50 +0000)]
MFC r328273 (kevlo): Document how to load nmdm(4) from a kernel module.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328770:
ae [Mon, 5 Feb 2018 09:25:53 +0000 (09:25 +0000)]
MFC r328770:
  Merge r1.120 from NetBSD:
    Fix a pretty simple, yet pretty tragic typo: we should return IPPROTO_DONE,
    not IPPROTO_NONE. With IPPROTO_NONE we will keep parsing the header chain
    on an mbuf that was already freed.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@328878 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323683:
eadler [Mon, 5 Feb 2018 08:50:34 +0000 (08:50 +0000)]
MFC r323683:

MFV r323678: file 5.32

git-svn-id: svn://svn.freebsd.org/base/stable/10@328875 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327775: amdsbwd: fix handling of timeout values beyond the supported range
avg [Sun, 4 Feb 2018 13:58:29 +0000 (13:58 +0000)]
MFC r327775: amdsbwd: fix handling of timeout values beyond the supported range

git-svn-id: svn://svn.freebsd.org/base/stable/10@328845 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327726: vmm/svm: contigmalloc of the whole svm_softc is excessive
avg [Sun, 4 Feb 2018 13:54:43 +0000 (13:54 +0000)]
MFC r327726: vmm/svm: contigmalloc of the whole svm_softc is excessive

git-svn-id: svn://svn.freebsd.org/base/stable/10@328842 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFH r328332:
mm [Sat, 3 Feb 2018 02:17:25 +0000 (02:17 +0000)]
MFH r328332:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

git-svn-id: svn://svn.freebsd.org/base/stable/10@328828 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 328444.
mckusick [Fri, 2 Feb 2018 01:28:14 +0000 (01:28 +0000)]
MFC of 328444.

Eliminate "fsync: giving up on dirty" messages.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328765 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328623:
hselasky [Thu, 1 Feb 2018 13:16:11 +0000 (13:16 +0000)]
MFC r328623:
Properly implement the cond_resched() function macro in the LinuxKPI.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@328656 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328497:
pfg [Thu, 1 Feb 2018 02:00:36 +0000 (02:00 +0000)]
MFC r328497:
pfctl(8): Fix two wrong conditions.

Caught by gcc80's -Wtautological-compare option.

MFC after: 5 days
Reviewed by: kp
Obtained from: DragonFlyBSD (git e3cdbf6c)

git-svn-id: svn://svn.freebsd.org/base/stable/10@328649 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328350:
ae [Wed, 31 Jan 2018 09:26:28 +0000 (09:26 +0000)]
MFC r328350:
  Merge revision 1.35 from NetBSD:
    fix pointer/offset mistakes in handling of IPv4 options

  Reported by:  Maxime Villard <maxv at NetBSD.org>

MFC r328352:
  Adopt revision 1.76 and 1.77 from NetBSD:
    Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely
    crash the kernel with a single packet.

    In this loop we need to increment 'ad' by two, because the length field
    of the option header does not count the size of the option header itself.

    If the length is zero, then 'count' is incremented by zero, and there's
    an infinite loop. Beyond that, this code was written with the assumption
    that since the IPv6 packet already went through the generic IPv6 option
    parser, several fields are guaranteed to be valid; but this assumption
    does not hold because of the missing '+2', and there's as a result a
    triggerable buffer overflow (write zeros after the end of the mbuf,
    potentially to the next mbuf in memory since it's a pool).

    Add the missing '+2', this place will be reinforced in separate commits.

  Reported by:  Maxime Villard <maxv at NetBSD.org>

git-svn-id: svn://svn.freebsd.org/base/stable/10@328621 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 327561:
jhb [Mon, 29 Jan 2018 23:43:04 +0000 (23:43 +0000)]
MFC 327561:
Report offset relative to the backing object for kinfo_vmentry structures.

For the pathname reported in kinfo_vmentry structures (kve_path), the
sysctl handlers walk the object chain to find the bottom-most VM object.
This permits a COW mapping of a file with dirty pages to report the
pathname of the originally mapped file.  Do the same for the object
offset (kve_offset) computing a cumulative offset during the same object
walk so that the reported offset is relative to the reported pathname.

Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset
rather than the raw offset of the VM map entry.

Note also that this does not affect procstat -v output (even structured
output) since that output does not include the kve_offset field.

Sponsored by: DARPA / AFRL

git-svn-id: svn://svn.freebsd.org/base/stable/10@328571 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoRevert a local change and sync. with head. No functional change.
jkim [Mon, 29 Jan 2018 18:21:50 +0000 (18:21 +0000)]
Revert a local change and sync. with head.  No functional change.

Note this is a direct commit because head has OpenSSL 1.0.2.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328557 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoPull in r217197 from upstream clang trunk (by Richard Smith):
dim [Mon, 29 Jan 2018 18:11:27 +0000 (18:11 +0000)]
Pull in r217197 from upstream clang trunk (by Richard Smith):

  PR20844: If we fail to list-initialize a reference, map to the
  referenced type before retrying the initialization to produce
  diagnostics. Otherwise, we may fail to produce any diagnostics, and
  silently produce invalid AST in a -Asserts build. Also add a note to
  this codepath to make it more clear why we were trying to create a
  temporary.

This should fix assertions when parsing some forms of incomplete list
intializers.

Direct commit to stable/9 and stable/10, since stable/11 and head
already have this upstream fix.

Reported by: ajcbowhill@gmail.com
PR: 202665

git-svn-id: svn://svn.freebsd.org/base/stable/10@328555 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f