]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoInclude machine/acle-compat.h in cdefs.h on arm if the compiler doesn't
ian [Wed, 25 May 2016 19:44:26 +0000 (19:44 +0000)]
Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't
have ACLE support built in.  The ACLE (ARM C Language Extensions) defines
a set of standardized symbols which indicate the architecture version and
features available.  ACLE support is built in to modern compilers (both
clang and gcc), but absent from gcc prior to 4.4.

ARM (the company) provides the acle-compat.h header file to define the
right symbols for older versions of gcc.  Basically, acle-compat.h does
for arm about the same thing cdefs.h does for freebsd: defines
standardized macros that work no matter which compiler you use.  If ARM
hadn't provided this file we would have ended up with a big #ifdef __arm__
section in cdefs.h with our own compatibility shims.

Remove #include <machine/acle-compat.h> from the zillion other places (an
ever-growing list) that it appears.  Since style(9) requires sys/types.h
or sys/param.h early in the include list, and both of those lead to
including cdefs.h, only a couple special cases still need to include
acle-compat.h directly.

Loves it:     imp

8 years agoClose the input FILE * in read_file() and the output FILE * in write_file()
truckman [Wed, 25 May 2016 18:38:30 +0000 (18:38 +0000)]
Close the input FILE * in read_file() and the output FILE * in write_file()
if read_stream() or write_stream() fails to avoid leaking the FILE.

Reported by: Coverity
CID: 977702
Reviewed by: pfg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6554

8 years agoFix issues found by Coverity in the rtld-elf.c:gethints().
kib [Wed, 25 May 2016 18:10:44 +0000 (18:10 +0000)]
Fix issues found by Coverity in the rtld-elf.c:gethints().

Check that the dirlist path string specification does not cause
overflow and is fully contained in the hints file.
Check that the dirlist string is nul-terminated.
Make 'hdr' static variable, so that hdr.dirlistlen is available when
hints cached value is used on next function calls.  Reset hdr.dirlistlen
to zero if error was detected, so that allocations use reasonable size.
Use 'hints', and not 'p' in the body, since p is only initialized on the
first call.

Reported and reviewed by: truckman (previous version)
Sponsored by: The FreeBSD Foundation
CIDs: 10065031006504100667610084881007263
MFC after: 2 weeks

8 years agoDo not generate code for sbrk syscall -- sbrk support was removed.
br [Wed, 25 May 2016 16:38:10 +0000 (16:38 +0000)]
Do not generate code for sbrk syscall -- sbrk support was removed.

Pointed out by: andrew

8 years agoSend an ICMP packet indicating destination unreachable/protocol
tuexen [Wed, 25 May 2016 15:54:21 +0000 (15:54 +0000)]
Send an ICMP packet indicating destination unreachable/protocol
unreachable if we don't handle the packet in the kernel and not
in userspace.

MFC after: 1 week

8 years agoFix a couple of Coverity Unintended sign extension sign extension
truckman [Wed, 25 May 2016 15:49:29 +0000 (15:49 +0000)]
Fix a couple of Coverity Unintended sign extension sign extension
defects.  When shifting an unsigned byte into the upper 8 bits of
an int and the resulting value is greater than 0x7FFFFFF, the result
will be sign extended when converting to a 64 bit unsigned long.
Fix by casting to (uint64_t) before the shift.

Reported by: Coverity
CID: 13560441356045
Reviewed by: ken

8 years agoFix a couple of new instances of a false positive Coverity buffer
truckman [Wed, 25 May 2016 15:43:01 +0000 (15:43 +0000)]
Fix a couple of new instances of a false positive Coverity buffer
overflow defect.  Use the new CCB_CLEAR_ALL_EXCEPT_HDR() macro
instead of the calling bzero() on the pointer to the header used
as an array and indexed by 1.

Don't leak a buffer after executing "goto restart_report" by
overwriting its pointer with the results of another calloc().
Be sure to clear the buffer before reusing it.  (CID 1356042)

Reported by: Coverity
CID: 13560221356034135602313560351356042
Reviewed by: ken

8 years agosed: convert sed to use REG_STARTEND more explicitly.
pfg [Wed, 25 May 2016 15:42:39 +0000 (15:42 +0000)]
sed: convert sed to use REG_STARTEND more explicitly.

Summarizing the findings in the OpenBSD list:

This solves a reproduceable issue with very recent Mesa where REG_NOTBOL
combined with a match at the begin of the string causes our regex library
to treat the word as not begin of word.

Thanks to Martijn van Duren and Ingo Schwarze for taking the time to
solve this in the least invasive way.

PR: 209352, 209387
Taken from:     openbsd-tech (Martijn van Duren)
MFC after: 1 month

8 years agolibc: regexec(3) adjustment.
pfg [Wed, 25 May 2016 15:35:23 +0000 (15:35 +0000)]
libc: regexec(3) adjustment.

Change the behavior of when REG_STARTEND is combined with REG_NOTBOL.

From the original posting[1]:

"Enable the assumption that pmatch[0].rm_so is a continuation offset
to  a string and allows us to do a proper assessment of the character
in  regards to it's word position ('^' or '\<'), without risking going
into unallocated memory."

This change makes us similar to how glibc handles REG_STARTEND |
REG_NOTBOL, and is closely related to a soon-to-land fix to sed.

Special thanks to Martijn van Duren and Ingo Schwarze for working
out some consistent behaviour.

Differential Revision: https://reviews.freebsd.org/D6257
Taken from: openbsd-tech 2016-05-24 [1]  (Martijn van Duren)
Relnotes: yes
MFC after: 1 month

8 years agoRemove legacy brk and sbrk from RISC-V.
br [Wed, 25 May 2016 14:08:21 +0000 (14:08 +0000)]
Remove legacy brk and sbrk from RISC-V.

Discussed with: andrew
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoCount packets as not being delivered only if they are neither
tuexen [Wed, 25 May 2016 13:48:26 +0000 (13:48 +0000)]
Count packets as not being delivered only if they are neither
processed by a kernel handler nor by a raw socket.

MFC after: 1 week

8 years agoSend whois queries for gov.uk names to JANET.
fanf [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.
hselasky [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
hselasky [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.
br [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
skra [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
hselasky [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
n_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 [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
hselasky [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.
truckman [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()
truckman [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().
truckman [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()
truckman [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.
truckman [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
sgalabov [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
sgalabov [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)
sgalabov [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
sephe [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
sephe [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
sephe [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
sephe [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
sephe [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
sephe [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.
truckman [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.
truckman [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
sephe [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
sephe [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
sephe [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
sephe [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.
truckman [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.
truckman [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:
ken [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
truckman [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 [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.
jhibbits [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
truckman [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.
truckman [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()
cem [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
truckman [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
truckman [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
bdrewery [Tue, 24 May 2016 23:19:03 +0000 (23:19 +0000)]
Regenerate

8 years agoWITH_META_MODE: Correct description of missing .meta file.
bdrewery [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 [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
kib [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.
jhb [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
ngie [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
ngie [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
kib [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
ngie [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
ngie [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
bz [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.
br [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.
br [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 [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.
trasz [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
br [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
skreuzer [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
sbruno [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 [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.
mav [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
arybchik [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
arybchik [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
arybchik [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
arybchik [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
arybchik [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 [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
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.
des [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
kib [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.
kib [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.
kevlo [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.
trasz [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.
trasz [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
hselasky [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.
hselasky [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
sephe [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
hselasky [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
sephe [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
sephe [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
sephe [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
sephe [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
sephe [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.
dchagin [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
sephe [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()
sephe [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
sephe [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
truckman [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 [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 [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!