]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
6 years agoMFC r313555:
hselasky [Fri, 19 May 2017 12:56:18 +0000 (12:56 +0000)]
MFC r313555:
Flexible and asymmetric allocation of EQs and MSI-X vectors for PF/VFs.

Previously, the mlx4 driver queried the firmware in order to get the
number of supported EQs. Under SRIOV, since this was done before the
driver notified the firmware how many VFs it actually needs, the
firmware had to take into account a worst case scenario and always
allocated four EQs per VF, where one was used for events while the
others were used for completions. Now, when the firmware supports the
asymmetric allocation scheme, denoted by exposing num_sys_eqs > 0 (-->
MLX4_DEV_CAP_FLAG2_SYS_EQS), we use the QUERY_FUNC command to query
the firmware before enabling SRIOV. Thus we can get more EQs and MSI-X
vectors per function. Moreover, when running in the new
firmware/driver mode, the limitation that the number of EQs should be
a power of two is lifted.

Obtained from: Linux (dual BSD/GPLv2 licensed)
Submitted by: Dexuan Cui @ microsoft . com
Differential Revision: https://reviews.freebsd.org/D8867
Sponsored by: Mellanox Technologies

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

6 years agoMFC r313556:
hselasky [Fri, 19 May 2017 12:42:33 +0000 (12:42 +0000)]
MFC r313556:
Change mlx4 QP allocation scheme.

When using Blue-Flame, BF, the QPN overrides the VLAN, CV, and SV
fields in the WQE. Thus, BF may only be used for QPNs with bits 6,7
unset.

The current ethernet driver code reserves a TX QP range with 256b
alignment.

This is wrong because if there are more than 64 TX QPs in use, QPNs >=
base + 65 will have bits 6/7 set.

This problem is not specific for the Ethernet driver, any entity that
tries to reserve more than 64 BF-enabled QPs should fail. Also, using
ranges is not necessary here and is wasteful.

The new mechanism introduced here will support reservation for "Eth
QPs eligible for BF" for all drivers: bare-metal, multi-PF, and VFs
(when hypervisors support WC in VMs). The flow we use is:

1. In mlx4_en, allocate Tx QPs one by one instead of a range allocation,
   and request "BF enabled QPs" if BF is supported for the function

2. In the ALLOC_RES FW command, change param1 to:
a. param1[23:0]  - number of QPs
b. param1[31-24] - flags controlling QPs reservation

Bit 31 refers to Eth blueflame supported QPs. Those QPs must have bits
6 and 7 unset in order to be used in Ethernet.

Bits 24-30 of the flags are currently reserved.

When a function tries to allocate a QP, it states the required
attributes for this QP. Those attributes are considered "best-effort".
If an attribute, such as Ethernet BF enabled QP, is a must-have
attribute, the function has to check that attribute is supported
before trying to do the allocation.

In a lower layer of the code, mlx4_qp_reserve_range masks out the bits
which are unsupported. If SRIOV is used, the PF validates those
attributes and masks out unsupported attributes as well. In order to
notify VFs which attributes are supported, the VF uses QUERY_FUNC_CAP
command. This command's mailbox is filled by the PF, which notifies
which QP allocation attributes it supports.

Obtained from: Linux (dual BSD/GPLv2 licensed)
Submitted by: Dexuan Cui @ microsoft . com
Differential Revision: https://reviews.freebsd.org/D8868
Sponsored by: Mellanox Technologies

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

6 years agoMFC r317584:
hselasky [Tue, 16 May 2017 07:22:41 +0000 (07:22 +0000)]
MFC r317584:
Correct manual page link to usbdi(9).

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

6 years agoMFC r317996
davidcs [Mon, 15 May 2017 18:24:14 +0000 (18:24 +0000)]
MFC r317996
Fix bug where MTX_DEF lock was held while taskqueue_drain() was invoked.
Check IFF_DRV_RUNNING flag is set prior to calling ql_hw_set_multi()

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

6 years agoMFC r317180
davidcs [Mon, 8 May 2017 22:44:16 +0000 (22:44 +0000)]
MFC r317180
Cleanup QLA_LOCK/QLA_UNLOCK macros
remove unused QLA_TX_LOCK/QLA_TX_UNLOCK macros
format qla_error_recovery()

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

6 years agoMFC: r317236
rmacklem [Sun, 7 May 2017 20:32:07 +0000 (20:32 +0000)]
MFC: r317236
Fix the setting of atime for Linux client NFSv4 mounts.

The FreeBSD NFSv4 server did not set the attribute bit for TimeAccess in
the reply to an Open with exclusive_create, as required by the RFCs.
(This is required since the FreeBSD NFS server stores the create_verifier
 in the va_atime attribute.)
As such, the Linux NFSv4 client did not set the TimeAccess (atime) in
the Setattr done in an RPC after the one with the Open/exclusive_create.
This patch fixes the server to set the TimeAccess bit in the reply.

I believe that storing the create_verifier in an extended attribute for
file systems that support extended attributes might be a good idea,
but I will wait for a discussion of this on the freebsd-fs@ email list
before considering committing a patch to do this.

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

7 years agoMFC: r316667
rmacklem [Wed, 26 Apr 2017 23:32:57 +0000 (23:32 +0000)]
MFC: r316667
Fix the NFSv4 client hndling of a stale write verifier in the Commit operation.

When the NFSv4 client Commit operation encountered a stale write verifier,
it erroneously mapped that to EIO. This could have caused recently written
data to be lost when a server crashes/reboots between an UNSTABLE write
and the subsequent commit. This patch fixes this.
The bug was only for the NFSv4 client and did not affect NFSv3.

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

7 years agoMFC r316183
davidcs [Thu, 20 Apr 2017 04:36:49 +0000 (04:36 +0000)]
MFC r316183
Upgrade firmware and other related files to version 5.4.64

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

7 years agoMFC r316310
davidcs [Wed, 19 Apr 2017 03:03:46 +0000 (03:03 +0000)]
MFC r316310
  Update man page for commit r316309 "Add support for optional Soft LRO".
  The driver provides the ability to select either HW or Software LRO, when
  LRO is enabled (default HW LRO).

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

7 years agoMFC r316309
davidcs [Wed, 19 Apr 2017 03:02:23 +0000 (03:02 +0000)]
MFC r316309
Add support for optional Soft LRO

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

7 years agoSynchronize libcxxrt in stable/9 with stable/{10,11} and head.
dim [Sat, 1 Apr 2017 12:27:02 +0000 (12:27 +0000)]
Synchronize libcxxrt in stable/9 with stable/{10,11} and head.

MFC r284549 (by emaste):

Import libcxxrt master e64e93fe5bba67a6d52cbe5a97f8770c054bfa65

This includes a number of fixes to the C++ demangler (obtained from
upstream ELF Tool Chain).

MFC r284551 (by emaste):

Import libcxxrt master e64e93fe5bba67a6d52cbe5a97f8770c054bfa65.

This includes a number of demangler fixes obtained from upstream
ELF Tool Chain.

PR: 200913
Sponsored by: The FreeBSD Foundation

MFC r284553 (by emaste):

Update libcxxrt upgrade instructions

The typeinfo file no longer exists upstream.

MFC r288830:

Add std::uncaught_exceptions() to libcxxrt (C++17, see N4152 and N4259).
This has also been submitted upstream.

MFC r288830:

Add std::uncaught_exceptions() to libcxxrt (C++17, see N4152 and N4259).
This has also been submitted upstream.

MFC r297299:

Compile libcxxrt as C++11, since it is only really used in combination
with libc++, which is also C++11.  Also change one _Static_assert (which
is really C11) back into static_assert, like upstream.

This should help when compiling libcxxrt with newer versions of gcc,
which refuse to recognize any form of static assertions, if not
compiling for C++11 or higher.

While here, add -nostdinc++ to CFLAGS, to prevent picking up any C++
headers outside the source tree.

MFC r299144:

Import libcxxrt master 516a65c109eb0a01e5e95fbef455eb3215135cef.

Interesting fixes:
3adaa2e Fix _Unwind_Exception cleanup functions
286776c Check exception cleanup function ptr before calling
edda626 Correct exception specifications on new and delete operators

MFC r303157 (by emaste):

libcxxrt: add padding in __cxa_allocate_* to fix alignment

The addition of the referenceCount to __cxa_allocate_exception put the
unwindHeader at offset 0x58 in __cxa_exception, but it requires 16-byte
alignment. In order to avoid changing the current __cxa_exception ABI
(and thus breaking its consumers), add explicit padding in the
allocation routines (and account for it when freeing).

This is intended as a lower-risk change for FreeBSD 11. A "more correct"
fix should be prepared for upstream and -CURRENT.

Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7271

MFC r303400 (by emaste):

libcxxrt: fix demangling of wchar_t

'wchar_t' is 7 characters long, not 6. r303297 fixed this in libelftc,
but not the second copy of this file that we have in libcxxrt.

PR: 208661
Submitted by: Daniel McRobb
Obtained from: ELF Tool Chain r3480

MFC r305396:

Add _US_ACTION_MASK to libcxxrt's arm-specific unwind header.  This
value is used in newer versions of compiler-rt.

MFC r315947 | dim | 2017-03-25 14:17:48 +0100 (Sat, 25 Mar 2017) | 8 lines

Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.

Interesting fixes which were not already merged:
0c7c611 Merge C++ demangler bug fixes from ELF Tool Chain (#40)
2b208d9 __cxa_demangle_gnu3: demangle 'z' as '...', not 'ellipsis' (#41)

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

7 years agoMFC r315745:
dim [Sat, 25 Mar 2017 12:29:15 +0000 (12:29 +0000)]
MFC r315745:

Cherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:

Author: David Chisnall <theraven@FreeBSD.org>
Date:   Wed Mar 22 12:27:08 2017 +0000

    Simplify some code.

    realloc() with a null pointer is equivalent to malloc, so we don't need
    to handle the two cases independently.

    Fixes #46

This should help with lang/beignet and other programs, which expect
__cxa_demangle(name, NULL, NULL, &status) to return zero in status.

PR: 213732

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

7 years agoPull in r283944 from upstream libc++ trunk (by Eric Fiselier):
dim [Fri, 24 Mar 2017 18:28:13 +0000 (18:28 +0000)]
Pull in r283944 from upstream libc++ trunk (by Eric Fiselier):

  Fix std::pair on FreeBSD

  Summary:
  FreeBSD ships an old ABI for std::pair which requires that it have
  non-trivial copy/move constructors. Currently the non-trivial
  copy/move is achieved by providing explicit definitions of the
  constructors. This is problematic because it means the constructors
  don't SFINAE properly. In order to SFINAE copy/move constructors they
  have to be explicitly defaulted and hense non-trivial.

  This patch attempts to provide SFINAE'ing copy/move constructors for
  std::pair while still making them non-trivial. It does this by adding
  a base class with a non-trivial copy constructor and then allowing
  pair's constructors to be generated by the compiler. This also allows
  the constructors to be constexpr.

  Reviewers: emaste, theraven, rsmith, dim

  Subscribers: cfe-commits

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

This should fix building www/chromium 57.0.2987.110 on stable/10 and
stable/9 without having to use -D_LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 (which
changes the ABI).  Direct commit to stable/10 and stable/9, since head
already has libc++ 4.0, which includes this fix.

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

7 years agoMFC r314365
davidcs [Fri, 24 Mar 2017 03:17:59 +0000 (03:17 +0000)]
MFC r314365
    1. state checks in bxe_tx_mq_start_locked() and bxe_tx_mq_start() to
       sync threads during interface down or detach.
    2. add sysctl to set pause frame parameters
    3. increase max segs for TSO packets to BXE_TSO_MAX_SEGMENTS (32)
    4. add debug messages for PHY
    5. HW LRO support restricted to FreeBSD versions 8.x and above.

Submitted by: Vaishali.Kulkarni@cavium.com

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

7 years agoMFC r315206:
ngie [Mon, 20 Mar 2017 03:18:16 +0000 (03:18 +0000)]
MFC r315206:

bsnmpd: fix segfault when trans_insert_port(..) is called with multiple
out of order addresses

Move `port->transport` initialization before the TAILQ_FOREACH(..) loop
to ensure that the value is properly initialized before it's inserted
into the TAILQ.

PR: 217760

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

7 years agoMFC r314553:
hselasky [Tue, 14 Mar 2017 16:01:36 +0000 (16:01 +0000)]
MFC r314553:

Implement taskqueue_poll_is_busy() for use by the LinuxKPI.
Refer to comment above function for a detailed description.

Discussed with: kib @
Sponsored by: Mellanox Technologies

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

7 years agoMFC r314328:
hselasky [Tue, 14 Mar 2017 15:57:21 +0000 (15:57 +0000)]
MFC r314328:

Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by: avg @

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

7 years agoMFC r313941:
hselasky [Tue, 14 Mar 2017 15:52:01 +0000 (15:52 +0000)]
MFC r313941:

Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.

This patch adds a thread construction and destruction call for the
first thread in a procedure.

Tested: dtrace, linux emulation
Reviewed by: kib @
Sponsored by: Mellanox Technologies

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

7 years agoMFC r313778:
hselasky [Tue, 14 Mar 2017 15:47:17 +0000 (15:47 +0000)]
MFC r313778:

Improve code readability and fix compilation error when using clang 4.x.

Found by: emaste @
Sponsored by: Mellanox Technologies

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

7 years agoMFC r312424:
hselasky [Tue, 14 Mar 2017 15:30:46 +0000 (15:30 +0000)]
MFC r312424:

Fix problem with suspend and resume when using Skylake chipsets. Make
sure the XHCI controller is reset after halting it. The problem is
clearly a BIOS bug as the suspend and resume is failing without
loading the XHCI driver. The same happens when using Linux and the
XHCI driver is not loaded.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
PR: 216261

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

7 years agoMFC r312338:
hselasky [Tue, 14 Mar 2017 15:25:49 +0000 (15:25 +0000)]
MFC r312338:

Add USB audio support for S/PDIF output with C-Media CM6206 devices.

Submitted by: Julien Nadeau <vedge@hypertriton.com>
PR: 216131

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

7 years agoMFC r314062
davidcs [Mon, 6 Mar 2017 20:47:53 +0000 (20:47 +0000)]
MFC r314062
add bus_dmamap_unload in ql_free_dmabuf()

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

7 years agoMFC r314572:
mm [Sun, 5 Mar 2017 21:43:07 +0000 (21:43 +0000)]
MFC r314572:

Fix null pointer dereference in zfs_freebsd_setacl().

Prevents unprivileged users from panicking the kernel by calling
__acl_delete_*() on files or directories inside a ZFS mount.

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

7 years agoPull in r242377 from upstream libc++ trunk (by Marshall Clow):
dim [Sat, 18 Feb 2017 14:44:14 +0000 (14:44 +0000)]
Pull in r242377 from upstream libc++ trunk (by Marshall Clow):

  Make sure that __libcpp_compressed_pair_imp default-constructs its'
  members, rather than value-initializing them. Fixes PR#24137

This ensures std::make_shared<>'s default constructor properly
initializes to zero.

Direct commit to stable/9 and stable/10, since stable/11 and head
already have a newer version of libc++, including this fix.

Reported by: martin.beran@kernun.cz
PR: 217200

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

7 years agoMFC r312728
davidcs [Thu, 2 Feb 2017 00:37:21 +0000 (00:37 +0000)]
MFC r312728
    Added support for if_transmit and if_qflush
    Removed if_start
    updated version to 3.10.33

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

7 years agoMFC r312426: fix a thread preemption regression in schedulers introduced
avg [Tue, 24 Jan 2017 12:15:10 +0000 (12:15 +0000)]
MFC r312426: fix a thread preemption regression in schedulers introduced
in r270423

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

7 years agoMFC r311688:
dim [Wed, 11 Jan 2017 21:01:49 +0000 (21:01 +0000)]
MFC r311688:

Fix logic error in gvinum's gv_set_sd_state()

With clang 4.0.0, I'm getting the following warnings:

    sys/geom/vinum/geom_vinum_state.c:186:7: error: logical not is only
    applied to the left hand side of this bitwise operator
    [-Werror,-Wlogical-not-parentheses]
                    if (!flags & GV_SETSTATE_FORCE)
                        ^      ~

The logical not operator should obiously be called after masking.

Reviewed by: mav, pfg
Differential Revision: https://reviews.freebsd.org/D9093

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

7 years agoMFC r311649:
dim [Wed, 11 Jan 2017 20:45:27 +0000 (20:45 +0000)]
MFC r311649:

Fix the following clang 4.0.0 warning in ngatm's snmp_atm.c:

    contrib/ngatm/snmp_atm/snmp_atm.c:173:6: error: logical not is only
    applied to the left hand side of this bitwise operator
    [-Werror,-Wlogical-not-parentheses]
            if (!ifmr.ifm_status & IFM_AVALID) {
                ^                ~

Obviously, the masking needs to be done before the logical not
operation.  Add parentheses to make it so.

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

7 years agoMFC r257398 (by sbruno):
dim [Mon, 9 Jan 2017 20:14:20 +0000 (20:14 +0000)]
MFC r257398 (by sbruno):

Quiesce warnings by updating headerfile includes

r257404 | sbruno | 2013-10-30 23:41:18 +0100 (Wed, 30 Oct 2013) | 9 lines

Quiesce two warnings:

1.  define the CODE * as const
2.  restructure function to eliminate warning about exiting with no return.
    severity_map() never returns when it can't find an appropriate sysylog
    facility, and it longjmp()'s away into error code handling.  Keep this
    behavior by stashing the facility value found during our search and
    checking for -1 if found.

MFC r257405 (by sbruno):

Quiesce warning, which could be a bug IMO, by correctly defining the host_info
structure name

MFC r257406 (by sbruno):

Queisce warning about undeclared function usage.

yp_get_default_domain is defined in workaround.c but is not declared
in any header file.  Tie the declaration to the same #define conditional
used when the function is called, NETGROUP

MFC r272949 (by pfg):

tcpd: complete function prototypes.

This clears up at least a build issues on mysql-server
ports. While here also replace some spaces with tabs
in our headers.

PR: 42336

MFC r272950 (by pfg):

tcpd.h: add prototype for hosts_ctl

According the hosts_access(3) man page the hosts_ctl() prototype
should be in tcpd.h. For now, follow other declarations and don't
add the arguments in the prototype.

Reference:
https://www.illumos.org/issues/4385

PR: 32808

MFC r311459:

Put proper prototypes in tcpd.h

Clang 4.0.0 complains about tcpd.h's not-really-prototypes, e.g.:

    /usr/include/tcpd.h:75:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
    extern int hosts_access();              /* access control */
                           ^

To fix this, turn these declarations into real prototypes.  While here,
garbage collect the incompatible rfc931() function from scaffold.c, as
it is never used.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D9052

MFC r311461:

Also remove unnecessary extern keywords from tcpd.h.

Noticed by: kib

MFC r311556:

After r311459, some ports can break, because a few of the newly added
prototypes in <tcpd.h> use FILE.  Pull in a minimal forward declaration
of FILE from <stdio.h> to minimize impact.  Sorry for the breakage.

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>

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

7 years agoMFC r310058:
hselasky [Mon, 9 Jan 2017 17:09:53 +0000 (17:09 +0000)]
MFC r310058:
Fix initialisation of mlx4_pci_table's .driver_data fields.

Differential Revision: https://reviews.freebsd.org/D8791
Sponsored by: Mellanox Technologies
Submitted by: Dexuan Cui <decui@microsoft.com>

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

7 years agoMFstable/10 r311552:
ngie [Fri, 6 Jan 2017 21:36:51 +0000 (21:36 +0000)]
MFstable/10 r311552:

MFstable/11 r311551:

MFC r311136:

Add WITH_SSP to silence complaints from mkman about there not being a file

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

7 years agoMFC r310367:
pfg [Mon, 26 Dec 2016 16:45:00 +0000 (16:45 +0000)]
MFC r310367:
pax(1): Fix a bug with archives smaller than 512 bytes.

The problem here is that the archive is too short (< 512 bytes). The
buffer routines, try to read at least 512 bytes, even when we try to
determine what format file we have, which is wrong.

Obtained from: NetBSD (CVS rev 1.26)

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

7 years agoMFC r310132:
pfg [Wed, 21 Dec 2016 15:40:16 +0000 (15:40 +0000)]
MFC r310132:
libbfd: make sure variables are initialized before using them.

Initialize l_sec_contents to make sure that free(l_sec_contents) is called
on valid pointers.

Obtained from: OpenBSD (partial CVS rev 1.18)

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

7 years agoMFC r309650:
ed [Tue, 20 Dec 2016 08:01:17 +0000 (08:01 +0000)]
MFC r309650:

  Properly sign extend the result of jrand48() and mrand48().

  These functions are supposed to return a value between [-2^31, 2^31).
  This doesn't seem to work on 64-bit systems, where we return a value
  between [0, 3^32). Patch up the function to use proper casts to int32_t.
  While there, fix some other style bugs.

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

7 years agoMFC r307902:
trasz [Mon, 19 Dec 2016 18:32:26 +0000 (18:32 +0000)]
MFC r307902:

Make the USB attach strings in dmesg include product name.

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

7 years agoMFC r307774:
trasz [Mon, 19 Dec 2016 18:31:22 +0000 (18:31 +0000)]
MFC r307774:

Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
"product vendor". This is consistent with how it's generally done.
The ordering is visible eg in usbconfig(8) output.

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

7 years agoMFC r309400:
hselasky [Mon, 19 Dec 2016 09:54:59 +0000 (09:54 +0000)]
MFC r309400:
Fix for endless recursion in the ACPI GPE handler during boot.

When handling a GPE ACPI interrupt object the EcSpaceHandler()
function can be called which checks the EC_EVENT_SCI bit and then
recurse on the EcGpeQueryHandler() function. If there are multiple GPE
events pending the EC_EVENT_SCI bit will be set at the next call to
EcSpaceHandler() causing it to recurse again via the
EcGpeQueryHandler() function. This leads to a slow never ending
recursion during boot which prevents proper system startup, because
the EC_EVENT_SCI bit never gets cleared in this scenario.

The behaviour is reproducible with the ALASKA AMI in combination with
a newer Skylake based mainboard in the following way:

Enter BIOS and adjust the clock one hour forward. Save and exit the
BIOS. System fails to boot due to the above mentioned bug in
EcGpeQueryHandler() which was observed recursing multiple times.

This patch adds a simple recursion guard to the EcGpeQueryHandler()
function and also also adds logic to detect if new GPE events occurred
during the execution of EcGpeQueryHandler() and then loop on this
function instead of recursing.

Reviewed by: jhb

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

7 years agoMFC r310013 (by cperciva):
dim [Sun, 18 Dec 2016 14:31:11 +0000 (14:31 +0000)]
MFC r310013 (by cperciva):

Check that blkfront devices have a non-zero number of sectors and a
non-zero sector size.  Such a device would be a virtual disk of zero
bytes; clearly not useful, and not something we should try to attach.

As a fortuitous side effect, checking that these values are non-zero
here results in them not *becoming* zero later on the function.  This
odd behaviour began with r309124 (clang 3.9.0) but is challenging to
debug; making any changes to this function whatsoever seems to affect
the llvm optimizer behaviour enough to make the unexpected zeroing of
the sector_size variable cease.

PR: 215209
Security: The potential for variables to unexpectedly become zero
has worrying consequences for security in general, but
not so much in this particular context.

MFC r310086:

In xbd_connect(), use correct scanf conversion specifiers for the
feature_barrier and feature_flush variables.  Otherwise, adjacent
variables on the stack, such as sector_size, may be overwritten, with
disastrous results.

Note that I did not see a good reason to revert the addition of zero
checks introduced in r310013.  Better safe than sorry.

PR: 215209
Tested by: royger

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

7 years agoFix libllvmanalysis build failure after r309857: on stable/9, llvm is
dim [Mon, 12 Dec 2016 00:09:08 +0000 (00:09 +0000)]
Fix libllvmanalysis build failure after r309857: on stable/9, llvm is
compiled by gcc, and without -std=c++11, so the nullptr keyword is
unknown.  Use the old-school plain zero syntax instead.

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

7 years agoMFC r309722:
dim [Sun, 11 Dec 2016 19:58:13 +0000 (19:58 +0000)]
MFC r309722:

Pull in r281586 from upstream llvm trunk (by Wei Mi):

  Add some shortcuts in LazyValueInfo to reduce compile time of
  Correlated Value Propagation.

  The patch is to partially fix PR10584. Correlated Value Propagation
  queries LVI to check non-null for pointer params of each callsite. If
  we know the def of param is an alloca instruction, we know it is
  non-null and can return early from LVI. Similarly, CVP queries LVI to
  check whether pointer for each mem access is constant. If the def of
  the pointer is an alloca instruction, we know it is not a constant
  pointer. These shortcuts can reduce the cost of CVP significantly.

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

This significantly reduces memory usage and compilation time when
compiling a particular C++ source file of the graphics/colmap port.

PR: 215136

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

7 years agoMFC r308420: MFV r308392: file 5.29.
delphij [Sun, 11 Dec 2016 07:39:10 +0000 (07:39 +0000)]
MFC r308420: MFV r308392: file 5.29.

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

7 years agoMFC r309544:
bapt [Sat, 10 Dec 2016 11:38:29 +0000 (11:38 +0000)]
MFC r309544:

Import tzdata 2016j

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

7 years agoMerge rr309688: address regressions in SA-16:37.libc.
glebius [Wed, 7 Dec 2016 23:20:50 +0000 (23:20 +0000)]
Merge rr309688: address regressions in SA-16:37.libc.

PR: 215105
Submitted by: <jtd2004a sbcglobal.net>

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

7 years agoFix whitespace nit, not functional changes.
gjb [Wed, 7 Dec 2016 19:01:38 +0000 (19:01 +0000)]
Fix whitespace nit, not functional changes.

Sponsored by: The FreeBSD Foundation

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

7 years agoDocument EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.
gjb [Wed, 7 Dec 2016 18:55:55 +0000 (18:55 +0000)]
Document EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.

Sponsored by: The FreeBSD Foundation

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

7 years agoMerge r309639 from head:
glebius [Tue, 6 Dec 2016 18:54:04 +0000 (18:54 +0000)]
Merge r309639 from head:

  Fix possible buffer overflow(s) in link_ntoa(3).

  A specially crafted sockaddr_dl argument can trigger a static buffer overflow
  in the libc library, with possibility to rewrite with arbitrary data following
  static buffers that belong to other library functions.

Reviewed by: kib
Security: FreeBSD-SA-16:37.libc

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

7 years agoMerge r309638 from head:
glebius [Tue, 6 Dec 2016 18:52:33 +0000 (18:52 +0000)]
Merge r309638 from head:

  When telnetd(8) composes argument list for login(1), an unexpected sequence
  of memory allocation failures combined with insufficient error checking
  could result in the construction and execution of an argument sequence that
  was not intended.

  Fix that treating malloc(3) failures as fatal condition.

Submitted by: brooks
Security: FreeBSD-SA-16:36.telnetd

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

7 years agoMFC r292961, r295717:
kib [Tue, 6 Dec 2016 10:37:27 +0000 (10:37 +0000)]
MFC r292961, r295717:
Force nullfs vnode reclaim after unlinking and directory removal.

PR: 178238

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

7 years agoMFC r309332:
dim [Tue, 6 Dec 2016 07:33:49 +0000 (07:33 +0000)]
MFC r309332:

Cleanup old debug dirs in delete-old-dirs target

Any .debug or .symbols files under /usr/lib/debug which correspond to
OLD_FILES entries in ObsoleteFiles.inc are also automatically cleaned up
by the delete-old target.  Make this also apply to any OLD_DIRS entries.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D8683

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

7 years agoMFC r309179:
pfg [Sat, 3 Dec 2016 00:46:18 +0000 (00:46 +0000)]
MFC r309179:
ext2fs: avoid possible overflow when calculating malloc size.

This is inspired on r308064 for the case of mounting UFS.

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

7 years agoMFC r309027:
brooks [Wed, 30 Nov 2016 01:41:40 +0000 (01:41 +0000)]
MFC r309027:

Allocate a struct ifreq rather than using a (wrong) computed size for
the BIOCSETIF ioctl.

The kernel always copies an entire struct ifreq and IPv4 addresses will
always fit in an ifreq.

On systems with pointers larger than 64-bits, the computed size will be
less than the size of struct ifreq, potentially resulting in the kernel
attempting to copyin memory from outside the allocation.

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

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

7 years agoMFC r308808, r308809: Lookup locale when print all keywords as well.
ume [Sat, 26 Nov 2016 02:53:35 +0000 (02:53 +0000)]
MFC r308808, r308809: Lookup locale when print all keywords as well.

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

7 years agoMFC r308957: MFV r308954:
delphij [Tue, 22 Nov 2016 16:23:46 +0000 (16:23 +0000)]
MFC r308957: MFV r308954:

ntp 4.2.8p9.

Approved by: so

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

7 years agoMFC r308642:
kib [Mon, 21 Nov 2016 10:49:37 +0000 (10:49 +0000)]
MFC r308642:
Initialize reserved bytes in struct mq_attr.

PR: 214488

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

7 years agoMFC r308437 and r308461:
hselasky [Sat, 12 Nov 2016 17:32:22 +0000 (17:32 +0000)]
MFC r308437 and r308461:
Range check the jitter values to avoid bogus sample rate adjustments.
The expected deviation should not be more than 1Hz per second. The USB
v2.0 specification also mandates this requirement. Refer to chapter
5.12.4.2 about feedback.

Allow higher sample rates to have more jitter than lower ones.

PR: 208791

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

7 years agoMFC: r307891
rmacklem [Tue, 8 Nov 2016 21:57:49 +0000 (21:57 +0000)]
MFC: r307891
Fix the man page to reflect the change done by r307890 to mountd.c
so that the "-n" option uses the sysctl for the correct NFS server.
This is a content change.

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

7 years agoMFC: r307890
rmacklem [Tue, 8 Nov 2016 21:52:55 +0000 (21:52 +0000)]
MFC: r307890
mountd(8) was erroneously setting the sysctl for the old NFS server
when the new/default NFS server was running, for the "-n" option.

This patch fixes the problem for stable/10 and stable/9.
Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default,
there wouldn't have been many users affected by the code not setting
it to 0 when the "-n" option was specified.

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

7 years agoMFC r307518:
hselasky [Mon, 7 Nov 2016 09:23:07 +0000 (09:23 +0000)]
MFC r307518:
Fix device delete child function.

When detaching device trees parent devices must be detached prior to
detaching its children. This is because parent devices can have
pointers to the child devices in their softcs which are not
invalidated by device_delete_child(). This can cause use after free
issues and panic().

Device drivers implementing trees, must ensure its detach function
detaches or deletes all its children before returning.

While at it remove now redundant device_detach() calls before
device_delete_child() and device_delete_children(), mostly in
the USB controller drivers.

Tested by: Jan Henrik Sylvester <me@janh.de>
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D8070

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

7 years agoMFC r308031:
hselasky [Mon, 7 Nov 2016 08:26:19 +0000 (08:26 +0000)]
MFC r308031:
Fix indentation and remove duplicate queue stopped stats increment.

Found by: Ryan Stone <rysto32@gmail.com>
Sponsored by: Mellanox Technologies

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

7 years agoMFC r308144 and r308165:
hselasky [Mon, 7 Nov 2016 08:17:23 +0000 (08:17 +0000)]
MFC r308144 and r308165:
Fixes for virtual T-axis buttons.

Make sure the virtual T-axis buttons gets cleared for USB mice which has
less than 6 buttons.

Make sure the virtual T-axis buttons generate button release event(s)
for continuous tilting.

PR: 213919
PR: 213957

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

7 years agoMFC r283636:
avos [Sun, 6 Nov 2016 14:25:52 +0000 (14:25 +0000)]
MFC r283636:
- Don't request BUS_DMA_ALLOCNOW for dma tags, that requires enormous
amount of memory.
- Don't request segsize of BUS_SPACE_MAXSIZE_32BIT, when maxsize is
MCLBYTES.

With this change bwi_attach() can succeed on i386.

PR: 214235
Submitted by: scottl

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

7 years agoMFC r307800, r307801
cy [Sat, 5 Nov 2016 17:02:38 +0000 (17:02 +0000)]
MFC r307800, r307801

r307800:

  Sources from the "current" build tree and generated sources in the
  object tree should be used instead of sources and headers from the
  already installed source tree on the build host.

  This was noticed while addressing issues in the upcoming amd update.

r307801:

  Align whitespace.

  r307801 is related to r307800 however it was a separate commit to
  HEAD in order to maintain a separation between the functional change
  and a correction of style.

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

7 years agoMFC r308270:
gjb [Fri, 4 Nov 2016 17:55:50 +0000 (17:55 +0000)]
MFC r308270:
 MFV r308265: Update tzdata to 2016i.

Sponsored by: The FreeBSD Foundation

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

7 years agoDocument SA-16:33-35.
gjb [Wed, 2 Nov 2016 18:11:06 +0000 (18:11 +0000)]
Document SA-16:33-35.

Sponsored by: The FreeBSD Foundation

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

7 years agoBackport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401:
delphij [Wed, 2 Nov 2016 07:09:31 +0000 (07:09 +0000)]
Backport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401:

  Don't allow too many consecutive warning alerts

  Certain warning alerts are ignored if they are received. This can mean that
  no progress will be made if one peer continually sends those warning alerts.
  Implement a count so that we abort the connection if we receive too many.

  Issue reported by Shi Lei.

This is a direct commit to stable/10 and stable/9.

Security: CVE-2016-8610

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

7 years agoMFV r308191:
delphij [Wed, 2 Nov 2016 05:13:27 +0000 (05:13 +0000)]
MFV r308191:

BIND 9.9.9-P4.

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

7 years agoMerge r308143 from stable/10:
dim [Mon, 31 Oct 2016 18:45:01 +0000 (18:45 +0000)]
Merge r308143 from stable/10:

Pull in r228705 from upstream libc++ trunk (by Eric Fiselier):

  [libcxx] Fix PR 22468 - std::function<void()> does not accept
  non-void-returning functions

  Summary:
  The bug can be found here: https://llvm.org/bugs/show_bug.cgi?id=22468

  `__invoke_void_return_wrapper` is needed to properly handle calling a
  function that returns a value but where the std::function return type
  is void. Without this '-Wsystem-headers' will cause
  `function::operator()(...)` to not compile.

  Reviewers: eugenis, K-ballo, mclow.lists

  Reviewed By: mclow.lists

  Subscribers: cfe-commits

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

This should allow newer versions of the graphics/aseprite port to
compile without modification.

Direct commit to stable/10, since stable/11 and head already have this
change.

Reported by: yuri@rawbw.com
PR: 213773

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

7 years agoDocument EN-16:17-18, SA-16:26-32
gjb [Mon, 31 Oct 2016 16:44:31 +0000 (16:44 +0000)]
Document EN-16:17-18, SA-16:26-32

Sponsored by: The FreeBSD Foundation

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

7 years agoAdd posix_tnode to <search.h>.
ed [Sat, 29 Oct 2016 15:04:33 +0000 (15:04 +0000)]
Add posix_tnode to <search.h>.

In r307227 I've refactored the binary search tree functions to use the
posix_tnode type. As this change does not apply cleanly to this version
of FreeBSD, only make the change that matters: add the definition of the
newly introduced type.

This will ease source-level compatibility going forward.

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

7 years agoMFC r307578
davidcs [Wed, 26 Oct 2016 18:20:06 +0000 (18:20 +0000)]
MFC r307578
    1. Use taskqueue_create() instead of taskqueue_create_fast() for both
       fastpath and slowpath taskqueues.
    2. Service all transmits in taskqueue threads.
    3. additional stats counters for  keeping track of
     - bd availability
     - tx buf ring not emptied in the fp task queue.
       These are drained via timeout taskqueue.
     - tx attempts during link down.

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

7 years agoMerge r307936:
glebius [Tue, 25 Oct 2016 17:16:58 +0000 (17:16 +0000)]
Merge r307936:
  The argument validation in r296956 was not enough to close all possible
  overflows in sysarch(2).

  Submitted by: Kun Yang <kun.yang chaitin.com>
  Patch by:     kib
  Security:     SA-16:15

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

7 years agoMFC r307783:
bapt [Tue, 25 Oct 2016 14:55:03 +0000 (14:55 +0000)]
MFC r307783:

Import tzdata 2016h

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

7 years agoMFC r306790
davidcs [Mon, 17 Oct 2016 18:14:31 +0000 (18:14 +0000)]
MFC r306790
  Add support for adding up to 64 Multicast addresses with a single
  mailbox command

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

7 years agoMFC r306853
bapt [Sat, 15 Oct 2016 12:42:47 +0000 (12:42 +0000)]
MFC r306853

Import tzdata 2016g

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

7 years agoMFC r306852
bapt [Sat, 15 Oct 2016 12:38:50 +0000 (12:38 +0000)]
MFC r306852

Incorporate a change from OpenBSD by millert@OpenBSD.org

Don't warn about valid time zone abbreviations.  POSIX
through 2000 says that an abbreviation cannot start with ':', and
cannot contain ',', '-', '+', NUL, or a digit.  POSIX from 2001
on changes this rule to say that an abbreviation can contain only
'-', '+', and alphanumeric characters from the portable character
set in the current locale.  To be portable to both sets of rules,
an abbreviation must therefore use only ASCII letters."  Adapted
from tzcode2015f.

This is needed to be able to update tzdata to a newer version

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

7 years agoMFC r306478:
hselasky [Mon, 10 Oct 2016 11:48:23 +0000 (11:48 +0000)]
MFC r306478:
Add new USB ID.

While at it remove some whitespaces.

Submitted by: Jose Luis Duran <jlduran@gmail.com>
PR: 213110

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

7 years agoMFC r306451:
hselasky [Mon, 10 Oct 2016 11:36:43 +0000 (11:36 +0000)]
MFC r306451:
The IORESOURCE_XXX defines should resemble a bitmask while SYS_RES_XXX
are not bitmasks. Fix return value of pci_resource_flags() to reflect
this change.

Sponsored by: Mellanox Technologies

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

7 years agoMFC r306441 and r306634:
hselasky [Mon, 10 Oct 2016 11:27:59 +0000 (11:27 +0000)]
MFC r306441 and r306634:
While draining a timeout task prevent the taskqueue_enqueue_timeout()
function from restarting the timer.

Commonly taskqueue_enqueue_timeout() is called from within the task
function itself without any checks for teardown. Then it can happen
the timer stays active after the return of taskqueue_drain_timeout(),
because the timeout and task is drained separately.

This patch factors out the teardown flag into the timeout task itself,
allowing existing code to stay as-is instead of applying a teardown
flag to each and every of the timeout task consumers.

Add assert to taskqueue_drain_timeout() which prevents parallel
execution on the same timeout task.

Update manual page documenting the return value of
taskqueue_enqueue_timeout().

Differential Revision: https://reviews.freebsd.org/D8012
Reviewed by: kib, trasz

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

7 years agoMFC r305812:
pfg [Sun, 9 Oct 2016 19:59:20 +0000 (19:59 +0000)]
MFC r305812:

fifolog(1): invert order of calloc(3) arguments.

The second argument to calloc(3) should be the size, make it so.

While here be a little bit more cautious in fifolog_reader_open()
to protect in the unlikely event of an overflowed allocation.

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

7 years agoMFC r306522
davidcs [Thu, 6 Oct 2016 19:06:10 +0000 (19:06 +0000)]
MFC r306522
   Upgrade Firmware/Bootloader/ResetSeq/Minidump to revision 5.4.62

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

7 years agoMFC r306417: portsnap: only move expected snapshot contents from snap/ to files/
emaste [Wed, 5 Oct 2016 01:01:10 +0000 (01:01 +0000)]
MFC r306417: portsnap: only move expected snapshot contents from snap/ to files/

Previously it was possible to smuggle in addional files that would
used by later portsnap runs. Now we only move those files expected
to be in the snapshot into files/ and require that there are no
unexpected files.

This was used by portsnap attacks 2, 3, and 4 in the "non-cryptanalytic
attacks against FreeBSD update components" anonymous gist.

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

7 years agoMFH (r292408): use correct length in calloc() call
des [Mon, 3 Oct 2016 08:15:58 +0000 (08:15 +0000)]
MFH (r292408): use correct length in calloc() call

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

7 years agoMFC (part of) r298089 by pfg: Cleanup unnecessary semicolons
emaste [Thu, 29 Sep 2016 01:56:31 +0000 (01:56 +0000)]
MFC (part of) r298089 by pfg: Cleanup unnecessary semicolons

(Merged from stable/10 r306428)

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

7 years agoMFC r306075,r306109
ache [Wed, 28 Sep 2016 20:54:47 +0000 (20:54 +0000)]
MFC r306075,r306109

1) Microoptimize %p case.
2) Implememt %u for GNU compatibility.
3) Don't forget to advance buf for %w/%u.
4) Fail with incomplete week (week 0) request and no such week in the
year.
5) Fix yday formula when Sunday requested and the week started from Monday.
6) Fail with impossible yday for incomplete week (week 0) and direct %w/%u
request.
7) Shift yday/wday to the first day of the year, if incomplete week
(week 0) requested and no %w/%u used.
8) For already non-standard %z extension implement GNU compatible formats:
+hh and -hh.
9) Check for incorrect values for %z.

PR:     212983 (case 3 only)

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

7 years agoMFV r306384:
delphij [Wed, 28 Sep 2016 06:11:01 +0000 (06:11 +0000)]
MFV r306384:

BIND 9.9.9-P3.

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

7 years agoApply upstream revision 3612ff6fcec0e3d1f2a598135fe12177c0419582:
delphij [Mon, 26 Sep 2016 08:19:33 +0000 (08:19 +0000)]
Apply upstream revision 3612ff6fcec0e3d1f2a598135fe12177c0419582:

Fix overflow check in BN_bn2dec()
Fix an off by one error in the overflow check added by 07bed46
("Check for errors in BN_bn2dec()").

This fixes a regression introduced in SA-16:26.openssl.

Submitted by: jkim
PR: 212921

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

7 years agoMFC r272562,r272678,r272679
ache [Sun, 25 Sep 2016 23:05:44 +0000 (23:05 +0000)]
MFC r272562,r272678,r272679

1) Fix the case we have less arguments for format string than we expected.
2) Return error on unsupported format specs.
(both according to POSIX)
3) For %Z format, understand "UTC" name too.

PR:     93197 (only r272679)

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

7 years agoFix multiple OpenSSL vulnerabilities.
delphij [Fri, 23 Sep 2016 07:44:10 +0000 (07:44 +0000)]
Fix multiple OpenSSL vulnerabilities.

Security: FreeBSD-SA-16:26.openssl

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

7 years agoMFC bspatch Capsicumization and improvements
emaste [Fri, 23 Sep 2016 01:52:06 +0000 (01:52 +0000)]
MFC bspatch Capsicumization and improvements

r304691: bspatch: apply style(9)

Make style changes (and trivial refactoring of open calls) now in order
to reduce noise in diffs for future capsicum changes.

r304807 (allanjude): Capsicumize bspatch

Move all of the fopen() and open() calls to the top of main()

Restrict each FD to least privilege (read/seek only, write only, etc)

cap_enter(), and make all except the output FD read/seek only.

r304821: bspatch: remove output file in the case of error

r305486: bspatch: add sanity checks on sizes to avoid integer overflow

Note that this introduces an explicit 2GB limit, but this was already
implicit in variable and function argument types.

This is based on the "non-cryptanalytic attacks against freebsd
update components" anonymous gist. Further refinement is planned.

r305737: bspatch: remove superfluous newlines from errx strings

r305822: bspatch: use #define for header size instead of magic number

r306026: bspatch: Remove backwards-compatibility sys/capability.h support

bspatch previously included sys/capability.h or sys/capsicum.h based
on __FreeBSD_version, as FreeBSD is the upstream for bsdiff and we may
see this file incorporated into other third-party software.

The Capsicum header is now installed as sys/capsicum.h in stable/10 and
FreeBSD 10.3, so we can just use sys/capsicum.h and simplify the logic.

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

7 years agoMFC r264823 (ed): Make usage printing more consistent with other tools.
emaste [Thu, 22 Sep 2016 21:23:28 +0000 (21:23 +0000)]
MFC r264823 (ed): Make usage printing more consistent with other tools.

- Introduce a separate usage() function.
- Don't use argv[0]. Directly name the application, as we do elsewhere.
- Don't prepend the application name.
- Don't print two newlines.

Also apply the unnecessary semicolon cleanup from r298089

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

7 years agoMFC r305599:
kib [Thu, 22 Sep 2016 10:58:19 +0000 (10:58 +0000)]
MFC r305599:
Do not leak transient ENOLCK error from flush_newblk_dep() loop.

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

7 years agoMFC r305590:
hselasky [Thu, 15 Sep 2016 08:37:20 +0000 (08:37 +0000)]
MFC r305590:
Correctly map the USB mouse tilt delta values into buttons 5 and 6
instead of 3 and 4 which is used for the scroll wheel, according to
X.org.

PR: 170358

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

7 years agoMFC r305421:
hselasky [Mon, 12 Sep 2016 10:20:44 +0000 (10:20 +0000)]
MFC r305421:
Resolve deadlock between device_detach() and usbd_do_request_flags()
by reviving the SX control request lock and refining which lock
protects the common scratch area in "struct usb_device".

The SX control request lock was removed by r246759 because it caused a
lock order reversal with the USB enumeration lock inside
usbd_transfer_setup() as a function of r246616. It was thought that
reducing the number of locks would resolve the LOR, but because some
USB device drivers use usbd_do_request_flags() inside callback
functions, like in taskqueues, a deadlock may occur when these are
drained from device_detach(). By restoring the SX control request
lock usbd_do_request_flags() is allowed to complete its execution
when a USB device driver is detaching. By using the SX control request
lock to protect the scratch area, the LOR introduced by r246616 is
also resolved.

Bump the FreeBSD version while at it to force recompilation of all USB
kernel modules.

Found by: avos@

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

7 years agoMFC r305430:
dim [Sun, 11 Sep 2016 14:19:06 +0000 (14:19 +0000)]
MFC r305430:

Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable
way.

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

7 years agoMFC 303720: Apply the fix from r232612 to fixed function counters.
jhb [Fri, 9 Sep 2016 21:19:31 +0000 (21:19 +0000)]
MFC 303720: Apply the fix from r232612 to fixed function counters.

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

7 years agoMFC r305469:
delphij [Fri, 9 Sep 2016 07:00:50 +0000 (07:00 +0000)]
MFC r305469:

Ensure that we always open only files that is named by explicitly
using shell redirections instead of having gzip(1) to decide what
file to open.

Issue reported in the "non-cryptanalytic attacks against freebsd
update components" anonymous gist.

Reviewed by: allanjude, emaste

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

7 years agoMFC r304571:
hselasky [Fri, 9 Sep 2016 06:41:16 +0000 (06:41 +0000)]
MFC r304571:
Make the UKBD USB transfers double buffered and set them up one by one,
so they are memory independent which allows for handling panics
triggered by the keyboard driver itself, typically via CTRL+ALT+ESC
sequences. Or if the USB keyboard driver was processing a key at the
moment of panic. Allow UKBD to be attached while keyboard polling is active.

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

7 years agoMFC r305284:
hselasky [Fri, 9 Sep 2016 06:31:25 +0000 (06:31 +0000)]
MFC r305284:
Fix array size issue when using the pre-scaling feature for
ISOCHRONOUS USB transfers. Make sure enough length and buffer pointers
are allocated when setting up the libusb transfer structure to support
the maximum number of frames the kernel can handle.

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

7 years agoMFC r305389:
dim [Wed, 7 Sep 2016 19:25:08 +0000 (19:25 +0000)]
MFC r305389:

With clang 3.9.0, compiling sys/netinet/igmp.c results in the following
warning:

sys/netinet/igmp.c:546:21: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion]
        p->ipopt_list[0] = IPOPT_RA;    /* Router Alert Option */
                         ~ ^~~~~~~~
sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA'
#define IPOPT_RA                148             /* router alert */
                                ^~~

This is because ipopt_list is an array of char, so IPOPT_RA is wrapped
to a negative value.  It would be nice to change ipopt_list to an array
of u_char, but it changes the signature of the public struct ipoption,
so add an explicit cast to suppress the warning.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D7777

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

7 years agoMFC r305388:
dim [Wed, 7 Sep 2016 19:21:52 +0000 (19:21 +0000)]
MFC r305388:

With clang 3.9.0, compiling uplcom results in the following warnings:

sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 192 to -64 [-Werror,-Wconstant-conversion]
        if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1)
            ~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~~~
sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE'
#define UT_READ_VENDOR_DEVICE   (UT_READ  | UT_VENDOR | UT_DEVICE)
                                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

This is because UT_READ is 0x80, so the int8_t argument is wrapped to a
negative value.  Fix this by using uint8_t instead.

Reviewed by: imp, hselasky
Differential Revision: https://reviews.freebsd.org/D7776

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