Commit Graph

212702 Commits

Author SHA1 Message Date
Sepherosa Ziehau
6d6baea80d 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
2016-05-25 05:53:12 +00:00
Sepherosa Ziehau
c1d5ebc5a4 hyperv/vmbus: Nuke unnecessary MSR read
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6528
2016-05-25 05:45:43 +00:00
Sepherosa Ziehau
8239b2f287 hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6527
2016-05-25 05:37:42 +00:00
Sepherosa Ziehau
c4592280be hyperv/vmbus: Minor style and white space cleanup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6523
2016-05-25 05:30:48 +00:00
Sepherosa Ziehau
20bce8fa9f 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
2016-05-25 05:22:35 +00:00
Don Lewis
b1b73fc4c9 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
2016-05-25 05:20:34 +00:00
Don Lewis
5912ca59b0 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
2016-05-25 05:12:56 +00:00
Sepherosa Ziehau
14aa3e8097 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
2016-05-25 05:06:15 +00:00
Sepherosa Ziehau
95a45414a0 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
2016-05-25 04:59:20 +00:00
Sepherosa Ziehau
bd5465a441 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
2016-05-25 03:39:42 +00:00
Sepherosa Ziehau
01ac237df2 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
2016-05-25 03:30:56 +00:00
Don Lewis
8dd8cd00e2 Close from_fd if malloc() fails to avoid a file descriptor leak.
Reported by:	Coverity
CID:		1007203
MFC after:	1 week
2016-05-25 02:51:15 +00:00
Don Lewis
ae100660d4 Match the descriptions of the \H and \h prompt string sequences to reality.
They were swapped.

X-Confirmed by:	jilles
MFC after:	1 week
2016-05-25 02:10:30 +00:00
Kenneth D. Merry
600fd98ff3 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
2016-05-25 01:37:39 +00:00
Don Lewis
9d80a8b09e 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:		1340543, 1340544
Reviewed by:	araujo
Differential Revision:	https://reviews.freebsd.org/D6550
2016-05-25 01:37:25 +00:00
Cy Schubert
3f9e9f234e 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
2016-05-25 01:35:02 +00:00
Justin Hibbits
0e9f21dc24 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.
2016-05-25 01:23:19 +00:00
Don Lewis
5fb70b0cae 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
2016-05-25 00:25:38 +00:00
Don Lewis
a23f17d3b1 Call free(cur) if strdup(dirp->d_name) fails to avoid a memory leak.
Reported by:	Coverity
CID:		1007414
MFC after:	1 week
2016-05-25 00:16:52 +00:00
Conrad Meyer
241adf4455 efi loader: Match format string to EFI_ERROR_CODE()
Silence a format specifier warning.

Sponsored by:	EMC / Isilon Storage Division
2016-05-25 00:13:01 +00:00
Don Lewis
668bf37a0e 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
2016-05-24 23:41:36 +00:00
Don Lewis
7e2cc014bd 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
2016-05-24 23:36:43 +00:00
Bryan Drewery
fe3c46927c Regenerate 2016-05-24 23:19:03 +00:00
Bryan Drewery
63decaa682 WITH_META_MODE: Correct description of missing .meta file.
Sponsored by:	EMC / Isilon Storage Division
2016-05-24 23:15:52 +00:00
Adrian Chadd
5ad9ac037d [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
2016-05-24 21:20:17 +00:00
Konstantin Belousov
c5e44d6cd5 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
2016-05-24 21:13:33 +00:00
John Baldwin
778ce4f297 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
2016-05-24 21:09:05 +00:00
Enji Cooper
cb05064e70 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
2016-05-24 20:06:41 +00:00
Enji Cooper
8f5cc69027 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
2016-05-24 19:52:05 +00:00
Konstantin Belousov
0e38422096 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
2016-05-24 19:20:30 +00:00
Enji Cooper
3c048026b5 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
2016-05-24 18:53:06 +00:00
Enji Cooper
75cd48a1c1 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
2016-05-24 18:44:50 +00:00
Bjoern A. Zeeb
9c759b587f Try to unbreak the build after r300611 by including the header
defining VM_MIN_KERNEL_ADDRESS.

Sponsored by:	DARPA/AFRL
2016-05-24 17:38:27 +00:00
Ruslan Bukin
fed1ca4b71 Add initial DTrace support for RISC-V.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-05-24 16:41:37 +00:00
Ruslan Bukin
fa851a8bfb Set dependencies for genassym.c.
This fixes non-parallel build.
2016-05-24 16:30:05 +00:00
Adrian Chadd
b80427f906 [bhnd] fix compilation due to incompatible types
Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6532
2016-05-24 15:39:57 +00:00
Edward Tomasz Napierala
09c84055a0 Add kern.icl.iser_offloads sysctl.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-24 14:34:36 +00:00
Ruslan Bukin
892933d079 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
2016-05-24 13:59:13 +00:00
Steven Kreuzer
f4522a2f44 Bump copyright year
Approved by:	gjb@ (implicit)
2016-05-24 13:58:07 +00:00
Sean Bruno
6115013663 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
2016-05-24 13:57:23 +00:00
Andrew Turner
0d0da76911 Mark all memory before the kernel as toxic to DTrace.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-05-24 13:57:23 +00:00
Alexander Motin
b72a6f8a8f 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
2016-05-24 12:40:03 +00:00
Andrew Rybchenko
131bc376b9 sfxge(4): enable Medford support
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6510
2016-05-24 12:20:23 +00:00
Andrew Rybchenko
1baf53ec8d sfxge(4): bump driver version to the closest out-of-tree version
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-24 12:19:14 +00:00
Andrew Rybchenko
929c7feb83 sfxge(4): cleanup: update copyright to 2016
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6509
2016-05-24 12:16:57 +00:00
Andrew Rybchenko
ecaa500c4b 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
2016-05-24 12:15:30 +00:00
Andrew Rybchenko
bdb482bfa0 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
2016-05-24 12:14:19 +00:00
Andrew Turner
974692e3bf 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
2016-05-24 12:06:56 +00:00
Michael Tuexen
b5994a5c26 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
2016-05-24 11:47:14 +00:00
Dag-Erling Smørgrav
6e8d69ad38 The NAS-Identifier attribute is a string, not an integer.
MFC after:	1 week
2016-05-24 11:44:43 +00:00