]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFC r311572, r311895, r311928, r311985, r312395, r312417
asomers [Tue, 28 Feb 2017 22:49:41 +0000 (22:49 +0000)]
MFC r311572, r311895, r311928, r311985, r312395, r312417

r311572:
Fix file descriptor leaks in cmp(1)

Also, add a few test cases

Reported by: Coverity
CID: 271624 275338
Reviewed by: ngie
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9074

r311895:
Fix memory leaks during "tail -r" of an irregular file

* Rewrite r_buf to use standard tail queues instead of a hand-rolled
  circular linked list. Free dynamic allocations when done.
* Remove an optimization for the case where the file is a multiple of 128KB
  in size and there is a scarcity of memory.
* Add ATF tests for "tail -r" and its variants.

Reported by: Valgrind
Reviewed by: ngie
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9067

r311928:
Fix build of usr.bin/tail with GCC

Submitted by: pluknet
Reported by: pluknet
MFC after: 27 days
X-MFC-with: 311895
Sponsored by: Spectra Logic Corp

r311985:
Fix uninitialized variable CIDs in route6d

The variables in question are actually return arguments, but it's still good
form to initialize them.

Reported by: Coverity
CID: 979679 979680
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

r312395:
Fix several Coverity CIDs in devd

CID 13620551362054: File descriptor leaks during shutdown
CID 1362013: Potential null-termination fail with long network device names
CID 1362097: Uncaught exception during memory pressure
CID 13620171362016: Unchecked errors, possibly resulting in weird behavior
if two devd instances start at the same time.
CID 1362015: Unchecked error that will probably never fail

Reported by: Coverity
CID: 1362055 1362054 1362013 1362097 1362017 1362016 1362015
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

r312417:
Fix build of devd with GCC 4.2

Reported by: olivier
Pointy-hat-to: asomers
MFC after: 27 days
X-MFC-with: 312395
Sponsored by: Spectra Logic Corp

7 years agoMFC r313734:
kib [Tue, 28 Feb 2017 14:48:52 +0000 (14:48 +0000)]
MFC r313734:
Add RLIM_SAVED_MAX and RLIM_SAVED_CUR symbols.

7 years agoMFC r313751: mca: fix writes to MSR_MC_CTL2 in cmci_update
avg [Tue, 28 Feb 2017 11:41:57 +0000 (11:41 +0000)]
MFC r313751: mca: fix writes to MSR_MC_CTL2 in cmci_update

7 years agoMFC r313949: Remove dead mentions of CAM target mode APIs from drivers.
mav [Tue, 28 Feb 2017 06:46:41 +0000 (06:46 +0000)]
MFC r313949: Remove dead mentions of CAM target mode APIs from drivers.

This makes grepping kernel for target mode implementation much easier.

7 years agoMFC r313744: No need to erase sense_data when sense_len is set to zero.
mav [Tue, 28 Feb 2017 06:31:34 +0000 (06:31 +0000)]
MFC r313744: No need to erase sense_data when sense_len is set to zero.

7 years agoMFC r313739: Directly call m_gethdr() instead of m_getm2() for BHS.
mav [Tue, 28 Feb 2017 06:30:42 +0000 (06:30 +0000)]
MFC r313739: Directly call m_gethdr() instead of m_getm2() for BHS.

All this code is based on assumption that data will be stored in one piece,
and since buffer size if known and fixed, it is easier to hardcode it.

7 years agoMFC r313731: Do not rely on data alignment after m_pullup().
mav [Tue, 28 Feb 2017 06:29:44 +0000 (06:29 +0000)]
MFC r313731: Do not rely on data alignment after m_pullup().

In general case m_pullup() does not really guarantee any data alignment.
Instead of depenting on side effects caused by data being always copied
out of mbuf cluster (which is probably a bug by itself), always allocate
aligned BHS buffer and read data there directly from socket.

While there, reuse new icl_conn_receive_buf() function to read digests.
The code could probably be even more optimized to aggregate those reads,
but until that done, this is still easier then the way it was before.

7 years agoMFC r313738: Temporary attach AHS to BHS to calculate header digest.
mav [Tue, 28 Feb 2017 06:28:17 +0000 (06:28 +0000)]
MFC r313738: Temporary attach AHS to BHS to calculate header digest.

7 years agoMFC r314244:
ngie [Tue, 28 Feb 2017 00:57:45 +0000 (00:57 +0000)]
MFC r314244:

Remove MK_OBJC block

It is no longer represented via src.conf(5)

7 years agoMFC r313712:
gonzo [Mon, 27 Feb 2017 22:53:25 +0000 (22:53 +0000)]
MFC r313712:

[sdhci_acpi] Add support for Bay Trail SDHC SD card slot

Add ACPI device 80860F14 with _UID 3 to the list of known devices. It
make SD card available on NUCs and Minnowboard. Previously added _UID 1
covered only eMMC devices.

Reported by: kib@

7 years agoMFC r310645:
gonzo [Mon, 27 Feb 2017 20:50:21 +0000 (20:50 +0000)]
MFC r310645:

[intelspi] Add SPI driver for Intel BayTrail SoC

Add SPI mode (PIO-only) support for Intel Synchronous Serial Port that
can be found in several Intel's products starting from PXA family.
Most of implementations have slight differences in behavior and in
addresses for registers subset. This driver covers only BayTrail SoC
implementation for it's the only hardware I have to test it on.

Driver attaches to ACPI bus only and does not have PCI or FDT support
for now due to lack of hardware to test it on.

"intelspi" is the best name I've managed to come up with. Linux driver
name (spi-pxa2xx) does not make sense because current implementation
does not support actual PXA2xx SoCs. And as far as I know there is no
codename assigned to Intel SSP chip.

Reviewed by: br, manu
Differential Revision: https://reviews.freebsd.org/D8896

7 years agoMFC r313757:
gonzo [Mon, 27 Feb 2017 19:51:27 +0000 (19:51 +0000)]
MFC r313757:

[psm] Fix calculation for clickpad softbuttons at the top

On laptops like the ThinkPad X240, ClickPad buttons are located at the
top. The hw.psm.synaptics.softbuttons_y sysctl was supposed to allow this
by setting the value to a negative one (e.g. -1700). However, the
condition was wrong (double negative), and doing that placed the buttons
in an unreachable area.

PR: 216342
Submitted by: Greg V <greg@unrelenting.technology>

7 years agoMFC r314059: zfs: move zio_taskq_basedc under SYSDC
avg [Mon, 27 Feb 2017 17:27:23 +0000 (17:27 +0000)]
MFC r314059: zfs: move zio_taskq_basedc under SYSDC

7 years agoMFC r314183: add jedec_ts.4 to the list of manual pages
avg [Mon, 27 Feb 2017 17:25:52 +0000 (17:25 +0000)]
MFC r314183: add jedec_ts.4 to the list of manual pages

7 years agoMFC r314037: jedec_ts: fix slave address check
avg [Mon, 27 Feb 2017 17:24:01 +0000 (17:24 +0000)]
MFC r314037: jedec_ts: fix slave address check

7 years agoMFC r313752,r314035: mca: use time_uptime instead of ticks for CMCI throttling
avg [Mon, 27 Feb 2017 17:20:44 +0000 (17:20 +0000)]
MFC r313752,r314035: mca: use time_uptime instead of ticks for CMCI throttling

7 years agoMFC r313730: try to fix RACCT_RSS accounting
avg [Mon, 27 Feb 2017 17:18:05 +0000 (17:18 +0000)]
MFC r313730: try to fix RACCT_RSS accounting

7 years agoMFC kern_mmap(9) and related helpers.
kib [Mon, 27 Feb 2017 11:27:46 +0000 (11:27 +0000)]
MFC kern_mmap(9) and related helpers.

MFC r302514 (by rwatson):
Audit file-descriptor arguments to I/O system calls such as
read(2), write(2), dup(2), and mmap(2).

MFC r302524 (by rwatson):
When mmap(2) is used with a vnode, capture vnode attributes in the
audit trail.

MFC r313352 (by trasz):
Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), kern_vm_munlock(),
kern_vm_munmap(), and kern_vm_madvise().

MFC r313655:
Change type of the prot parameter for kern_vm_mmap() from vm_prot_t to int.

MFC r313696:
Rework r313352.

7 years agoMFC r314120: Reset failed login count to zero when removing a blocked address
lidl [Mon, 27 Feb 2017 04:08:08 +0000 (04:08 +0000)]
MFC r314120: Reset failed login count to zero when removing a blocked address

The blacklistd daemon keeps records of failed login attempts for
each address:port that is flagged as a failed login.  When a
successful login occurs for that address:port combination,
the record's last update time is set to zero, to indicate no current
failed login attempts.

Reset the failed login count to zero, so that at the next failed
login attempt, the counting will restart properly at zero.  Without
this reset to zero, the first failed login after a successful login
will cause the address to be blocked immediately.

When debugging is turned on, output more information about database
state before and after the database updates have occured.

A similar patch has already been upstreamed to NetBSD.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r314111: Improve ipfw rule creation for blacklist-helper script
lidl [Mon, 27 Feb 2017 04:05:34 +0000 (04:05 +0000)]
MFC r314111: Improve ipfw rule creation for blacklist-helper script

When blocking an address, the blacklist-helper script
needs to do the following things for the ipfw packet
filter:

 - create a table to hold the addresses to be blocked,
   so lookups can be done quickly, and place the address
   to be blocked in that table
 - create rule that does the lookup in the table and
   blocks the packet

The ipfw system allows multiple rules to be inserted for
a given rule number.  There only needs to be one rule
to do the lookup per port.  Modify the script to probe
for the existence of the rule before attempting to create
it, so only one rule is inserted, rather than one rule per
blocked address.

PR: 214980
Reported by: azhegalov (at) gmail.com
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9681

7 years agoMFC r313707: Remove M_PKTHDR from m_getm2() in icl_pdu_append_data().
mav [Mon, 27 Feb 2017 03:52:32 +0000 (03:52 +0000)]
MFC r313707: Remove M_PKTHDR from m_getm2() in icl_pdu_append_data().

ip_data_mbuf is always appended to ip_bhs_mbuf, so it does not need own
packet header.  This change first avoids allocation/initialization of the
header, and then avoids dropping one when it later gets to socket buffer.

7 years agoMFC r313960
alc [Sun, 26 Feb 2017 18:17:12 +0000 (18:17 +0000)]
MFC r313960
  In pmap_enter(), set the PG_MANAGED flag on the new PTE in one place,
  rather two places, and do so before the pmap lock is acquired.

7 years agoMFC r313967:
kib [Sun, 26 Feb 2017 11:02:14 +0000 (11:02 +0000)]
MFC r313967:
Apply noexec mount option for mmap(PROT_EXEC).

PR: 217062

7 years agoMFC r313688:
kib [Sun, 26 Feb 2017 10:58:01 +0000 (10:58 +0000)]
MFC r313688:
Switch copyout_map() to use vm_mmap_object() instead of vm_mmap().

7 years agoMFC r313933, r313939, r313966:
kib [Sun, 26 Feb 2017 10:53:02 +0000 (10:53 +0000)]
MFC r313933, r313939, r313966:
Microoptimize pmap_protect_pde() on amd64, i386 and
pmap_protect_pte1() on armv6.

7 years agoDisable the driver managed queue for igb(4) when the legacy transmit
loos [Sat, 25 Feb 2017 20:21:39 +0000 (20:21 +0000)]
Disable the driver managed queue for igb(4) when the legacy transmit
interface is used.

The legacy API (IGB_LEGACY_TX) is enabled when ALTQ is built into kernel.

As noted in altq(9), it is responsibility of the caller to protect this
queue against concurrent access and, in the igb case, the interface send
queue is protected by tx queue mutex.  This obviously cannot protect the
driver managed queue against concurrent access from different tx queues
and leads to numerous and quite strange panic traces (usually shown as
packets disappearing into thin air).

Improving the locking to cope with this means serialize all access to this
(single) queue and produces no gain, it actually affects the performance
quite noticeabily.

The driver managed queue is already disabled when an ALTQ queue discipline
is set on interface (in altq_enable()), because the driver managed queue
can interfere with ALTQ timing (whence the reports that setting an ALTQ
queue discipline on interface also fixes the issue).

Disabling this additional queue keeps the ability to use if_start() to
send packets to individual NIC queues while it simply eliminate the race.

This is a direct commit to stable/11 as -head driver does not support ALTQ
anymore.

PR: 213257
PR: 212413
Discussed with: sbruno
Tested by: Konstantin Kormashev <konstantin@netgate.com>
Obtained from: pfSense
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoMFC r313961:
bapt [Sat, 25 Feb 2017 19:39:58 +0000 (19:39 +0000)]
MFC r313961:

Update pci_vendors to 2017.02.15

7 years agoMFC r313953:
bapt [Sat, 25 Feb 2017 19:31:14 +0000 (19:31 +0000)]
MFC r313953:

Import libucl 20170219

7 years agoMFC r312787:
cy [Sat, 25 Feb 2017 08:07:28 +0000 (08:07 +0000)]
MFC r312787:

Currently the fragment info is placed at the top of the linked list
under a shared read lock. This patch attempts to upgrade the lock to
an exclusive write lock. If the exclusive write lock fails to be
obtained, the current fragment is not placed at the head of the list.

This portion of the patch was inspired by NetBSD ip_frag.c r1.4 (which
effectively removed the section of code that performed the reordering).

The patch to sys/contrib/ipfilter/netinet/ip_compat.h adds the
MUTEX_TRY_UPGRADE macro to support the patch to ip_frag.c.

The patch to contrib/ipfilter/lib/rwlock_emul.c supports this patch
by emulating the mutex in userspace when exercised by ipftest(1).

Inspired by: NetBSD ip_frag.c r1.4

7 years agoMFC r313910: Change XCOPY memory allocations.
mav [Sat, 25 Feb 2017 01:52:07 +0000 (01:52 +0000)]
MFC r313910: Change XCOPY memory allocations.

Before this change XCOPY code could allocate memory in chunks up to 16-32MB
(VMware does XCOPY in 4MB chunks by default), that could be difficult for
VM subsystem to do due to KVA fragmentation, that sometimes created huge
allocation delays, blocking any I/O for respective LU for that time.

This change limits allocations down to TPC_MAX_IO_SIZE, which is 1MB now.
1MB is also not a cookie, but ZFS also can do that for large blocks, so
it should be less dramatic.  As drawback this increases CPU overhead, but
it still look acceptable comparing to time consumed by ZFS read/write.

7 years agoMFC r313924,r313925:
ngie [Sat, 25 Feb 2017 00:42:17 +0000 (00:42 +0000)]
MFC r313924,r313925:

r313924:

Quote path to doxygen/kyua in test(1) -x check

This is a basic stopgap against ${LOCALBASE} containing spaces in it

r313925:

Include ${LOCALBASE}/bin in $PATH when running "make checkworld"

Some of the tests in devel/atf // devel/kyua rely on the tools being in $PATH,
which means that the tests fail when run via "make checkworld" because $PATH
is restricted to exclude directory elements like "${LOCALBASE}/bin".

7 years agoMFC r313897:
pfg [Fri, 24 Feb 2017 21:35:53 +0000 (21:35 +0000)]
MFC r313897:
ext2fs: Remove unused assignment.

The value is re-assigned a few lines later without being read.

Found by: Clang static analyzer

7 years agoMFC r313554:
pfg [Fri, 24 Feb 2017 21:20:48 +0000 (21:20 +0000)]
MFC r313554:
Clean redundant MIN/MAX declarations in some HighPoint drivers.

The hpt27xx(4), hptnr(4), and hptrr(4) drivers declare MIN() and MAX()
internally which match the macros from sys/param.h.

MIN() is not used, MAX is only used once and can be replaced with the
max() version in libkern.h which operates on u_ints.

MFC after: 2 weeks

7 years agoMFC r313906:
avos [Fri, 24 Feb 2017 21:19:40 +0000 (21:19 +0000)]
MFC r313906:
iwi, ral, zyd: fix possible use-after-free.

7 years agoMFC r313893
ken [Fri, 24 Feb 2017 20:47:56 +0000 (20:47 +0000)]
MFC r313893

  ------------------------------------------------------------------------
  r313893 | ken | 2017-02-17 13:04:22 -0700 (Fri, 17 Feb 2017) | 48 lines

  Add task attribute support to camcontrol(8).

  Users can use the new generic argument, -Q task_attr, to specify a task
  attribute (simple, ordered, head of queue, aca) for the commands issued.
  The the default is simple, which works with all SCSI devices that support
  tagged queueing.

  This will mostly be useful for debugging target behavior in certain
  situations.

  You can try it out by compiling CTL with CTL_IO_DELAY turned on (in
  sys/cam/ctl/ctl_io.h) and then do something like this with one of the CTL
  LUNs:

  ctladm delay 0:0 -l done -t 10
  camcontrol tur da34 -v

  And at then before the 10 second timer is up, in another terminal:

  camcontrol inquiry da34 -Q ordered -v

  The Inquiry should complete just after the TUR completes.  Ordinarily
  it would complete first because of the delay injection, but because the
  task attribute is set to ordered in this case, CTL holds it up until the
  previous command has completed.

  sbin/camcontrol/camcontrol.c:
   Add the new generic argument, -Q, which allows the user to specify
   a SCSI task attribute.  The user can specify task attributes by
   name or numerically.

   Add a new task_attr arguments to SCSI sub-functions.

  sbin/camcontrol/attrib.c,
  sbin/camcontrol/camcontrol.h,
  sbin/camcontrol/fwdownload.c,
  sbin/camcontrol/modeedit.c,
  sbin/camcontrol/persist.c,
  sbin/camcontrol/timestamp.c,
  sbin/camcontrol/zone.c:
   Add the new task_attr argument to SCSI sub-functions.

  sbin/camcontrol/camcontrol.8:
   Document the new -Q option, and add an example.

  Sponsored by: Spectra Logic

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

7 years agoMFC r313154:
kib [Fri, 24 Feb 2017 16:02:01 +0000 (16:02 +0000)]
MFC r313154:
For i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSE
and device npx.

7 years agoMFC r313871
royger [Fri, 24 Feb 2017 10:20:13 +0000 (10:20 +0000)]
MFC r313871

x86: fix MTRR initialization if EARLY_AP_STARTUP is used

Sponsored by: Citrix Systems R&D

7 years agoMFC r313800:
kib [Thu, 23 Feb 2017 09:55:55 +0000 (09:55 +0000)]
MFC r313800:
Do not access memory past the buffer end.
Do not accept and silently truncate too long hostname.

7 years agoMFC r313799:
kib [Thu, 23 Feb 2017 09:52:22 +0000 (09:52 +0000)]
MFC r313799:
Do not allocate char[MNAMELEN] on stack in nfsclient.

7 years agoMFC r313495:
kib [Thu, 23 Feb 2017 09:41:32 +0000 (09:41 +0000)]
MFC r313495:
Do not establish advisory locks when doing open(O_EXLOCK) or open(O_SHLOCK)
for files which do not have DTYPE_VNODE type.

MFC r313549:
Fix r313495.

7 years agoMFC r313496:
kib [Thu, 23 Feb 2017 09:30:37 +0000 (09:30 +0000)]
MFC r313496:
Increase a chance of devfs_close() calling d_close cdevsw method.

7 years agoMFC r313798:
kib [Thu, 23 Feb 2017 07:42:49 +0000 (07:42 +0000)]
MFC r313798:
Use uintmax_t to print st_nlink.

7 years agoMFC r313494:
kib [Thu, 23 Feb 2017 07:39:01 +0000 (07:39 +0000)]
MFC r313494:
Handle protected symbols in rtld.

7 years agoMFC r313493:
kib [Thu, 23 Feb 2017 07:28:29 +0000 (07:28 +0000)]
MFC r313493:
Define ELF_ST_VISIBILITY().

7 years agoMFC r313284:
dchagin [Wed, 22 Feb 2017 19:57:59 +0000 (19:57 +0000)]
MFC r313284:

  Update syscall.master to 4.10-rc6. Also fix comments, a typo,
  and wrong numbering for a few unimplemented syscalls.

  For 32-bit Linuxulator, socketcall() syscall was historically
  the entry point for the sockets API. Starting in Linux 4.3, direct
  syscalls are provided for the sockets API. Enable it.

  The initial version of patch was provided by trasz@ and extended by me.

MFC r313285:

  Regen after r313284.

MFC r313684:

  Fix r313284.

  Members of the syscall argument structures are padded to a word size. So,
  for COMPAT_LINUX32 we should convert user supplied system call arguments
  which is 32-bit in that case to the array of register_t.

MFC r313912:

  Finish r313684.

  Convert linux_recv(), linux_send() and linux_accept() system call arguments
  to the register_t type too.

7 years agoMFC: r311979
marius [Wed, 22 Feb 2017 17:57:19 +0000 (17:57 +0000)]
MFC: r311979

Reset the EIAC register to include the LINK status bit and restore
link up/down notifications.

7 years agoMFC r313771
royger [Wed, 22 Feb 2017 08:49:52 +0000 (08:49 +0000)]
MFC r313771

bxe: enable usage with NetXtreme II BCM57840 2x20GbE chip

Sponsored by:   Citrix Systems R&D

7 years agoMFC 312689, 312690
dexuan [Wed, 22 Feb 2017 08:37:51 +0000 (08:37 +0000)]
MFC 312689, 312690

Approved by: sephe (mentor)

r312689
    hyperv/hn: add a sysctl name for the VF interface

    This makes it easier for the userland script to find the releated
    VF interface.

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D9101

r312690
    hyperv/hn: add devctl_notify for VF_UP/DOWN events

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D9102

7 years agoMFC 312688
dexuan [Wed, 22 Feb 2017 08:26:51 +0000 (08:26 +0000)]
MFC 312688

Approved by: sephe (mentor)

r312688
    hyperv/hn: add the support for VF drivers (SR-IOV)

    Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and
    a VF NIC to work together (both NICs have the same MAC address), mainly to
    support seamless live migration.

    When the VF device becomes UP (or DOWN), the synthetic NIC driver needs
    to switch the data path from the synthetic NIC to the VF (or the opposite).

    Note: multicast/broadcast packets are still received through the synthetic
    NIC and we need to inject the packets through the VF interface (if the VF is
    UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter
    to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP).

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D8964

7 years agoMFC: 312687, 312916
dexuan [Wed, 22 Feb 2017 08:02:24 +0000 (08:02 +0000)]
MFC: 312687, 312916

Approved by:    sephe (mentor)

r312687
    ifnet: introduce event handlers for ifup/ifdown events

    Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and
    a VF NIC to work together, mainly to support seamless live migration.

    When the VF device becomes UP (or DOWN), the synthetic NIC driver needs
    to switch the data path from the synthetic NIC to the VF (or the opposite).

    So the synthetic NIC driver needs to know when a VF device is becoming
    UP or DOWN and hence the patch is made.

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D8963

r312916
    ifnet: move the new ifnet_event EVENTHANDLER_DECLARE to net/if_var.h

    Thank glebius for pointing this out:
    "The network stuff shall not be added to sys/eventhandler.h"

    Reviewed by: David_A_Bright_DELL.com, sephe, glebius
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D9345

7 years agorevert the MFC r314085
dexuan [Wed, 22 Feb 2017 07:42:28 +0000 (07:42 +0000)]
revert the MFC r314085

Sorry, I generated a wrong commit log for r314085 due to a copy&pasate mistake.
Let me revert it and I'll redo the MFC.

7 years agoMFC: 312687, 312688
dexuan [Wed, 22 Feb 2017 06:26:50 +0000 (06:26 +0000)]
MFC: 312687, 312688

Approved by: sephe (mentor)

r312687
    ifnet: introduce event handlers for ifup/ifdown events

    Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and
    a VF NIC to work together, mainly to support seamless live migration.

    When the VF device becomes UP (or DOWN), the synthetic NIC driver needs
    to switch the data path from the synthetic NIC to the VF (or the opposite).

    So the synthetic NIC driver needs to know when a VF device is becoming
    UP or DOWN and hence the patch is made.

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D8963

r312688
    hyperv/hn: add the support for VF drivers (SR-IOV)

    Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and
    a VF NIC to work together (both NICs have the same MAC address), mainly to
    support seamless live migration.

    When the VF device becomes UP (or DOWN), the synthetic NIC driver needs
    to switch the data path from the synthetic NIC to the VF (or the opposite).

    Note: multicast/broadcast packets are still received through the synthetic
    NIC and we need to inject the packets through the VF interface (if the VF is
    UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter
    to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP).

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D8964

7 years agoMFC: 312686
dexuan [Wed, 22 Feb 2017 06:12:33 +0000 (06:12 +0000)]
MFC: 312686

Approved by: sephe (mentor)

r312686
    hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt()

    It's unnecessary because the upper nework stack does the same checking.

    In the case of Hyper-V SR-IOV, we need to remove the checking because
    1) multicast/broadcast packets are still received through the synthetic
    NIC and we need to inject the packets through the VF interface;
    2) we must inject the packets even if the synthetic NIC is down, or has
    a different MTU from the VF device.

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D8962

7 years agoMFC: 312685
dexuan [Wed, 22 Feb 2017 06:06:58 +0000 (06:06 +0000)]
MFC: 312685

Approved by: sephe(mentor)

r312685
    hyperv/hn: remember the channel pointer in struct hn_rx_ring

    This will be used by the coming NIC SR-IOV patch.

    Reviewed by: sephe
    Approved by: sephe (mentor)
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D8909

7 years agoMFC r313965:
lidl [Wed, 22 Feb 2017 04:15:39 +0000 (04:15 +0000)]
MFC r313965:

Only notify blacklistd for successful logins in auth.c

Before this change, every pass through auth.c resulted in a
call to blacklist_notify().

In a normal remote login, there would be a failed login flagged for
the printing of the "xxx login:" prompt, before the remote user
could enter a password.

If the user successfully entered a good password, then a good login
would be flagged, and everything would be OK.

If the user entered an incorrect password, there would be another
failed login flagged in auth1.c (or auth2.c) for the actual bad
password attempt.  Finally, when sshd got around to issuing the
second "xxx login:" prompt, there would be yet another failed login
notice sent to blacklistd.

So, if there was a 3 bad logins limit set (the default), the system
would actually block the address after the first bad password attempt.

Reported by: Rick Adams
Reviewed by: des
Sponsored by: The FreeBSD Foundation

7 years agoMFC r313261:
markj [Wed, 22 Feb 2017 00:50:36 +0000 (00:50 +0000)]
MFC r313261:
Make witness_warn() always print to the console.

7 years agoMFC r313745:
garga [Tue, 21 Feb 2017 12:51:45 +0000 (12:51 +0000)]
MFC r313745:

* Add missing parameters to usage()
* Add missing parameters to manpage synopsis
* Add missing description of -d flag
* Sort flags descriptions

Reviewed by: allanjude, kib
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9152

7 years agoMFC r313737:
garga [Tue, 21 Feb 2017 12:45:56 +0000 (12:45 +0000)]
MFC r313737:

Fix style(9)

Reviewed by: allanjude, vangyzen
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9510

7 years agoMFC r313735: add svcpool_close to handle killed nfsd threads
avg [Tue, 21 Feb 2017 09:29:11 +0000 (09:29 +0000)]
MFC r313735: add svcpool_close to handle killed nfsd threads

PR: 204340
Reported by: Panzura
Approved by: rmacklem
Obtained from: rmacklem

7 years agoMFC r313687: remove l2_padding_needed statistic from zfs arc
avg [Tue, 21 Feb 2017 09:13:34 +0000 (09:13 +0000)]
MFC r313687: remove l2_padding_needed statistic from zfs arc

7 years agoMFC r313686: check remaining space in zfs implementations of vptocnp
avg [Tue, 21 Feb 2017 08:57:28 +0000 (08:57 +0000)]
MFC r313686: check remaining space in zfs implementations of vptocnp

PR: 216939

7 years agoMFC r313736: Fix panic on shutdown of ramdisk LU with zero capacity.
mav [Tue, 21 Feb 2017 05:12:42 +0000 (05:12 +0000)]
MFC r313736: Fix panic on shutdown of ramdisk LU with zero capacity.

7 years agoMFC r313713:
ngie [Tue, 21 Feb 2017 03:49:52 +0000 (03:49 +0000)]
MFC r313713:

Handle clang 4.x+ with the compile-time exception added in r312213

It also fails the assertions noted in bug 208703

PR: 208703
PR: 217084

7 years agoMFC r313404:
ngie [Tue, 21 Feb 2017 03:46:43 +0000 (03:46 +0000)]
MFC r313404:

Improve libnetbsd compatibility with NetBSD

This change is being made to diff reduce/reduce duplication in
contrib/netbsd-tests and to facilitate further porting of software from
NetBSD

Add the following headers:
- sys/event.h:
-- sys/types.h is required for kqueue on FreeBSD, but not NetBSD.
- sys/types.h:
-- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD.
   Pull in sys/param.h to have parity with NetBSD.
- sys/wait.h:
-- Define wrusage as __wrusage for parity with NetBSD typedef.
- glob.h
-- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef.
- pthread.h:
-- Pull in pthread_np.h for _np functions defined separately on FreeBSD.

Improve compatibility with NetBSD in the following headers:

- sha1.h:
-- define SHA1_CTX as SHA_CTX
-- define SHA1Final as SHA1_Final
- sha2.h:
-- #include sha384 to pick up all of the SHA 384 bit macros and definitions.
- util.h:
-- Add sys/types.h to util.h to pollute the header for types used in
   flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them
   for the functions.

7 years agoMFC r313652:
ngie [Tue, 21 Feb 2017 02:35:16 +0000 (02:35 +0000)]
MFC r313652:

Use SRCTOP instead of .CURDIR relative paths with ".."

This simplifies pathing in make/displayed output

7 years agoMFC r313654:
ngie [Tue, 21 Feb 2017 02:33:28 +0000 (02:33 +0000)]
MFC r313654:

Use SRCTOP to refer to awk source in contrib/awk and remove unnecessary AWKSRC prefix
for maketab.c

The former simplifies pathing in make/displayed output, whereas the latter was just
unnecessarily superfluous since .PATH referenced the path to maketab.c earlier on in
the Makefile.

7 years agoMFC r313679:
ngie [Tue, 21 Feb 2017 02:30:26 +0000 (02:30 +0000)]
MFC r313679:

Use SRCTOP/OBJTOP relative paths where possible; use :H manipulation in lieu
of ../ elsewhere

This simplifies pathing in make/displayed output

7 years agoMFC r313650:
ngie [Tue, 21 Feb 2017 02:26:57 +0000 (02:26 +0000)]
MFC r313650:

Use SRCTOP/OBJTOP and simplify output using :H instead of "../" for directory
entries

This simplifies pathing in make/displayed output

7 years agoMFC r313653:
ngie [Tue, 21 Feb 2017 02:24:45 +0000 (02:24 +0000)]
MFC r313653:

Use SRCTOP instead of .CURDIR relative paths with ".."

This simplifies pathing in make/displayed output

7 years agoMFC r313656:
ngie [Tue, 21 Feb 2017 02:23:57 +0000 (02:23 +0000)]
MFC r313656:

Use SRCTOP to define .include with usr.bin/Makefile.inc

7 years agoMFC 312250
sephe [Tue, 21 Feb 2017 02:19:19 +0000 (02:19 +0000)]
MFC 312250

    alc: Add Killer E2500 support

    Reviewed by:    jhb, yongari
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9058

7 years agoMFC 311743
sephe [Tue, 21 Feb 2017 02:15:58 +0000 (02:15 +0000)]
MFC 311743

    hyperv: Add method to read 64bit Hyper-V specific time value.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9057

7 years agoMFC 311475
sephe [Tue, 21 Feb 2017 02:10:02 +0000 (02:10 +0000)]
MFC 311475

    if: Defer the if_up until the ifnet.if_ioctl is called.

    This ensures the interface is initialized by the interface driver
    before it can be used by the rest of the system.

    Reviewed by:    jhb, karels, gnn
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8905

7 years agoMFC 313895:
ken [Mon, 20 Feb 2017 20:12:02 +0000 (20:12 +0000)]
MFC 313895:

  ------------------------------------------------------------------------
  r313895 | ken | 2017-02-17 13:15:27 -0700 (Fri, 17 Feb 2017) | 9 lines

  Make ctl(4) build with CTL_IO_DELAY defined.

  sys/cam/ctl/ctl.c:
   In ctl_datamove(), inside CTL_IO_DELAY, add a lun variable and fill
   it in before trying to dereference it.

  Sponsored by: Spectra Logic

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

7 years agoMFC r313693:
kib [Mon, 20 Feb 2017 10:49:04 +0000 (10:49 +0000)]
MFC r313693:
Remove MPSAFE and ARGUSED annotations, ANSI-fy syscall handlers.

7 years agoMFC r313345:
kib [Mon, 20 Feb 2017 10:44:24 +0000 (10:44 +0000)]
MFC r313345:
Update arm and arm64 counters MD bits.

MFC r313394 (by manu):
subr_sfbus.c need sys/proc.h for struct thread definition.

7 years agoMFC r312997, r313002:
pfg [Mon, 20 Feb 2017 03:33:59 +0000 (03:33 +0000)]
MFC r312997, r313002:
Re-import libedit 2016-02-27 and update libedit with changes from NetBSD's
2016-03-21.

Obtained from: NetBSD

7 years agoMFC r312992:
pfg [Mon, 20 Feb 2017 03:26:19 +0000 (03:26 +0000)]
MFC r312992:
MFV r312970, 313160:
openresolv: update to version 3.9.0.

It is now possible to drop the _WITH_ARG vars thanks to a change to the
pdns_recursor upstreamed by Guy Yur.

7 years agoMFC r313819:
pfg [Sun, 19 Feb 2017 21:08:10 +0000 (21:08 +0000)]
MFC r313819:
Remove outdated claim.

Despite wishful thinking the removal of these old functions hasn't
happened yet.

7 years agoMFC r313867, r313869-r313870
bapt [Sun, 19 Feb 2017 17:35:14 +0000 (17:35 +0000)]
MFC r313867, r313869-r313870

r313867:
Add history and Authors section in the manpage

Submitted by: dteske
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D9419

r313869:
Also add vsevolod@ in the authors

r313870:
Use full name for the month

Reported by: brueffer

7 years agoMFC r313797:
kib [Sun, 19 Feb 2017 03:11:14 +0000 (03:11 +0000)]
MFC r313797:
Minor style fixes.

7 years agoMFC r313572,313782
mm [Sat, 18 Feb 2017 21:58:56 +0000 (21:58 +0000)]
MFC r313572,313782
Sync libarchive with vendor.

MFC r313572:
  Vendor bugfixes:
    cpio reader sanity fix (OSS-Fuzz 504)
    WARC reader sanity fixes (OSS-Fuzz 511, 526, 532, 552)
    mtree reader time parsing fix (OSS-Fuzz 538)
    XAR reader memleak fix (OSS-Fuzz 551)

MFC r313782:
  Vendor changes:
    Make SCHILY.acl.ace header more compact (NFSv4 ACLs)

  Vendor bugfixes:
    zip reader integer parsing fix (OSS-Fuzz 556)
    spelling fixes (issue #863)

7 years agoMFC r313694:
avos [Sat, 18 Feb 2017 19:19:08 +0000 (19:19 +0000)]
MFC r313694:
iwi: add 12-14 2GHz channels into channel list.

Return full channel list via iwi_getradiocaps() method
(ieee80211_init_channels() was replaced with iwi_getradiocaps()
to be consistent with other drivers).

PR: 216923
Submitted and tested by: ds@ukrhub.net (original patch)

7 years agoMFC r313659-r313673
bapt [Fri, 17 Feb 2017 11:20:55 +0000 (11:20 +0000)]
MFC r313659-r313673

r313659:
Remove space at and of line

Reported by: make manlint
MFC after: 2 days

r313660:
Remove empty Li

Reported by: make manlint
MFC after: 2 days

r313661:
Escape Ss to avoid confusion by mdoc parser with the Ss macro

Reported by: make manlint
MFC after: 2 days

r313662:
Add missing -width after -Bl -tag

Reported by: make manlint
MFC after: 2 days

r313663:
Add missing section after .Xr reference

r313664:
Escape No to avoid confusion with the No macro

r313665:
Remove useless .Pp after the .Sh macro and remove empty line

r313666:
Remove empty space at EOL and escept Ed

r313667:
Remove spaces at EOL and sort correctly the SEE ALSO section

r313668:
Add missing section in manpage reference

r313669:
Properly use .An macro before Authors name

r313670:
Escape Sm to avoid confusion with Sm macro

r313671:
Use correct date format

r313672:
Remove useless Li macro

r313673:
Remove spaces at end of line

Reported by: make manlint

7 years agoMFC r312952:
jah [Fri, 17 Feb 2017 07:08:37 +0000 (07:08 +0000)]
MFC r312952:

Implement get_pcpu() for i386 and use it to replace pcpu_find(curcpu)
in the i386 pmap.

The curcpu macro loads the per-cpu data pointer as its first step,
so the remaining steps of pcpu_find(curcpu) are circular.

7 years agoMFC r313133:
markj [Fri, 17 Feb 2017 00:50:00 +0000 (00:50 +0000)]
MFC r313133:
Sync the x86 dis_tables.c with upstream.

7 years agoMFC r313563: kldxref: bump MAXSEGS to 3
emaste [Fri, 17 Feb 2017 00:46:16 +0000 (00:46 +0000)]
MFC r313563: kldxref: bump MAXSEGS to 3

ld.bfd generates two PT_LOAD segments, but certain linkers or linker
configurations generate three PT_LOAD segments (one additional for
RELRO).

PR: 216975

7 years agoMFC r313562: kldxref: s/sections/segments/ in warning message
emaste [Fri, 17 Feb 2017 00:44:48 +0000 (00:44 +0000)]
MFC r313562: kldxref: s/sections/segments/ in warning message

The message refers to program header segments, not sections.

PR: 216975

7 years agoMFC r313715:
kib [Fri, 17 Feb 2017 00:36:12 +0000 (00:36 +0000)]
MFC r313715:
Order alphabetically.

7 years agoMFC r311702
grehan [Thu, 16 Feb 2017 17:07:20 +0000 (17:07 +0000)]
MFC r311702
  Use correct PCI device id for virtio-rng.
  This prevented the device from attaching with a
  Windows guest (most other guests use the device type
  for matching)

  PR:   212711

7 years agoMFC r313477:
garga [Thu, 16 Feb 2017 09:12:36 +0000 (09:12 +0000)]
MFC r313477:

Cleanup on usr.sbin/arp/arp.c

* 'blackhole' and 'reject' are mutually exclusive, replace printf() by errx()
  when both are selected.
* 'trail' option is no longer supported since first import of arp from 4.4BSD.
  XXX message was added 13 years ago in r128192. I believe it's time to remove
  it.
* Use warnx() to print some informative messages instead of printf()
* Replace strncmp() by strcmp() when validating parameters and exit when invalid
  parameter is found

Reviewed by: allanjude, vangyzen, cem
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9504

7 years agoMFC r311285,312335: zlib 1.2.11.
delphij [Thu, 16 Feb 2017 06:16:23 +0000 (06:16 +0000)]
MFC r311285,312335: zlib 1.2.11.

7 years agoMFC r313692:
kib [Thu, 16 Feb 2017 05:57:58 +0000 (05:57 +0000)]
MFC r313692:
Style: wrap long line.

7 years agoMFC r313162: Replace Cyrillic characters with Latin (normal) ones.
wblock [Wed, 15 Feb 2017 16:55:24 +0000 (16:55 +0000)]
MFC r313162: Replace Cyrillic characters with Latin (normal) ones.

7 years agoMFC r313458: lld: Allow arbitrary code alignment in .eh_frame
emaste [Wed, 15 Feb 2017 15:18:43 +0000 (15:18 +0000)]
MFC r313458: lld: Allow arbitrary code alignment in .eh_frame

According to the specification, CIE code alignment factor is an
arbitrary unsigned LEB128 encoded value.

PR: 216908

7 years agoMFC r312610, r312792
jah [Wed, 15 Feb 2017 10:35:46 +0000 (10:35 +0000)]
MFC r312610, r312792

r312610:
 Like r310481 for i386, move the objects used to create temporary
 mappings for armv6 pmap zero and copy operations to the MD PCPU region.
 Change sysmap initialization to only allocate KVA pages for CPUs that
 are actually present.

 While here, collapse CMAP3 into CMAP2 (their use was mutually exclusive
 anyway) and "recover" some space in PCPU padding that has always been
 available due to 64-byte cacheline padding.

r312792:
 Further cleanup of per-CPU armv6 pmap data:

 - Replace pcpu_find(curcpu) with get_pcpu(), which is much more direct.

 - Remove armv4 pcpu fields which I added in r286296 but never needed
   to use.

 - armv6 pc_qmap_addr was leftover from the old armv6 pmap
   implementation.  Rename it and put it to use in the new one.

7 years agoMFC r313457:
garga [Wed, 15 Feb 2017 08:49:28 +0000 (08:49 +0000)]
MFC r313457:

Fix style(9)

Reviewed by: vangyzen, allanjude, cem
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9494

7 years agoMFC r313448:
garga [Wed, 15 Feb 2017 08:43:26 +0000 (08:43 +0000)]
MFC r313448:

bsdinstall: Make sure chroot filesystems are umounted after use

* DISTDIR_IS_UNIONFS is set every time BSDINSTALL_DISTDIR is mounted inside
  BSDINSTALL_CHROOT. Use this flag to decide if it needs to be umounted
* BSDINSTALL_CHROOT/dev is mounted when 'bsdinstall mount' is called, there is
  no need to mount it again when user goes to shell after installation

Reviewed by: allanjude
Obtained from: pfSense
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D8573

7 years agoMFC r311893, r313008, r313081
asomers [Wed, 15 Feb 2017 00:15:24 +0000 (00:15 +0000)]
MFC r311893, r313008, r313081

r311893:
ATFify the geom gate tests.

This ensures their cleanup routines will be run even if they should timeout.

tests/sys/geom/class/gate/ggate_test.sh
tests/sys/geom/class/gate/Makefile
Add an ATF test with three testcases, one for each TAP test. Use
ATF-style cleanup functions, and convert sleeps to polling loops.

ObsoleteFiles.inc
tests/sys/geom/class/gate/conf.sh
tests/sys/geom/class/gate/1_test.sh
tests/sys/geom/class/gate/2_test.sh
tests/sys/geom/class/gate/3_test.sh
Delete TAP test files

Reviewed by: ngie
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8891

r313008:
Wait for /dev/ggate* to appear after calling `ggatel create` in :ggatel_{file,md}

The test assumed that `ggatel create` created a device on completion, but that's
incorrect. This squashes the race by waiting for the device to appear, as
`ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called
with `-v`.

Discussed with: asomers
MFC after: 1 week
PR: 204616
Sponsored by: Dell EMC Isilon

r313081:
Replace for/retry loops with "wait_for_ggate_device" calls and check
results of commands

As noted in r313008, the underlying issue was that geom_gate device
creation wasn't created at ggatel command completion, but some short
time after. ggatec(8) employs similar logic when creating geom_gate(4)
devices.

Switch from retry loops (after the ggatec/dd write calls) to
wait_for_ggate_device function calls after calling ggatec(8) instead
to detect the presence of the /dev/ggate* device, as this function is
sufficient for determining whether or not the character device is ready
for testing

While here, use atf_check consistently with all dd calls to ensure that
data output is as expected.

MFC after: 1 week
Reviewed by: asomers
Differential Revision: D9409
Sponsored by: Dell EMC Isilon

7 years agoMFC r311349, r311445
asomers [Tue, 14 Feb 2017 21:02:17 +0000 (21:02 +0000)]
MFC r311349, r311445

r311349:
tabs -> spaces in etc/mtree

MFC after: 4 weeks

r311445:
Fix typo from r311349

Reported by: lwhsu
Pointy-hat-to: asomers
MFC after: 4 weeks
X-MFC-with: 311349