]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFC r311103, r311907:
ian [Thu, 2 Mar 2017 01:23:17 +0000 (01:23 +0000)]
MFC r311103, r311907:

  Update ntp.conf to use the ntpd pool feature.

  Our previous ntp.conf file configured 3 servers from freebsd.pool.ntp.org
  using 3 separate 'server' config lines.  That is now replaced with a single
  'pool' line which causes ntpd to add multiple servers from the pool.

  More than just making the config smaller, the pool feature in ntpd has one
  major advantage over configuring 3 separate servers from a pool: if a server
  that was added using a 'pool' statement provides bad time (initially or at
  some later date), ntpd automatically discards it and configures a new
  different server from the pool without needing to be restarted.

  These changes also add a 'tos' line to control how many pool servers get
  added, a 'restrict source' line that is required to allow ntpd to add new
  peers from the pool, and it deletes a 'restrict 127.127.1.0' line that does
  nothing and should never have been there (127.127.1.0 is not a valid IP
  address, it's a refclock identifier).

  Add "pool" to the keywords that rc.d/ntpdate examines to
  find a server address in ntp.conf.

7 years agoMFC r312292, r313573:
ian [Thu, 2 Mar 2017 01:18:46 +0000 (01:18 +0000)]
MFC r312292, r313573:

  Stop including sys/types.h from arm's machine/atomic.h, fix the places
  where atomic.h was being included without ensuring that types.h (via
  param.h) was included first, as required by atomic(9).

  Remove arm's cpuconf.h, and references to it, after moving a few lines from
  it into pmap-v4.h where they are used.  Other than those few lines of
  support for different MMU types, nothing in cpuconf.h has been used in our
  code for quite a while.
  The file existed to set up a variety of symbols to describe the
  architecture.  Over the past few years we have converted all of our source
  to use the new architecture symbols standardized by ARM Inc, and predefined
  by both clang and gcc.

7 years agoMFC r312251:
ian [Wed, 1 Mar 2017 23:35:40 +0000 (23:35 +0000)]
MFC r312251:

  Remove a bit of armv6 support that didn't get deleted when this file was
  split from trap.c into trap-v4.c and trap-v6.c.

7 years agoMFC r306901:
ian [Wed, 1 Mar 2017 22:45:12 +0000 (22:45 +0000)]
MFC r306901:

  ARM: Split identify_arm_cpu() into ARMv4 and ARMv6 variant.
  On ARMv6, be more verbose about supported CPU features and/or
  optional instructions.

7 years agoMFC r309195:
ian [Wed, 1 Mar 2017 21:48:15 +0000 (21:48 +0000)]
MFC r309195:

  Add an ethernet0 alias pointing to the /aix/usb/hub/ethernet node.  This
  is required for u-boot to locate the ethernet node when it's doing fixup
  of the mac-address property when the user has overridden the default addr.

7 years agoMFC r302506:
ian [Wed, 1 Mar 2017 21:45:03 +0000 (21:45 +0000)]
MFC r302506:

  Remove HZ=<various> from all armv6 configs, put HZ=1000 in std.armv6.

7 years agoMFC r313919: Add dtb files for Boundary Devices Nitrogen 6 family boards.
ian [Wed, 1 Mar 2017 21:31:44 +0000 (21:31 +0000)]
MFC r313919:  Add dtb files for Boundary Devices Nitrogen 6 family boards.

7 years agoMFC r313918: Add definitions for the IEEE-1588 registers.
ian [Wed, 1 Mar 2017 21:20:28 +0000 (21:20 +0000)]
MFC r313918:  Add definitions for the IEEE-1588 registers.

7 years agoMFC r313917:
ian [Wed, 1 Mar 2017 21:19:46 +0000 (21:19 +0000)]
MFC r313917:

  Change the naming of imx{5,6} gpio pins to exactly match the names used in
  the reference manual.

7 years agoMFC r314064, r314060:
ian [Wed, 1 Mar 2017 21:18:42 +0000 (21:18 +0000)]
MFC r314064, r314060:

  Fix typos in bootverbose printfs... display the write-protect pin info,
  not the card-detect pin info.

  Remove a variable that has been unused since r311735 (it should have been
  removed as part of those changes).

7 years agoMFC r313674:
ian [Wed, 1 Mar 2017 21:12:50 +0000 (21:12 +0000)]
MFC r313674:

  Enable usb low and full speed devices connected to the imx6 root hubs.

7 years agoMFC r312859:
ian [Wed, 1 Mar 2017 21:11:36 +0000 (21:11 +0000)]
MFC r312859:

 Configure the timer capture pin to input mode in the timer control
 register, in addition to configuring it as input with the pinmux driver.

 There was a control register bit commented as "no desc in datasheet".  A
 later revision of the manual reveals the bit to be an input/output control
 for the timer pin.  In addition to configuring capture or pulse mode, you
 apparently have to separately configure the pin direction in the timer
 control register.

 Before this change, the timer block was apparently driving a signal onto a
 pad configured by pinmux as input.  Capture mode still accidentally worked
 for me during testing because I was using a very strong signal source that
 just out-muscled the weaker drive from the misconfigured pin.

7 years agoMFC r311736:
ian [Wed, 1 Mar 2017 21:05:24 +0000 (21:05 +0000)]
MFC r311736:

  Use the new sdhci_fdt_gpio helper functions to add full support for FDT
  gpio pins for detecting card insert/remove and write protect.

7 years agoMFC r308186, r308188, r308231, r308232:
ian [Wed, 1 Mar 2017 21:02:26 +0000 (21:02 +0000)]
MFC r308186, r308188, r308231, r308232:

  Move imx_sdhci driver over to a dev/sdhci in preparation for QorIQ support.
  Freescale uses eSDHC in both i.MX (ARM) and QorIQ (PowerPC), with slight
  differences.  This is part one in unifying the drivers.

  Merge i.MX and PowerPC SDHCI drivers
  Summary:
  i.MX5 and PowerPC use a very similar eSDHC controller, which is also
  similar to the uSDHC controller used by i.MX6.  The imx_sdhci driver works
  almost completely with PowerPC, with some minor tweaks.

  Fix the build.  protctl is only used on powerpc.
  While here, remove the need to check the SVR SPR, as others may be compatible
  with the p1022-esdhc type.

  Since it's no longer accessing a powerpc-specific register, drop the #ifdef.

7 years agoMFC r311734, r311735, r311951, r314071:
ian [Wed, 1 Mar 2017 20:22:25 +0000 (20:22 +0000)]
MFC r311734, r311735, r311951, r314071:

  Add new helper routines for sdhci bridge drivers that use gpio pins for
  card presence and write protect switch detection.

  Use the new sdhci_fdt_gpio helper functions to add full support for FDT
  gpio pins for detecting card insert/remove and write protect for ti_sdhci.

  Include sys/systm.h for use of bootverbose.

  Revert to ti_sdhci driver's historic behavior: assume an sd card is
  writable if the fdt data doesn't provide a gpio pin for reading the write
  protect switch and also doesn't contain a "wp-disable" property.

7 years agoMFC r306262, r306267, r310021: (needed to avoid conflicts on later merges)
ian [Wed, 1 Mar 2017 19:55:04 +0000 (19:55 +0000)]
MFC r306262, r306267, r310021: (needed to avoid conflicts on later merges)

  Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
  this on a few earlier arm SoCs.

  Restrict where we need to define fdt_fixup_table to just PowerPC and
  Marvell.

  Add the missing void to function signatures in much of the arm code.

7 years agoMFC r308640:
ian [Wed, 1 Mar 2017 18:53:05 +0000 (18:53 +0000)]
MFC r308640:

  Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
  integer data from the device tree.

7 years agoMFC r303347, r303350, r303351, r303353:
ian [Wed, 1 Mar 2017 18:23:30 +0000 (18:23 +0000)]
MFC r303347, r303350, r303351, r303353:

  Translate modem status reg bits from ns16550 to SER_* values used by the
  tty layer.

  Annotate the usb-serial drivers which always return 0 for line status,
  so that it'll be easier to find and fix them in the future.

  Also annotate a switch case fall-through per style(9).

7 years agoMFC r303346:
ian [Wed, 1 Mar 2017 18:19:46 +0000 (18:19 +0000)]
MFC r303346:

 Actually return line status register values from umoscom_cfg_get_status().

 The hardware delivers ns16550-compatible status bits, which is what the
 usb_serial code expects, so no need for translation, no need for a local
 variable to hold a temporary lsr result.

7 years agoMFC r311658:
ian [Wed, 1 Mar 2017 18:05:40 +0000 (18:05 +0000)]
MFC r311658:

  Only write to *active once, even when GPIO_ACTIVE_LOW is set.

7 years agoMFC r310430:
ian [Wed, 1 Mar 2017 18:03:34 +0000 (18:03 +0000)]
MFC r310430:

  Use ${.OBJDIR} to refer to the kernel build object dir, instead of trying
  to recreate it from ${MAKEOBJDIRPREFIX} and ${SRC_BASE} and ${KERNCONF},
  the latter being especially problematic when KERNCONF is set to the names
  of multiple kernel configs.

7 years agoMFC r314101: don't use C99 static array indices with older GCC versions
avg [Wed, 1 Mar 2017 13:47:28 +0000 (13:47 +0000)]
MFC r314101: don't use C99 static array indices with older GCC versions

Sponsored by: Panzura

7 years agoMFC r314100: fix a typo in __STDC_VERSION__ in __min_size requirements
avg [Wed, 1 Mar 2017 13:45:40 +0000 (13:45 +0000)]
MFC r314100: fix a typo in __STDC_VERSION__ in __min_size requirements

7 years agoMFC r313779: Fix handling of negative sbspace() return values.
mav [Wed, 1 Mar 2017 04:24:30 +0000 (04:24 +0000)]
MFC r313779: Fix handling of negative sbspace() return values.

I found that at least with Chelsio NICs TOE sockets quite often report
negative sbspace() values.  Using unsigned variable to store it resulted
in attempts to aggregate too much data in one sosend() call, that caused
errors and following connection termination.

7 years agoMFC r313774: localtime: return NULL if time_t out of range of struct tm
emaste [Wed, 1 Mar 2017 01:45:52 +0000 (01:45 +0000)]
MFC r313774:    localtime: return NULL if time_t out of range of struct tm

Previously we would truncate tm.tm_year for any time_t corresponding to
a year that does not fit in int.  This issue was discovered because it
caused the bash-static build to fail when linking with LLD.

As reported by Rafael EspĂ­ndola:

    Configure has

    AC_FUNC_MKTIME

    which expands to a test of mktime that fails with the freebsd
    implementation. Given that, bash compiles a mktime.o file that
    defines just mktime and uses localtime. That goes in a .a file
    that is before libc.

    The freebsd libc defines mktime in localtime.o, which also defines
    localtime among other functions.

    When lld sees an undefined reference to mktime from libc, it uses
    the bash provided one and then tries to find a definition of
    localtime. It is found on libc's localtime.o, but now we have a
    duplicated error.

    The reason it works with bfd is that bash doesn't use mktime
    directly and the undefined reference from libc is resolved to the
    libc implementation. It would also fail to link if bash itself
    directly used mktime.

The bash-static configure test verifies that, for many values of t, either
localtime(t) returns NULL or mktime(localtime(t)) == t.  This test failed
when localtime returned a truncated tm_year.

This was fixed in tzcode in 2004 but has persisted in our tree since
rS2708.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r314316:
pfg [Wed, 1 Mar 2017 01:17:51 +0000 (01:17 +0000)]
MFC r314316:
dc(1): Catch up with OpenBSD tag.

OpenBSD rev 1.12 corresponds to our SVN r275162. Update the tag to make
easier future updates. No functional change.

7 years agoMFC r312995:
asomers [Wed, 1 Mar 2017 00:17:04 +0000 (00:17 +0000)]
MFC r312995:

Initialize a stack variable in mprsas_get_sas_address_for_sata_disk

Thought it's difficult to reproduce, I think this variable was responsible
for a use-after-free panic when a SATA disk timed out responding to a SATA
identify command during boot.

Submitted by: slm
Reviewed by: slm
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9364

7 years agoMFC r312559:
asomers [Tue, 28 Feb 2017 23:56:24 +0000 (23:56 +0000)]
MFC r312559:

Fix misc Coverity defects in camdd(8)

CID 1341620 Fix a small memory leak
CID 1341630 Though this is technically a false positive, rearrange the
code for clarity.
CID 1341635 Eliminate dead code
CID 1368663 Fix a double mutex unlock in the error path

Also:
* Use sig_atomic_t for variables accessed from signal handlers
* Don't conditionalize free(3) on its argument being non-null

Reported by: Coverity
CID: 1341620 1341630 1341635 1368663
Reviewed by: ken
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9237

7 years agoMFC r312553:
asomers [Tue, 28 Feb 2017 23:26:50 +0000 (23:26 +0000)]
MFC r312553:

Fix "camcontrol timestamp -s" with LTO-7 drives

The length of the scsi_set_timestamp_parameters struct was incorrect.  LTO-5
drives don't care, but LTO-7 drives do.

Reviewed by: Sam Klopsch
MFC after: 2 weeks
Sponsored by: Spectra Logic Corp

7 years agoMFC r312396:
asomers [Tue, 28 Feb 2017 23:03:51 +0000 (23:03 +0000)]
MFC r312396:

Fix an unchecked return value in zfsd

It's pretty unlikely to actually hit this, but good to check it anyway

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

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