]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoSend whois queries for gov.uk names to JANET.
Tony Finch [Wed, 25 May 2016 13:09:06 +0000 (13:09 +0000)]
Send whois queries for gov.uk names to JANET.

8 years agoImplement Linux module parameters as read-only tunable SYSCTLs.
Hans Petter Selasky [Wed, 25 May 2016 12:12:14 +0000 (12:12 +0000)]
Implement Linux module parameters as read-only tunable SYSCTLs.

Bool module parameters are no longer supported, because there is no
equivalent in FreeBSD.

There are two macros available which control the behaviour of the
LinuxKPI module parameters:

- LINUXKPI_PARAM_PARENT allows the consumer to set the SYSCTL parent
where the modules parameters will be created.

- LINUXKPI_PARAM_PREFIX defines a parameter name prefix, which is
  added to all created module parameters.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoPrepare for activation of LinuxKPI module parameters as read-only
Hans Petter Selasky [Wed, 25 May 2016 12:03:21 +0000 (12:03 +0000)]
Prepare for activation of LinuxKPI module parameters as read-only
tunable SYSCTL's. Linux module parameters are associated with the
module they belong to. FreeBSD does not share this concept of a parent
module. Instead add macros which define the prefix to use for the
module parameters in the LinuxKPI consumers.

While at it convert all "bool" LinuxKPI module parameters to "byte"
type, because we don't have a "bool" type of SYSCTL in FreeBSD.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoAdd relocation support for RISC-V.
Ruslan Bukin [Wed, 25 May 2016 11:58:55 +0000 (11:58 +0000)]
Add relocation support for RISC-V.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D6559

8 years agoAdd more info about the issue fixed in r298460. Rephrase some sentences
Svatopluk Kraus [Wed, 25 May 2016 10:09:23 +0000 (10:09 +0000)]
Add more info about the issue fixed in r298460. Rephrase some sentences
and fix grammar.

No functional change.

Suggested by: alc
Reviewed by: alc

8 years agoAdd checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can
Hans Petter Selasky [Wed, 25 May 2016 09:04:06 +0000 (09:04 +0000)]
Add checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can
run after a panic(). This for example allows a LinuxKPI based graphics
stack to receive prints during a panic.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoChange net.link.log_promisc_mode_change to a read-only tunable
Nick Hibma [Wed, 25 May 2016 09:00:05 +0000 (09:00 +0000)]
Change net.link.log_promisc_mode_change to a read-only tunable

PR: 166255
Submitted by: eugen.grosbein.net
Obtained from: hselasky
MFC after: 3 days

8 years agoMake code compile when basename() is POSIX compliant.
Ed Schouten [Wed, 25 May 2016 08:45:03 +0000 (08:45 +0000)]
Make code compile when basename() is POSIX compliant.

The POSIX basename() function is allowed to modify its input buffer,
which means its argument is "char *". Pull a copy of the input string
before computing the base.

Reviewed by: jtl
Differential Revision: https://reviews.freebsd.org/D6465

8 years agoCheck for signals when locking the USB enumeration thread from
Hans Petter Selasky [Wed, 25 May 2016 07:48:36 +0000 (07:48 +0000)]
Check for signals when locking the USB enumeration thread from
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.

MFC after: 1 week

8 years agoCall closedir() before returning from fetchListFile() to avoid a leak.
Don Lewis [Wed, 25 May 2016 07:43:32 +0000 (07:43 +0000)]
Call closedir() before returning from fetchListFile() to avoid a leak.

Reported by: Coverity
CID: 1016697
MFC after: 1 week

8 years agoDon't leak addrinfo in fetch_bind()
Don Lewis [Wed, 25 May 2016 07:39:48 +0000 (07:39 +0000)]
Don't leak addrinfo in fetch_bind()

Reported by: Coverity
CID: 1225038
MFC after: 1 week

8 years agoFix Coverity CID 978183 Resource leak in rexec().
Don Lewis [Wed, 25 May 2016 07:26:22 +0000 (07:26 +0000)]
Fix Coverity CID 978183 Resource leak in rexec().

Close the socket if connect() fails to avoid leaking it.

Reported by: Coverity
CID: 978183
MFC after: 1 week

8 years agoFix Coverity CID 1016714 Resource leak in process_file_actions_entry()
Don Lewis [Wed, 25 May 2016 07:13:53 +0000 (07:13 +0000)]
Fix Coverity CID 1016714 Resource leak in process_file_actions_entry()

Don't leak a file descriptor of _dup2() fails (shouldn't happen).

Reported by: Coverity
CID: 1016714
MFC after: 1 week

8 years agoFix 1016718 Resource leak.
Don Lewis [Wed, 25 May 2016 06:55:53 +0000 (06:55 +0000)]
Fix 1016718 Resource leak.

Don't leak a file descriptor if fchdir() fails.

Reported by: Coverity
CID: 1016718
MFC after: 1 week

8 years agoBuild etherswitch support for appropriate Ralink/Mediatek SoCs
Stanislav Galabov [Wed, 25 May 2016 06:47:28 +0000 (06:47 +0000)]
Build etherswitch support for appropriate Ralink/Mediatek SoCs

Etherswitch support is built by default on all SoCs except RT3662/RT3883
as they have no built-in switch and their configurations with external
switches are not yet supported.

Sponsored by: Smartcom - Bulgaria AD

8 years agoBring ralink/mediatek DTS files in sync with LEDE
Stanislav Galabov [Wed, 25 May 2016 06:39:48 +0000 (06:39 +0000)]
Bring ralink/mediatek DTS files in sync with LEDE

This is the last sync with LEDE Project dts files before 11.0.

Obtained from: LEDE Project
Sponsored by: Smartcom - Bulgaria AD

8 years agoAlign radiotap structures in ral(4)
Stanislav Galabov [Wed, 25 May 2016 06:29:23 +0000 (06:29 +0000)]
Align radiotap structures in ral(4)

Currently all radiotap structures in ral(4) are packed, but are not
aligned, which causes ral based devices to crash when one does
'ifconfig wlan0 up' for a wlan interface with a ral wlandev on arches
that care about structure alignment (e.g., MIPS).

Adding an aligned attribute helps fix this problem and ral devices
can be properly brought up.

Reviewed by: adrian
Sponsored by: Smartcom - Bulgaria AD

8 years agohyperv: Preserve required bits when disable Hypercall
Sepherosa Ziehau [Wed, 25 May 2016 06:01:47 +0000 (06:01 +0000)]
hyperv: Preserve required bits when disable Hypercall

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6530

8 years agohyperv/vmbus: Rework SynIC setup and teardown
Sepherosa Ziehau [Wed, 25 May 2016 05:53:12 +0000 (05:53 +0000)]
hyperv/vmbus: Rework SynIC setup and teardown

- Avoid bit fields.
- Fix SINT setup (preserve required bits).

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6529

8 years agohyperv/vmbus: Nuke unnecessary MSR read
Sepherosa Ziehau [Wed, 25 May 2016 05:45:43 +0000 (05:45 +0000)]
hyperv/vmbus: Nuke unnecessary MSR read

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6528

8 years agohyperv/vmbus: Pass vmbus softc to vmbus_synic_setup
Sepherosa Ziehau [Wed, 25 May 2016 05:37:42 +0000 (05:37 +0000)]
hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6527

8 years agohyperv/vmbus: Minor style and white space cleanup
Sepherosa Ziehau [Wed, 25 May 2016 05:30:48 +0000 (05:30 +0000)]
hyperv/vmbus: Minor style and white space cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6523

8 years agohyperv/vmbus: Move two global flags into vmbus softc
Sepherosa Ziehau [Wed, 25 May 2016 05:22:35 +0000 (05:22 +0000)]
hyperv/vmbus: Move two global flags into vmbus softc

And pack them into one flag field.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6522

8 years agoFix Coverity CID 1019054 (String not null terminated) in setfacl.
Don Lewis [Wed, 25 May 2016 05:20:34 +0000 (05:20 +0000)]
Fix Coverity CID 1019054 (String not null terminated) in setfacl.

Increase the size of buf[] by one to allow room for a NUL character
at the end.

Reported by: Coverity
CID: 1019054
MFC after: 1 week

8 years agoFix CID 1011370 (Resource leak) in ps.
Don Lewis [Wed, 25 May 2016 05:12:56 +0000 (05:12 +0000)]
Fix CID 1011370 (Resource leak) in ps.

There is no need to to call strdup() on the value returned by fmt().
The latter calls fmt_argv() which always returns a dynamically
allocated string, and calling strdup() on that leaks the memory
allocated by fmt_argv().  Wave some const magic on ki_args and
ki_env to make the direct assignment happy.  This requires a tweak
to the asprintf() case to avoid a const vs. non-const mismatch.

Reported by: Coverity
CID: 1011370
MFC after: 1 week

8 years agohyperv/vmbus: Move vcpuid into vmbus softc per-cpu data
Sepherosa Ziehau [Wed, 25 May 2016 05:06:15 +0000 (05:06 +0000)]
hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6521

8 years agohyperv/vmbus: Move event/message taskqueue/task to vmbus softc
Sepherosa Ziehau [Wed, 25 May 2016 04:59:20 +0000 (04:59 +0000)]
hyperv/vmbus: Move event/message taskqueue/task to vmbus softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6520

8 years agohyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready
Sepherosa Ziehau [Wed, 25 May 2016 03:39:42 +0000 (03:39 +0000)]
hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready

And release IDT vector before releasing ISR resources on interrupt
teardown path.  We still have some work to do on the interrupt tearing
down path.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6519

8 years agohyperv/vmbus: Check hyperv_dmamem_alloc return value
Sepherosa Ziehau [Wed, 25 May 2016 03:30:56 +0000 (03:30 +0000)]
hyperv/vmbus: Check hyperv_dmamem_alloc return value

Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK,
we had better to check its return value; better safe then sorry here.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6518

8 years agoClose from_fd if malloc() fails to avoid a file descriptor leak.
Don Lewis [Wed, 25 May 2016 02:51:15 +0000 (02:51 +0000)]
Close from_fd if malloc() fails to avoid a file descriptor leak.

Reported by: Coverity
CID: 1007203
MFC after: 1 week

8 years agoMatch the descriptions of the \H and \h prompt string sequences to reality.
Don Lewis [Wed, 25 May 2016 02:10:30 +0000 (02:10 +0000)]
Match the descriptions of the \H and \h prompt string sequences to reality.
They were swapped.

X-Confirmed by: jilles
MFC after: 1 week

8 years agoFix a few ada(4) driver issues:
Kenneth D. Merry [Wed, 25 May 2016 01:37:39 +0000 (01:37 +0000)]
Fix a few ada(4) driver issues:

 o Some Samsung drives do not support the ATA READ LOG EXT or READ
   LOG DMA EXT commands, despite indicating that they do in their
   IDENTIFY data.  So, fix this in two ways:
1. Only start the log directory probe (ADA_STATE_LOGDIR) if
   the drive claims to be an SMR drive in the first place.
   We don't need to do the extra probing for other devices.
   This will also serve to prevent problems with other
   drives that have the same issue.
2. Add quirks for the two Samsung drives that have been
   reported so far (thanks to Oleg Nauman and Alex Petrov).
   If there is a reason to do a Read Log later on, we will
   know that it doesn't work on these drives.

 o Add a quirk entry to mark Seagate Lamarr Drive Managed drives as
   drive managed.  They don't report this in their Identify data.

sys/cam/ata/ata_da.c:
Add two new quirks:
1. ADA_Q_LOG_BROKEN, for drives that claim to support Read
   Log but don't really.
2. ADA_Q_SMR_DM, for drives that are Drive Managed SMR, but
   don't report it.  This can matter for software that
   wants to know when it should make an extra effort to
   write sequentially.

Record two Samsung drives that don't support Read Log, and
one Seagate drive that doesn't report that it is a SMR drive.
The Seagate drive is already recorded in the da(4) driver.

We may have to come up with a similar solution in the da(4)
driver for SATA drives that don't properly support Read Log.

In adasetflags(), Dont' set the ADA_FLAG_CAN_LOG bit if the
device has the LOG_BROKEN quirk set.  Also, look at the
SMR_DM quirk and set the device type accordingly if it is
actually a drive managed drive.

When deciding whether to go into the LOGDIR probe state,
look to see whether the device claims to be an SMR device.
If not, don't bother with the LOGDIR probe state.

Sponsored by: Spectra Logic

8 years agoFix Coverity CIDs 1340544 Resource leak and 1340543 Use after free
Don Lewis [Wed, 25 May 2016 01:37:25 +0000 (01:37 +0000)]
Fix Coverity CIDs 1340544 Resource leak and 1340543 Use after free

At line 479 of ldapclient.c in client_build_req(), the error return
leaks ldap_attrs (CID 1340544).  It looks like this can happen if
the first utoa() call in aldap_get_stringset() fails.  It looks
like other leaks can happen if other utoa() calls fail since scanning
this array when it is freed stops when the first NULL is encountered.
Fix these problems by not storing NULL in the array when utoa()
fails, and by freeing ret and returning NULL if nothing is stored
in the array.  That way the caller will never see the
ldap_attrs[0] == NULL case, so delete that check.

The ber_printf_element() calls ber_free_elements() on its ber
argument and returns NULL on failure.  When each of its callers
detects failure, they do a goto fail, which then calls ber_free_elements()
with the same pointer (CID 1340543).  Fix is to delete the
ber_free_elements() from ber_printf_element()

Reported by: Coverity
CID: 13405431340544
Reviewed by: araujo
Differential Revision: https://reviews.freebsd.org/D6550

8 years agoUse the expiry date to determine whether to replace the DB copy of
Cy Schubert [Wed, 25 May 2016 01:35:02 +0000 (01:35 +0000)]
Use the expiry date to determine whether to replace the DB copy of
leapfile instead of using the leapfile serial number (create
timestamp).

PR: 209577
MFC after: 3 days

8 years agoSet the TLB caching properties for portals at attach time.
Justin Hibbits [Wed, 25 May 2016 01:23:19 +0000 (01:23 +0000)]
Set the TLB caching properties for portals at attach time.

This was found while reworking the device tree nodes for dtsec to match the
Linux device tree.  Instead of waiting and expecting later code to call
dpaa_portal_map_registers(), do the equivalent immediately upon mapping.
Otherwise, it's possible to access the pages before that function is called, and
hang the CPU.

8 years agoDelay calling yp_malloc_dnsent() until after some additional sanity
Don Lewis [Wed, 25 May 2016 00:25:38 +0000 (00:25 +0000)]
Delay calling yp_malloc_dnsent() until after some additional sanity
checks to avoid leaking memory on error returns.

Reported by: Coverity
CID: 1007416
MFC after: 1 week

8 years agoCall free(cur) if strdup(dirp->d_name) fails to avoid a memory leak.
Don Lewis [Wed, 25 May 2016 00:16:52 +0000 (00:16 +0000)]
Call free(cur) if strdup(dirp->d_name) fails to avoid a memory leak.

Reported by: Coverity
CID: 1007414
MFC after: 1 week

8 years agoefi loader: Match format string to EFI_ERROR_CODE()
Conrad Meyer [Wed, 25 May 2016 00:13:01 +0000 (00:13 +0000)]
efi loader: Match format string to EFI_ERROR_CODE()

Silence a format specifier warning.

Sponsored by: EMC / Isilon Storage Division

8 years agoFix acpidb CIDs 1011279 (Buffer not null terminated) and 978405 and
Don Lewis [Tue, 24 May 2016 23:41:36 +0000 (23:41 +0000)]
Fix acpidb CIDs 1011279 (Buffer not null terminated) and 978405 and
1199380 (Resource leak).

load_dsdt() calls strncpy() to copy a filename and Coverity warns
that the destination buffer may not be NUL terminated.  Fix this
by using strlcpy() instead.  If silent truncation occurs, then the
filename was not valid anyway.

load_dsdt() leaks an fd (CID 978405) and a memory region allocated
using mmap() (CID 1199380) when it returns.  Fix these by calling
close() and munmap() as appropriate.

Don't bother fixing the minor memory leak "list", allocated by
AcGetAllTablesFromFile() (CID 1355191).

Check for truncation when creating the temp file name.

Set a flag to indicate that the temp file should be unlinked.
Relying on a strcmp() test could delete the input file in contrived
cases.

Reported by: Coverity
CID: 1011279, 978405, 1199380
Reviewed by: jkim
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6368

8 years agoFix acpidump CID 1011278 (Buffer not null terminated) and other issues
Don Lewis [Tue, 24 May 2016 23:36:43 +0000 (23:36 +0000)]
Fix acpidump CID 1011278 (Buffer not null terminated) and other issues

Coverity reports that a buffer used for temporary file generation
might not be NUL terminated by strncpy().  This is probably not
true because the input gets passed through realpath(), but if the
path name is sufficiently long the name could be truncated and cause
other problems.  The code for generating the temp file names is
also overly complex.  Instead of a bunch of calls to strncpy() and
and strncat(), simplify the code by using snprintf() and add checks
for unexpected truncation.

The output file created by iasl -d is predictable.  Fix this by
using  mkdtemp() to create a directory to hold the iasl input and
output files.

Check the return values of more syscalls.

Reported by: Coverity
CID: 1011278
Reviewed by: jkim
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6360

8 years agoRegenerate
Bryan Drewery [Tue, 24 May 2016 23:19:03 +0000 (23:19 +0000)]
Regenerate

8 years agoWITH_META_MODE: Correct description of missing .meta file.
Bryan Drewery [Tue, 24 May 2016 23:15:52 +0000 (23:15 +0000)]
WITH_META_MODE: Correct description of missing .meta file.

Sponsored by: EMC / Isilon Storage Division

8 years ago[bhnd] Normalize bhnd(4) device matching API
Adrian Chadd [Tue, 24 May 2016 21:20:17 +0000 (21:20 +0000)]
[bhnd] Normalize bhnd(4) device matching API

This unifies handling of core, chip, and board-level device
matching, and adds support for matching device drivers
against the bus attach type (e.g. SoC vs WiFi adapter).

Core-level quirks on Broadcom's chipsets generally are specific
to some combination of chip model, core revision, chip
package (e.g. 12x9 SMT package), SROM revision, etc.

Unifying the match APIs for all three attribute types (core, chip,
board/srom) allows defining a single device quirk table that
matches across all of those attributes.

Submitted by: Landon Fuller <landonf@landonf.org>
Differential Revision:  https://reviews.freebsd.org/D6515

8 years agoSilence false LOR report due to the taskqueue mutex and kqueue lock
Konstantin Belousov [Tue, 24 May 2016 21:13:33 +0000 (21:13 +0000)]
Silence false LOR report due to the taskqueue mutex and kqueue lock
named the same.

Reported by: Doug Luce <doug@freebsd.con.com>
Sponsored by: The FreeBSD Foundation

8 years agoReturn the correct status when a partially completed request is cancelled.
John Baldwin [Tue, 24 May 2016 21:09:05 +0000 (21:09 +0000)]
Return the correct status when a partially completed request is cancelled.

After the previous changes to fix requests on blocking sockets to complete
across multiple operations, an edge case exists where a request can be
cancelled after it has partially completed.  POSIX doesn't appear to
dictate exactly how to handle this case, but in general I feel that
aio_cancel() should arrange to cancel any request it can, but that any
partially completed requests should return a partial completion rather
than ECANCELED.  To that end, fix the socket AIO cancellation routine to
return a short read/write if a partially completed request is cancelled
rather than ECANCELED.

Sponsored by: Chelsio Communications

8 years agoRemove unnecessary memset(.., 0, ..)'s
Enji Cooper [Tue, 24 May 2016 20:06:41 +0000 (20:06 +0000)]
Remove unnecessary memset(.., 0, ..)'s

The mem_alloc macro calls calloc (userspace) / malloc(.., M_WAITOK|M_ZERO)
under the covers, so zeroing out memory is already handled by the underlying
calls

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoFix up r300385
Enji Cooper [Tue, 24 May 2016 19:52:05 +0000 (19:52 +0000)]
Fix up r300385

I accidentally glossed over the fact that tmp is manipulated via strchr, so
if we tried to free `tmp` after r300385, it would have crashed.

Create a separate pointer (tmp2) to track the original allocation of `tmp`,
and free `tmp2` if `p->nc_lookups` can't be malloced

MFC after: 4 days
X-MFC with: r300385
Reported by: Coverity
CID: 1356026
Sponsored by: EMC / Isilon Storage Division

8 years agoIn vm_page_cache(), only drop the vnode after radix insert failure
Konstantin Belousov [Tue, 24 May 2016 19:20:30 +0000 (19:20 +0000)]
In vm_page_cache(), only drop the vnode after radix insert failure
for empty page cache when the object type if OBJT_VNODE.

Reported and tested by: pho
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoRemove redundant NULLing of outbuf_pmap
Enji Cooper [Tue, 24 May 2016 18:53:06 +0000 (18:53 +0000)]
Remove redundant NULLing of outbuf_pmap

If reallocf ever failed, outbuf_pmap would already be NULL

MFC after: 1 week
X-MFC with: r300620
Reported by: cem
Sponsored by: EMC / Isilon Storage Division

8 years agoUse reallocf instead of malloc to fix leak with outbuf_pmap
Enji Cooper [Tue, 24 May 2016 18:44:50 +0000 (18:44 +0000)]
Use reallocf instead of malloc to fix leak with outbuf_pmap

The previous code overwrote outbuf_pmap's memory with malloc once per
loop iteration, which leaked its memory; use reallocf instead to ensure
that memory is properly free'd each loop iteration.

Add a outbuf_pmap = NULL in the failure case to avoid a double-free
at the bottom of the function.

Differential Revision: https://reviews.freebsd.org/D6495
MFC after: 1 week
Reported by: Coverity
CID: 1038776
Reviewed by: markj, pfgj
Sponsored by: EMC / Isilon Storage Division

8 years agoTry to unbreak the build after r300611 by including the header
Bjoern A. Zeeb [Tue, 24 May 2016 17:38:27 +0000 (17:38 +0000)]
Try to unbreak the build after r300611 by including the header
defining VM_MIN_KERNEL_ADDRESS.

Sponsored by: DARPA/AFRL

8 years agoAdd initial DTrace support for RISC-V.
Ruslan Bukin [Tue, 24 May 2016 16:41:37 +0000 (16:41 +0000)]
Add initial DTrace support for RISC-V.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoSet dependencies for genassym.c.
Ruslan Bukin [Tue, 24 May 2016 16:30:05 +0000 (16:30 +0000)]
Set dependencies for genassym.c.
This fixes non-parallel build.

8 years ago[bhnd] fix compilation due to incompatible types
Adrian Chadd [Tue, 24 May 2016 15:39:57 +0000 (15:39 +0000)]
[bhnd] fix compilation due to incompatible types

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6532

8 years agoAdd kern.icl.iser_offloads sysctl.
Edward Tomasz Napierala [Tue, 24 May 2016 14:34:36 +0000 (14:34 +0000)]
Add kern.icl.iser_offloads sysctl.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoStore the original value of stack pointer to the exception frame
Ruslan Bukin [Tue, 24 May 2016 13:59:13 +0000 (13:59 +0000)]
Store the original value of stack pointer to the exception frame
(the value we had before supervisor exception occurred).
This helps consumers (e.g. DTrace) to not proceed additional calculations.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoBump copyright year
Steven Kreuzer [Tue, 24 May 2016 13:58:07 +0000 (13:58 +0000)]
Bump copyright year

Approved by: gjb@ (implicit)

8 years agoReject ioctl commands for FLSHGCHR and FLSHPCHR if the size is greater
Sean Bruno [Tue, 24 May 2016 13:57:23 +0000 (13:57 +0000)]
Reject ioctl commands for FLSHGCHR and FLSHPCHR if the size is greater
than sc->areq.  This is a bounds check to ensure we're not just cramming
arbitrarily sized nonsense into the driver and overflowing the heap.

PR: 209545
Submitted by: cturt@hardenedbsd.org
MFC after: 2 weeks

8 years agoMark all memory before the kernel as toxic to DTrace.
Andrew Turner [Tue, 24 May 2016 13:57:23 +0000 (13:57 +0000)]
Mark all memory before the kernel as toxic to DTrace.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoRe-enable write combining, disabled by default at r295486.
Alexander Motin [Tue, 24 May 2016 12:40:03 +0000 (12:40 +0000)]
Re-enable write combining, disabled by default at r295486.

if_ntb(4) strongly benefits from WC, improving throughput from 350Mbit/s
to 8-10Gbit/s on my tests.

MFC after: 1 week

8 years agosfxge(4): enable Medford support
Andrew Rybchenko [Tue, 24 May 2016 12:20:23 +0000 (12:20 +0000)]
sfxge(4): enable Medford support

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6510

8 years agosfxge(4): bump driver version to the closest out-of-tree version
Andrew Rybchenko [Tue, 24 May 2016 12:19:14 +0000 (12:19 +0000)]
sfxge(4): bump driver version to the closest out-of-tree version

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agosfxge(4): cleanup: update copyright to 2016
Andrew Rybchenko [Tue, 24 May 2016 12:16:57 +0000 (12:16 +0000)]
sfxge(4): cleanup: update copyright to 2016

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6509

8 years agosfxge(4): provide option to disable not a local MAC address check
Andrew Rybchenko [Tue, 24 May 2016 12:15:30 +0000 (12:15 +0000)]
sfxge(4): provide option to disable not a local MAC address check

Option EFSYS_OPT_ALLOW_UNCONFIGURED_NIC disables check that the adapter
MAC address is not a local address (beginning 02).

Submitted by:   Laurence Evans <levans at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6508

8 years agosfxge(4): be ready to receive events immediately after event queues are created
Andrew Rybchenko [Tue, 24 May 2016 12:14:19 +0000 (12:14 +0000)]
sfxge(4): be ready to receive events immediately after event queues are created

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6507

8 years agoLimit calling pmc_hook to when the interrupt comes while running userspace.
Andrew Turner [Tue, 24 May 2016 12:06:56 +0000 (12:06 +0000)]
Limit calling pmc_hook to when the interrupt comes while running userspace.
We may enable interrupts from within the callback, e.g. in a data abort
during copyin. If we receive an interrupt at that time pmc_hook will be
called again and, as it is handling userspace stack tracing, will hit a
KASSERT as it checks if the trapframe is from userland.

With this I can run hwpmc with intrng on a ThunderX and have it trace all
CPUs.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoAllow an MTU of 65535 bytes to be set via TUN[SG]IFINFO. This requires
Michael Tuexen [Tue, 24 May 2016 11:47:14 +0000 (11:47 +0000)]
Allow an MTU of 65535 bytes to be set via TUN[SG]IFINFO. This requires
changing the type on the mtu field in struct tuninfo from short to
unsigned short.
This is used, for example, by packetdrill to test with MTUs up to the
maximum value.

Differential Revision: 6452

8 years agoThe NAS-Identifier attribute is a string, not an integer.
Dag-Erling Smørgrav [Tue, 24 May 2016 11:44:43 +0000 (11:44 +0000)]
The NAS-Identifier attribute is a string, not an integer.

MFC after: 1 week

8 years agoIn vm_page_alloc_contig(), on vm_page_insert() failure, mark each
Konstantin Belousov [Tue, 24 May 2016 10:21:39 +0000 (10:21 +0000)]
In vm_page_alloc_contig(), on vm_page_insert() failure, mark each
freed page as VPO_UNMANAGED.  Otherwise vm_pge_free_toq() insists on
owning the page lock.

Previously, VPO_UNMANAGED was only set up to the last processed page.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoRemove Giant around allocation of the swap pager with non-NULL handle.
Konstantin Belousov [Tue, 24 May 2016 10:16:03 +0000 (10:16 +0000)]
Remove Giant around allocation of the swap pager with non-NULL handle.
Existing issue of not protecting pager_object_list iteration in
vm_pager_object_lookup() by sw_alloc_mtx is not affected by Giant
removal.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation

8 years agoAdd __iowrite32_copy() to the Linux kernel compatibility layer.
Kevin Lo [Tue, 24 May 2016 09:23:04 +0000 (09:23 +0000)]
Add __iowrite32_copy() to the Linux kernel compatibility layer.

Reviewed by: hselasky

8 years agoRename kern.icl.drivers to kern.icl.offloads, for consistency.
Edward Tomasz Napierala [Tue, 24 May 2016 08:54:41 +0000 (08:54 +0000)]
Rename kern.icl.drivers to kern.icl.offloads, for consistency.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoAdd mechanism for choosing iSER-capable ICL modules.
Edward Tomasz Napierala [Tue, 24 May 2016 08:44:45 +0000 (08:44 +0000)]
Add mechanism for choosing iSER-capable ICL modules.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoUse the DROP_GIANT() and PICKUP_GIANT() macros instead of making
Hans Petter Selasky [Tue, 24 May 2016 07:52:53 +0000 (07:52 +0000)]
Use the DROP_GIANT() and PICKUP_GIANT() macros instead of making
assumptions about how the Giant mutex is locked.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoSet "current" for all PCI enumeration callbacks.
Hans Petter Selasky [Tue, 24 May 2016 07:46:20 +0000 (07:46 +0000)]
Set "current" for all PCI enumeration callbacks.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agohyperv/vmbus: Free message taskqueue during interrupt teardown
Sepherosa Ziehau [Tue, 24 May 2016 07:07:11 +0000 (07:07 +0000)]
hyperv/vmbus: Free message taskqueue during interrupt teardown

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6506

8 years agoUse make_dev_s() instead of make_dev() to avoid race setting
Hans Petter Selasky [Tue, 24 May 2016 07:06:04 +0000 (07:06 +0000)]
Use make_dev_s() instead of make_dev() to avoid race setting
"si_drv1". Convert panic() into regular error while at it.

Suggested by: jhb @
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agohyperv/vmbus: Factor out functions for vmbus interrupt set/teardown
Sepherosa Ziehau [Tue, 24 May 2016 06:42:14 +0000 (06:42 +0000)]
hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown

This paves way for further cleanup and fix.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6505

8 years agohyperv/vmbus: Git rid of sc version of pcpu data extraction macro
Sepherosa Ziehau [Tue, 24 May 2016 06:10:21 +0000 (06:10 +0000)]
hyperv/vmbus: Git rid of sc version of pcpu data extraction macro

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6503

8 years agohyperv/vmbus: Use busdma(9) for messages and event flags
Sepherosa Ziehau [Tue, 24 May 2016 06:01:39 +0000 (06:01 +0000)]
hyperv/vmbus: Use busdma(9) for messages and event flags

And
- Move message and event flags to vmbus_softc per-cpu data.
- Get rid of hv_setup_arg, which serves no purpose now.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6502

8 years agohyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file
Sepherosa Ziehau [Tue, 24 May 2016 05:51:51 +0000 (05:51 +0000)]
hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file

Avoid unnecessary exposure.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6501

8 years agohyperv/vmbus: Rename local variable and break long lines
Sepherosa Ziehau [Tue, 24 May 2016 05:43:55 +0000 (05:43 +0000)]
hyperv/vmbus: Rename local variable and break long lines

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6500

8 years agoDon't leak fp in case where fo_ioctl() returns an error.
Dmitry Chagin [Tue, 24 May 2016 05:29:41 +0000 (05:29 +0000)]
Don't leak fp in case where fo_ioctl() returns an error.

Reported by: C Turt <ecturt@gmail.com>
MFC after: 1 week

8 years agohyperv/busdma: Take BUS_DMA_ZERO into account
Sepherosa Ziehau [Tue, 24 May 2016 05:26:52 +0000 (05:26 +0000)]
hyperv/busdma: Take BUS_DMA_ZERO into account

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6499

8 years agohyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()
Sepherosa Ziehau [Tue, 24 May 2016 05:18:26 +0000 (05:18 +0000)]
hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6498

8 years agohyperv/vmbus: Move vmbus interrupt counter into vmbus softc
Sepherosa Ziehau [Tue, 24 May 2016 05:06:01 +0000 (05:06 +0000)]
hyperv/vmbus: Move vmbus interrupt counter into vmbus softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6497

8 years agoFix CID 1006692 in /usr/sbin/pw pw_log() function and other fixes
Don Lewis [Tue, 24 May 2016 05:02:24 +0000 (05:02 +0000)]
Fix CID 1006692 in /usr/sbin/pw pw_log() function and other fixes

The length of the name returned from the $LOGNAME and $USER can be
very long and it was being concatenated to a fixed length buffer
with no bounds checking.  Fix this problem by limiting the length
of the name copied.

Additionally, this name is actually used to create a format string
to be used in adding log file entries so embedded % characters in
the name could confuse *printf(), and embedded whitespace could
confuse a log file parser.  Handle the former by escaping each %
with an additional %, and handle the latter by simply stripping it
out.

Clean up the code by moving the variable declarations to the top
of the function, formatting them to conform with style, and moving
intialization elsewhere.

Reduce code indentation by returning early in a couple of places.

Reported by: Coverity
CID: 1006692
Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6490

8 years ago[bwn] begin separating out the attach path from the SIBA specific bits.
Adrian Chadd [Tue, 24 May 2016 04:58:58 +0000 (04:58 +0000)]
[bwn] begin separating out the attach path from the SIBA specific bits.

* convert phy_getinfo() to take a "gmode" flag, rather than the siba
  TGSHIGH flags and then check for 2GHz.  This should ensure that
  gmode is set correctly even on DUALPHY NICs.
* move the siba_powerup() call and the TGSHIGH decoding into a
  call to bwn_is_bus_siba(), and return an error if it's called
  on anything else.  We don't yet do anything else, but when we do..

Tested:

* BCM4322, 11a STA

8 years ago[bwn] add BCM43225 to the BHND device list.
Adrian Chadd [Tue, 24 May 2016 04:55:00 +0000 (04:55 +0000)]
[bwn] add BCM43225 to the BHND device list.

This is all for the bhnd(4) work in progress.  It's enough to probe/attach
all the bhnd internals, but we're missing OTP support and some cleanup
code.  And, well, all the rest of the bhnd(4) migration.

So no, this won't give you BCM43225 support.  Sorry!

8 years agoIt seems <sys/types.h> is a new prerequisite for <bitstring.h> after
Peter Wemm [Tue, 24 May 2016 03:15:46 +0000 (03:15 +0000)]
It seems <sys/types.h> is a new prerequisite for <bitstring.h> after
r300539. Attempt to fix the build for i386.

8 years agoDon't prematurely return short completions on blocking sockets.
John Baldwin [Tue, 24 May 2016 03:13:27 +0000 (03:13 +0000)]
Don't prematurely return short completions on blocking sockets.

Always requeue an AIO job at the head of the socket buffer's queue if
sosend() or soreceive() returns EWOULDBLOCK on a blocking socket.
Previously, requests were only requeued if they returned EWOULDBLOCK
and completed no data.  Now after a partial completion on a blocking
socket the request is queued and the remaining request is retried when
the socket is ready.  This allows writes larger than the currently
available space on a blocking socket to fully complete.  Reads on a
blocking socket that satifsy the low watermark can still return a short
read (same as read()).

In order to track previously completed data, the internal 'status'
field of the AIO job is used to store the amount of previously
computed data.

Non-blocking sockets continue to return short completions for both
reads and writes.

Add a test for a "large" AIO write on a blocking socket that writes
twice the socket buffer size to a UNIX domain socket.

Sponsored by: Chelsio Communications

8 years agoUpdate some of the TBD entries in ciss(4) to match what's in the pci
Sean Bruno [Tue, 24 May 2016 01:42:21 +0000 (01:42 +0000)]
Update some of the TBD entries in ciss(4) to match what's in the pci
IDS data.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

8 years agoMove the OFW iicbus code to dev/iicbus to stop polluting dev/ofw with
Luiz Otavio O Souza [Tue, 24 May 2016 01:33:49 +0000 (01:33 +0000)]
Move the OFW iicbus code to dev/iicbus to stop polluting dev/ofw with
unrelated code.

Discussed with: nwhitehorn (a long time ago)

8 years ago[bwn] add extra debugging for non-SIBA devices.
Adrian Chadd [Tue, 24 May 2016 01:20:30 +0000 (01:20 +0000)]
[bwn] add extra debugging for non-SIBA devices.

This is a no-op at the present moment, but will eventually remind me
where the SIBA specific demons lie.

Tested:

* BCM4322, STA mode

8 years ago[bhnd] Implement pass-through resource management for ChipCommon.
Adrian Chadd [Tue, 24 May 2016 01:12:19 +0000 (01:12 +0000)]
[bhnd] Implement pass-through resource management for ChipCommon.

This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY
resources with its children, allowing us to hang devices off of
bhnd_chipc that rely on access to a subset of the device register space
that bhnd_chipc itself must also allocate.

We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY
wasn't limited to use with allocations at the same size/offset.

As a work-around, I implemented something similar to vga_pci.c, which
implements similar reference counting of of PCI BAR resources for its
children.

With these changes, chipc will use reference counting of SYS_RES_MEMORY
allocation/activation requests, to decide when to allocate/activate/
deactivate/release resources from the parent bhnd(4) bus.

The requesting child device is allocated a new resource from chipc's
rman, pointing to (possibly a subregion of) the refcounted bhnd resources
allocated by chipc.

Other resource types are just passed directly to the parent bhnd bus;
RF_SHAREABLE works just fine with IRQs.

I also lifted the SPROM device code out into a common driver, since this
now allows me to hang simple subclasses off of a common driver off of both
bhndb_pci and bhnd_chipc.

Tested:

* (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still
  attaches and can be queried.

Submitted by: Landon Fuller <landonf@landonf.org>
Reviewed by: mizkha@gmail.com
Differential Revision: https://reviews.freebsd.org/D6471

8 years agoFix multiple Coverity Out-of-bounds access false postive issues in CAM
Don Lewis [Tue, 24 May 2016 00:57:11 +0000 (00:57 +0000)]
Fix multiple Coverity Out-of-bounds access false postive issues in CAM

The currently used idiom for clearing the part of a ccb after its
header generates one or two Coverity errors for each time it is
used.  All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON)
error because of the treatment of the header as a two element array,
with a pointer to the non-existent second element being passed as
the starting address to bzero().  Some instances also alsp generate
Out-of-bounds access (OVERRUN) errors, probably because the space
being cleared is larger than the sizeofstruct ccb_hdr).

In addition, this idiom is difficult for humans to understand and
it is error prone.  The user has to chose the proper struct ccb_*
type (which does not appear in the surrounding code) for the sizeof()
in the length calculation.  I found several instances where the
length was incorrect, which could cause either an actual out of
bounds write, or incompletely clear the ccb.

A better way is to write the code to clear the ccb itself starting
at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate
the length based on the specific type of struct ccb_* being cleared
as specified by the union ccb member being used.  The latter can
normally be seen in the nearby code.  This is friendlier for Coverity
and other static analysis tools because they will see that the
intent is to clear the trailing part of the ccb.

Wrap all of the boilerplate code in a convenient macro that only
requires a pointer to the desired union ccb member (or a pointer
to the union ccb itself) as an argument.

Reported by: Coverity
CID: 100757810086841009724100977310113041011306
CID: 101130710113081011309101131010113111011312
CID: 101131310113141011315101131610113171011318
CID: 101131910113201011321101132210113241011325
CID: 101132610113271011328101132910113301011374
CID: 101139010113911011392101139310113941011395
CID: 101139610113971011398101139910114001011401
CID: 101140210114031011404101140510114061011408
CID: 101140910114101011411101141210114131011414
CID: 101746110183871086860108687411942571229897
CID: 122996813062291306234133128213312831331294
CID: 133129513315351331536133153913315401341623
CID: 13416241341637134163813552641355324
Reviewed by: scottl, ken, delphij, imp
MFH: 1 month
Differential Revision: https://reviews.freebsd.org/D6496

8 years agoOnly set kern.geom.part.mbr.enforce_chs=0 once, instead of once per disk
Allan Jude [Tue, 24 May 2016 00:23:39 +0000 (00:23 +0000)]
Only set kern.geom.part.mbr.enforce_chs=0 once, instead of once per disk

Sponsored by: ScaleEngine Inc.

8 years agoAdd support for RAID 1+0 (striped mirrors) to bsdinstall/zfsboot
Allan Jude [Tue, 24 May 2016 00:22:29 +0000 (00:22 +0000)]
Add support for RAID 1+0 (striped mirrors) to bsdinstall/zfsboot

Sponsored by: ScaleEngine Inc.

8 years agoFix build of kern/subr_unit.c, broken by r300539
Alan Somers [Tue, 24 May 2016 00:14:58 +0000 (00:14 +0000)]
Fix build of kern/subr_unit.c, broken by r300539

Reported by: peter
Pointyhat to: asomers
Sponsored by: Spectra Logic Corp

8 years agoDocument POPCNT erratum for 6th Generation Intel Core processors.
Jung-uk Kim [Mon, 23 May 2016 23:00:47 +0000 (23:00 +0000)]
Document POPCNT erratum for 6th Generation Intel Core processors.