]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoDefine ATOMIC_LONG_INIT() in the LinuxKPI.
hselasky [Thu, 26 May 2016 10:03:22 +0000 (10:03 +0000)]
Define ATOMIC_LONG_INIT() in the LinuxKPI.

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

8 years agoThe taskqueue_enqueue_fast() was removed in r296272.
trasz [Thu, 26 May 2016 09:53:24 +0000 (09:53 +0000)]
The taskqueue_enqueue_fast() was removed in r296272.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoBring in the Mellanox implementation of iSER (iSCSI over RDMA) initiator,
trasz [Thu, 26 May 2016 09:49:29 +0000 (09:49 +0000)]
Bring in the Mellanox implementation of iSER (iSCSI over RDMA) initiator,
written by Sagi Grimberg <sagig at mellanox.com> and Max Gurtovoy
<maxg at mellanox.com>.

This code comes from https://github.com/sagigrimberg/iser-freebsd, branch
iser-rebase-11-current-r291993.  It's not connected to the build just yet;
it still needs some tweaks to adapt to my changes to iSCSI infrastructure.

Big thanks to Mellanox for their support for FreeBSD!

Obtained from: Mellanox Technologies
MFC after: 1 month
Relnotes: yes

8 years agoOnly calibrate ICR read loop when not in x2APIC mode. Run-time
kib [Thu, 26 May 2016 09:09:11 +0000 (09:09 +0000)]
Only calibrate ICR read loop when not in x2APIC mode.  Run-time
switching between LAPIC modes is not supported, and there is no need
to wait for IPI ack in x2APIC mode.  So the calibrated delay is only
needed for !x2APIC.

This saves around a second of boot time on the real hardware for
x2APIC.

Sponsored by: The FreeBSD Foundation

8 years agoAdd support for runtime modifiable module parameters in the LinuxKPI.
hselasky [Thu, 26 May 2016 09:04:14 +0000 (09:04 +0000)]
Add support for runtime modifiable module parameters in the LinuxKPI.

Linux module parameters have a permissions value. If any write bits
are set we are allowed to modify the module parameter runtime. Reflect
this when creating the static SYSCTL nodes.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoAdd more module parameter macros to the LinuxKPI.
hselasky [Thu, 26 May 2016 08:47:06 +0000 (08:47 +0000)]
Add more module parameter macros to the LinuxKPI.

Obtained from: kmacy @
Sponsored by: Mellanox Technologies

8 years agoAdd support for boolean module parameters in the LinuxKPI.
hselasky [Thu, 26 May 2016 08:44:11 +0000 (08:44 +0000)]
Add support for boolean module parameters in the LinuxKPI.

Requested by: kmacy @
Sponsored by: Mellanox Technologies

8 years agoAdd support for boolean sysctl's.
hselasky [Thu, 26 May 2016 08:41:55 +0000 (08:41 +0000)]
Add support for boolean sysctl's.

Because the size of bool can be implementation defined, make a bool
sysctl handler which handle bools. Userspace sees the bools like
unsigned 8-bit integers. Values are filtered to either 1 or 0 upon
read and write, similar to what a compiler would do.

Requested by: kmacy @
Sponsored by: Mellanox Technologies

8 years ago[gpiospi] add initial gpio SPI bit bang driver.
adrian [Thu, 26 May 2016 07:20:33 +0000 (07:20 +0000)]
[gpiospi] add initial gpio SPI bit bang driver.

Submitted by: ray
Obtained from: zrouter

8 years agoThe readme provides a high-level overview of how to upgrade top(1).
ngie [Thu, 26 May 2016 07:09:42 +0000 (07:09 +0000)]
The readme provides a high-level overview of how to upgrade top(1).

Differential Revision: https://reviews.freebsd.org/D6493
MFC after: 1 week
Reviewed By: ngie
Submitted by: Randy Westlund <rwestlun@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years ago[spigen] add initial spigen driver from green@
adrian [Thu, 26 May 2016 07:02:20 +0000 (07:02 +0000)]
[spigen] add initial spigen driver from green@

This is a simple ioctl and mmap API to issue SPI transactions from
userland.  It's useful for simple devices (eg spi temperature sensors,
etc) for experimentation.

TODO:

* Write some documentation!

Submitted by: green

8 years ago[spibus] implement maximum clock frequency lookup from ofw.
adrian [Thu, 26 May 2016 06:37:33 +0000 (06:37 +0000)]
[spibus] implement maximum clock frequency lookup from ofw.

Obtained from: loos

8 years ago[spibus] add missing break.
adrian [Thu, 26 May 2016 06:36:58 +0000 (06:36 +0000)]
[spibus] add missing break.

Pointy hat to: me

8 years ago[spibus] add initial placeholders for transfer mode and frequency.
adrian [Thu, 26 May 2016 06:35:11 +0000 (06:35 +0000)]
[spibus] add initial placeholders for transfer mode and frequency.

This doesn't yet implement it in the controllers or the transfer
calls, but it's a start.

Obtained from: loos (frequency), ray/zrouter (transfer mode)

8 years agoAnother round of changes to add compatibility with the older ESHDC variety
ian [Thu, 26 May 2016 03:55:27 +0000 (03:55 +0000)]
Another round of changes to add compatibility with the older ESHDC variety
of hardware.  Mostly this focuses on the big changes needed for setting the
bus clock, because ESDHC is SDHCI v2.0 and USDHC is 3.0, and the number,
location, and interpretation of clock divisor bits is vastly different
between the two.  This doesn't get the device all the way to functioning
on ESDHC hardware yet, but it's much closer, now getting through all the
card detection and negotiation of capabilties and speed (but it eventually
hangs on what appears to be a missing interrupt).

Another missing chunk of code for handling ESDHC's 32 bit command-and-mode
register using sdhci's pair of 16 bit writes is added.

This also does some leading whitespace cleanups and sorts some softc
struct members by size, and adds some comments (because when do I ever
touch code without adding comments?).

8 years agohyperv: Rework guest id settings according to Hyper-V spec
sephe [Thu, 26 May 2016 03:50:52 +0000 (03:50 +0000)]
hyperv: Rework guest id settings according to Hyper-V spec

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

8 years agoAdd a convenience macro that masks all the bits related to clock divisors
ian [Thu, 26 May 2016 02:55:41 +0000 (02:55 +0000)]
Add a convenience macro that masks all the bits related to clock divisors
in all versions of the sdhci spec (the HI bits are just unused reserved
bits in earlier versions).

8 years agoAvoid buffer overflow or truncation when constructing path_zoneinfo_file.
truckman [Thu, 26 May 2016 01:45:04 +0000 (01:45 +0000)]
Avoid buffer overflow or truncation when constructing path_zoneinfo_file.

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

8 years agoAvoid buffer overflow when copying the input file name and appending .dat.
truckman [Thu, 26 May 2016 01:33:24 +0000 (01:33 +0000)]
Avoid buffer overflow when copying the input file name and appending .dat.

Check the return value from fread() to be sure that it was successful.

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

8 years ago[mx25l] add Winbond w25x64 support.
adrian [Thu, 26 May 2016 01:19:13 +0000 (01:19 +0000)]
[mx25l] add Winbond w25x64 support.

PR: https://github.com/freebsd/freebsd/pull/16
Submitted by: https://github.com/epipenau

8 years ago[bhnd] Fix release of uninitialized SPROM shadow in chipc detach.
adrian [Thu, 26 May 2016 00:44:16 +0000 (00:44 +0000)]
[bhnd] Fix release of uninitialized SPROM shadow in chipc detach.

This was triggering a panic on detach; the SPROM shadow is now
maintained by the bhnd_sprom_chipc driver, and should be removed
from chipc.

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

8 years ago[bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table.
adrian [Thu, 26 May 2016 00:43:08 +0000 (00:43 +0000)]
[bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table.

This adds support for automatically configuring bhnd_chipc bus children
with associated resources, using an internal 'hints' table based directly
on Michael Zhilin's chipc resource mapping work.

The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY()
with the new resource table.

This should be nearly drop-in compatible with the child device drivers
in D6250.

Submitted by: Landon Fuller <landonf@landonf.org>
Reviewed by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6525

8 years agoDisable alignment faults on armv6, adjust various alignment-related macros
ian [Thu, 26 May 2016 00:03:23 +0000 (00:03 +0000)]
Disable alignment faults on armv6, adjust various alignment-related macros
to match the new state of affairs.  The hardware we support has always been
able to do unaligned accesses, we've just never enabled it until now.

This brings FreeBSD into line with all the other major OSes, and should help
with the growing volume of 3rd-party software that assumes unaligned access
will just work on armv6 and armv7.

8 years agoBoth Clang and GCC cannot generate efficient reserve_pv_entries().
jkim [Wed, 25 May 2016 23:06:52 +0000 (23:06 +0000)]
Both Clang and GCC cannot generate efficient reserve_pv_entries().

http://docs.freebsd.org/cgi/mid.cgi?552BFEB2.8040407

Re-implement it entirely in inline assembly not to let compilers do silly
spilling to memory.  For non-POPCNT case, use newly added bit_count(3).

Reported by: alc
Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D6541

8 years agoWhen sending in ICMP response to an SCTP packet,
tuexen [Wed, 25 May 2016 22:16:11 +0000 (22:16 +0000)]
When sending in ICMP response to an SCTP packet,
* include the SCTP common header, if possible
* include the first 8 bytes of the INIT chunk, if possible
This provides the necesary information for the receiver of the ICMP
packet to process it.

MFC after: 1 week

8 years agoUpdate to ELF Tool Chain r3477
emaste [Wed, 25 May 2016 20:56:30 +0000 (20:56 +0000)]
Update to ELF Tool Chain r3477

This fixes a EFI/PE header issue that prevented elfcopy-produced .efi
files from working with Secure Boot:

  Make sure section raw size is always padded to multiple of
  FileAlignment from the optional header, as requested by the PE
  specification. This change should reduce the diff between PE image
  generated by Binutils objcopy and elftoolchain elfcopy.

Submitted by: kaiw
Reported by: ambrisko

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