]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMFV r299425:
Martin Matuska [Thu, 12 May 2016 10:16:16 +0000 (10:16 +0000)]
MFV r299425:

Update libarchive to 3.2.0

New features:
- new bsdcat command-line utility
- LZ4 compression (in src only via external utility from ports)
- Warc format support
- 'Raw' format writer
- Zip: Support archives >4GB, entries >4GB
- Zip: Support encrypting and decrypting entries
- Zip: Support experimental streaming extension
- Identify encrypted entries in several formats
- New --clear-nochange-flags option to bsdtar tries to remove noschg and
  similar flags before deleting files
- New --ignore-zeros option to bsdtar to handle concatenated tar archives
- Use multi-threaded LZMA decompression if liblzma supports it
- Expose version info for libraries used by libarchive

Patched files (fixed compiler warnings):

contrib/libarchive/cat/bsdcat.c (vendor PR #702)
contrib/libarchive/cat/bsdcat.h (vendor PR #702)
contrib/libarchive/libarchive/archive_read_support_format_mtree.c (PR #701)
contrib/libarchive/libarchive_fe/err.c (vendor PR #703)

MFC after: 1 month
Relnotes: yes

8 years agoRemove redundant "task_struct_set()".
Hans Petter Selasky [Thu, 12 May 2016 09:11:18 +0000 (09:11 +0000)]
Remove redundant "task_struct_set()".
This is done by the "linux_kthread_fn()".

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoCreate a dummy "task_struct" on the stack which is returned by
Hans Petter Selasky [Thu, 12 May 2016 09:06:54 +0000 (09:06 +0000)]
Create a dummy "task_struct" on the stack which is returned by
"current" inside all LinuxKPI file operation callbacks. The "current"
is frequently used for various debug prints, printing the thread name
and thread ID for example.

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

8 years agoUse strlcpy() instead of strncpy() when copying date and subj
Don Lewis [Thu, 12 May 2016 08:55:57 +0000 (08:55 +0000)]
Use strlcpy() instead of strncpy() when copying date and subj
to ensure that these are properly NUL terminated since they
are passed to printf().

Reported by: Coverity
CID: 974770
MFH: 1 week

8 years agoUse strlcpy() instead of strncpy() when copying the encoding value
Don Lewis [Thu, 12 May 2016 08:41:22 +0000 (08:41 +0000)]
Use strlcpy() instead of strncpy() when copying the encoding value
to ensure that the destination is NUL terminated.  Length truncation
of one more character should not be an issue since encoding values
that long are not supported by libc.  The destination string is
treated as a NUL terminated string, but it is only passed to strcmp()
for comparison to a set of shorter, fixed length strings, so this
is not a serious problem.

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

8 years agoStop hiding errors that result in failure to mount /dev. Otherwise,
Edward Tomasz Napierala [Thu, 12 May 2016 07:38:10 +0000 (07:38 +0000)]
Stop hiding errors that result in failure to mount /dev.  Otherwise,
missing /dev directory makes one end up with a completely deaf (init
without stdout/stderr) system with no hints on the console, unless
you've booted up with bootverbose.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoUse strlcpy() instead of strncpy() to copy the string returned by
Don Lewis [Thu, 12 May 2016 06:39:13 +0000 (06:39 +0000)]
Use strlcpy() instead of strncpy() to copy the string returned by
setlocale() so that static analyzers know that the string is NUL
terminated.  This was causing a false positive in Coverity even
though the longest string returned by setlocale() is ENCODING_LEN
(31) and we are copying into a 64 byte buffer.  This change is also
a bit of an optimization since we don't need the strncpy() feature
of padding the rest of the destination buffer with NUL characters.

Reported by: Coverity
CID: 974654

8 years agoTypo in comment.
Konstantin Belousov [Thu, 12 May 2016 06:20:26 +0000 (06:20 +0000)]
Typo in comment.

8 years agosfxge(4): update multicast filter insertion algorithm
Andrew Rybchenko [Thu, 12 May 2016 06:20:26 +0000 (06:20 +0000)]
sfxge(4): update multicast filter insertion algorithm

When the multicast filters we're allowed to insert are controlled by the
hypervisor, it may be that we can insert some but not others. So we need
to have fallbacks where we insert any filters we can without rolling back
when one fails to insert.

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

8 years agosfxge(4): cleanup: constify common code method tables
Andrew Rybchenko [Thu, 12 May 2016 06:19:06 +0000 (06:19 +0000)]
sfxge(4): cleanup: constify common code method tables

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6317

8 years agoCheck for socket creation success before calling bind().
Don Lewis [Thu, 12 May 2016 05:43:54 +0000 (05:43 +0000)]
Check for socket creation success before calling bind().

Reported by: Coverity
CID: 1194209

8 years agortadvd(8): Fix use-after-close in cm_handler_client
Conrad Meyer [Thu, 12 May 2016 05:12:24 +0000 (05:12 +0000)]
rtadvd(8): Fix use-after-close in cm_handler_client

cm_send() closes 'fd' on error.  In that case, bail out early without trying to
recv from or close 'fd' again.

Reported by: Coverity
CID: 1006078
Sponsored by: EMC / Isilon Storage Division

8 years agonfsd: Fix use-after-free in NFS4 lock test service
Conrad Meyer [Thu, 12 May 2016 05:03:12 +0000 (05:03 +0000)]
nfsd: Fix use-after-free in NFS4 lock test service

Trivial use-after-free where stp was freed too soon in the non-error path.
To fix, simply move its release to the end of the routine.

Reported by: Coverity
CID: 1006105
Sponsored by: EMC / Isilon Storage Division

8 years agortadvd(8): Don't use-after-free
Conrad Meyer [Thu, 12 May 2016 04:54:32 +0000 (04:54 +0000)]
rtadvd(8): Don't use-after-free

This whole block of code as committed fully formed in r224144.  I'm not really
sure what the intent was, but it seems plausible that !persist ifis could need
other member cleanup.  Don't free the object until after we've finished
cleaning its members.

Reported by: Coverity
CID: 1006079
Sponsored by: EMC / Isilon Storage Division

8 years agodhclient: Fix some trivial buffer overruns
Conrad Meyer [Thu, 12 May 2016 04:28:22 +0000 (04:28 +0000)]
dhclient: Fix some trivial buffer overruns

There was some confusion about how to limit a hardware address to at most 16
bytes.  In some cases it would overrun a byte off the end of the array.
Correct the types and rectify the overrun.

Reported by: Coverity
CIDs: 10086821305550
Sponsored by: EMC / Isilon Storage Division

8 years agoprint_positional_test: Fix misuse of wchar APIs
Conrad Meyer [Thu, 12 May 2016 04:08:45 +0000 (04:08 +0000)]
print_positional_test: Fix misuse of wchar APIs

These APIs take unit length, not byte length parameters.

Reported by: Coverity
CIDs: 133854313385441338545
Sponsored by: EMC / Isilon Storage Division

8 years agolibmp: Fix trivial buffer overrun
Conrad Meyer [Thu, 12 May 2016 03:53:20 +0000 (03:53 +0000)]
libmp: Fix trivial buffer overrun

fgetln yields a non-NUL-terminated buffer and its length.  This routine
attempted to NUL-terminate it, but did not allocate space for the NUL.  So,
allocate space for the NUL.

Reported by: Coverity
CID: 1017457
Sponsored by: EMC / Isilon Storage Division

8 years agorpcgen(1): Tag crash() routine as __dead2 for static analyzers
Conrad Meyer [Thu, 12 May 2016 03:49:05 +0000 (03:49 +0000)]
rpcgen(1): Tag crash() routine as __dead2 for static analyzers

Suggested by: Coverity
CID: 1305464
Sponsored by: EMC / Isilon Storage Division

8 years agokern_descrip_test: Fix trivial buffer overrun with readlink(2)
Conrad Meyer [Thu, 12 May 2016 03:44:29 +0000 (03:44 +0000)]
kern_descrip_test: Fix trivial buffer overrun with readlink(2)

Reported by: Coverity
CID: 12299651229972
Sponsored by: EMC / Isilon Storage Division

8 years agortadvd(8): Fix a typo in full msg receive logic
Conrad Meyer [Thu, 12 May 2016 03:37:17 +0000 (03:37 +0000)]
rtadvd(8): Fix a typo in full msg receive logic

Check against the size of the struct, not the pointer.  Previously, a message
with a cm_len between 9 and 23 (inclusive) could cause int msglen to underflow
and read(2) to be invoked with msglen size (implicitly cast to signed),
overrunning the caller-provided buffer.

All users of cm_recv() supply a stack buffer.

On the other hand, the rtadvd control socket appears to only be writable by the
owner, who is probably root.

While here, correct some types to be size_t or ssize_t.

Reported by: Coverity
CID: 1008477
Security: unix socket remotes may overflow stack in rtadvd
Sponsored by: EMC / Isilon Storage Division

8 years agomxge: Setup mbuf flowid before calling tcp_lro_rx().
Sepherosa Ziehau [Thu, 12 May 2016 03:36:49 +0000 (03:36 +0000)]
mxge: Setup mbuf flowid before calling tcp_lro_rx().

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

8 years agohyperv/stor: Enable INQUIRY result check only on WIN10 like host systems
Sepherosa Ziehau [Thu, 12 May 2016 03:29:29 +0000 (03:29 +0000)]
hyperv/stor: Enable INQUIRY result check only on WIN10 like host systems

On WIN8 like host systems, when rescan happens, the already installed
disks seem to return random invalid results for INQUIRY.

More investigation is under way to figure out why random invalid INQUIRY
results are delivered to VM on WIN8 like host systems.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6316

8 years agosnd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter (again)
Conrad Meyer [Thu, 12 May 2016 02:46:29 +0000 (02:46 +0000)]
snd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter (again)

More of the same sort of issue as r299503, just missed some sysctls added in a
different place than the others.

Reported by: Coverity
CIDs: 100769210096771009678
Sponsored by: EMC / Isilon Storage Division

8 years agosnd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter
Conrad Meyer [Thu, 12 May 2016 02:41:38 +0000 (02:41 +0000)]
snd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter

None of the sysctl handlers in hdaa use the arg2 parameter, so just pass zero
instead.  Additionally, the sizes being passed in were suspect (size of the
pointer rather than the value).

Reported by: Coverity
CIDs: 10076941009679
Sponsored by: EMC / Isilon Storage Division

8 years agonss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliases
Conrad Meyer [Thu, 12 May 2016 02:32:23 +0000 (02:32 +0000)]
nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliases

h_aliases is a NULL-terminated rather than fixed-length array.  nitems() is not
a valid way to determine its end; instead, check for NULL.

Reported by: Coverity
CID: 1346578
Sponsored by: EMC / Isilon Storage Division

8 years agotraceroute6(8): use NULL instead of zero for initializing a pointer.
Pedro F. Giffuni [Thu, 12 May 2016 02:05:50 +0000 (02:05 +0000)]
traceroute6(8): use NULL instead of zero for initializing a pointer.

8 years agochat(8): use NULL instead of zero for initializing a pointer.
Pedro F. Giffuni [Thu, 12 May 2016 02:02:16 +0000 (02:02 +0000)]
chat(8): use NULL instead of zero for initializing a pointer.

8 years agosys/boot/common: use of spaces vs. TAB.
Pedro F. Giffuni [Thu, 12 May 2016 01:19:11 +0000 (01:19 +0000)]
sys/boot/common: use of spaces vs. TAB.

No functional change.

8 years agoatf map: Fix double-free in low memory error path
Conrad Meyer [Wed, 11 May 2016 23:39:39 +0000 (23:39 +0000)]
atf map: Fix double-free in low memory error path

If atf_list_append(, X, ) fails, X is freed.  Don't free it again.

If anyone wants to walk this patch upstream, be my guest.  I literally cannot
upstream it myself due to Google's stupid CLA.

Reported by: Coverity
CID: 979936
Sponsored by: EMC / Isilon Storage Division

8 years agolibkrb5: Fix potential double-free
Conrad Meyer [Wed, 11 May 2016 23:25:59 +0000 (23:25 +0000)]
libkrb5: Fix potential double-free

If krb5_make_principal fails, tmp_creds.server may remain a pointer to freed
memory and then be double-freed.  After freeing it the first time, initialize
it to NULL, which causes subsequent krb5_free_principal calls to do the right
thing.

Reported by: Coverity
CID: 1273430
Sponsored by: EMC / Isilon Storage Division

8 years agosubr_vmem: Fix double-free in error case of vmem_create
Conrad Meyer [Wed, 11 May 2016 23:16:11 +0000 (23:16 +0000)]
subr_vmem: Fix double-free in error case of vmem_create

If vmem_init() fails, 'vm' is already destroyed and freed.  Don't free it
again.

Reported by: Coverity
CID: 1042110
Sponsored by: EMC / Isilon Storage Division

8 years agoRevert r299467 to fix the kernel build.
Conrad Meyer [Wed, 11 May 2016 23:00:12 +0000 (23:00 +0000)]
Revert r299467 to fix the kernel build.

$ svn merge -c -299467 .

Approved by: build being broken for six hours

8 years agoDocument r298695, ntp updated to 4.2.8p7.
Steven Kreuzer [Wed, 11 May 2016 22:44:00 +0000 (22:44 +0000)]
Document r298695, ntp updated to 4.2.8p7.

Approved by: gjb@ (implicit with re@ hat on)

8 years agoroute6d(8): Fix potential double-free
Conrad Meyer [Wed, 11 May 2016 22:33:20 +0000 (22:33 +0000)]
route6d(8): Fix potential double-free

In the case that the subsequent sysctl(3) call failed, 'buf' could be free(3)ed
repeatedly.  It isn't clear to me that that case is possible, but be clear and
do the right thing in case it is.

Reported by: Coverity
CID: 272537
Sponsored by: EMC / Isilon Storage Division

8 years agocamcontrol(8): Fix another trivial double-free
Conrad Meyer [Wed, 11 May 2016 22:25:14 +0000 (22:25 +0000)]
camcontrol(8): Fix another trivial double-free

Reported by: Coverity
CID: 1331222
Sponsored by: EMC / Isilon Storage Division

8 years agocamcontrol(8): Fix trival double-free
Conrad Meyer [Wed, 11 May 2016 22:22:49 +0000 (22:22 +0000)]
camcontrol(8): Fix trival double-free

Reported by: Coverity
CID: 1331223
Sponsored by: EMC / Isilon Storage Division

8 years agorandom(6): Fix double-close
Conrad Meyer [Wed, 11 May 2016 22:04:28 +0000 (22:04 +0000)]
random(6): Fix double-close

In the case where a file lacks a trailing newline, there is some "evil" code to
reverse goto the tokenizing code ("make_token") for the final token in the
file.  In this case, 'fd' is closed more than once.  Use a negative sentinel
value to guard close(2), preventing the double close.

Ideally, this code would be restructured to avoid this ugly construction.

Reported by: Coverity
CID: 1006123
Sponsored by: EMC / Isilon Storage Division

8 years agoexec.h: Move PS_STRINGS define to kernel-only section
Ed Maste [Wed, 11 May 2016 21:14:36 +0000 (21:14 +0000)]
exec.h: Move PS_STRINGS define to kernel-only section

The kern.ps_strings sysctl was introduced in r103767 and the last
use of PS_STRINGS in userspace code was removed in r297888.

PR: 208760 [exp-run]
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5933

8 years agoRegen x86 assembly files for r299480.
Jung-uk Kim [Wed, 11 May 2016 20:11:21 +0000 (20:11 +0000)]
Regen x86 assembly files for r299480.

8 years agoSet CC environment variable for Perl scripts. This is for detecting
Jung-uk Kim [Wed, 11 May 2016 20:06:23 +0000 (20:06 +0000)]
Set CC environment variable for Perl scripts.  This is for detecting
assembler/compiler capabilities, e.g., AVX instructions.

8 years agoRefine comments to add its origin.
Jung-uk Kim [Wed, 11 May 2016 19:59:05 +0000 (19:59 +0000)]
Refine comments to add its origin.

8 years agoCall busdma_swi from swi_vm as is done from other architectures.
Andrew Turner [Wed, 11 May 2016 18:48:47 +0000 (18:48 +0000)]
Call busdma_swi from swi_vm as is done from other architectures.

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

8 years agoAdd OF_prop_free function as a counterpart for OF_*prop_alloc
Oleksandr Tymoshenko [Wed, 11 May 2016 18:20:02 +0000 (18:20 +0000)]
Add OF_prop_free function as a counterpart for OF_*prop_alloc

- Introduce new OF API function OF_prop_free to free memory allocated by
  OF_getprop_alloc and OF_getencprop_alloc. Current code just calls free(9)
  with M_OFWPROP memory class which assumes knowledge about OF_*prop_alloc
  functions' internals and leads to unneccessary code coupling

- Convert some of the free(..., M_OFWPROP) instances to OF_prop_free

Files affected by this commit are the ones I was able to test on real
hardware. The rest of free(..., M_OFWPROP) instances will be handled with
idividual maintainers

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D6315

8 years agowhois(1): Fix potential double-close and logic mistakes
Conrad Meyer [Wed, 11 May 2016 18:03:51 +0000 (18:03 +0000)]
whois(1): Fix potential double-close and logic mistakes

Close the fd the poll error was detected on, rather than the last opened fd, to
fix the double-close.

Use -1 to make it explict which int variables no longer own socket file
descriptors.

Actually shrink, rather than grow, the poll timeout to match comment.

Reported by: Coverity
CID: 13048601305616
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd gpiokeys driver
Oleksandr Tymoshenko [Wed, 11 May 2016 17:57:26 +0000 (17:57 +0000)]
Add gpiokeys driver

gpiokey driver implements functional subset of gpiokeys device-tree bindings:
https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt

It acts as a virtual keyboard, so keys are visible through kbdmux(4)

Driver maps linux scancodes for most common keys to FreeBSD scancodes and
also extends spec by introducing freebsd,code property to specify
FreeBSD-native scancodes.

Reviewed by: mmel, jmcneill
Differential Revision: https://reviews.freebsd.org/D6279

8 years agoDeorbit ALLOW_SHARED_TEXTREL
Ed Maste [Wed, 11 May 2016 17:55:09 +0000 (17:55 +0000)]
Deorbit ALLOW_SHARED_TEXTREL

We want to avoid .text relocations in shared objects. libcrypto was the
only consumer and it is now fixed (as of r299389). Remove the now-unused
support for turning off the linker warning.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D6323

8 years agowhois(1): Pull out async multiple host connection code into a routine
Conrad Meyer [Wed, 11 May 2016 17:52:06 +0000 (17:52 +0000)]
whois(1): Pull out async multiple host connection code into a routine

This logic was added to the whois() function in r281959, but could easily be
its own routine.  In this case, I think the abstraction makes both functions
easier to reason about.

This precedes some Coverity-suggested cleanup.

Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Exclude host tools for Makefile.depend.host as well.
Bryan Drewery [Wed, 11 May 2016 17:40:51 +0000 (17:40 +0000)]
DIRDEPS_BUILD: Exclude host tools for Makefile.depend.host as well.

Sponsored by: EMC / Isilon Storage Division

8 years agoResolve LINT linking issue by renaming ida_init() to ida_setup(). The
Hans Petter Selasky [Wed, 11 May 2016 17:38:09 +0000 (17:38 +0000)]
Resolve LINT linking issue by renaming ida_init() to ida_setup(). The
ida_init() symbol name is now taken for use by the LinuxKPI.

Reported by: emaste @
Discussed with: mav @

8 years agomixer(8): Style: Tag no-return usage() as __dead2
Conrad Meyer [Wed, 11 May 2016 17:27:27 +0000 (17:27 +0000)]
mixer(8): Style: Tag no-return usage() as __dead2

Coverity really should have figured this out from the exit(3) call at the end
of the routine, but just make it explicit.

No functional change.

Reported by: Coverity
CID: 1304866 (false positive double-close of 'baz')
Sponsored by: EMC / Isilon Storage Division

8 years agoMatch Linux behaviour and iterate the IDR tree unlocked. The caller is
Hans Petter Selasky [Wed, 11 May 2016 17:20:20 +0000 (17:20 +0000)]
Match Linux behaviour and iterate the IDR tree unlocked. The caller is
responsible the IDR tree stays unmodified while iterating.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoThe idr_for_each() function is now part of the LinuxKPI. Use the
Hans Petter Selasky [Wed, 11 May 2016 17:17:48 +0000 (17:17 +0000)]
The idr_for_each() function is now part of the LinuxKPI. Use the
LinuxKPI's idr_for_each() function instead of the local one to avoid
compilation issues.

Discussed with: np @
MFC after: 1 week

8 years agoAdd a new get_id interface to pci and pcib. This will allow us to both
Andrew Turner [Wed, 11 May 2016 17:07:29 +0000 (17:07 +0000)]
Add a new get_id interface to pci and pcib. This will allow us to both
detect failures, and get different PCI IDs.

For the former the interface returns an int to signal an error. The ID is
returned at a uintptr_t * argument.

For the latter there is a type argument that allows selecting the ID type.
This only specifies a single type, however a MSI type will be added
to handle the need to find the ID the hardware passes to the ARM GICv3
interrupt controller.

A follow up commit will be made to remove pci_get_rid.

Reviewed by: jhb, rstone
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6239

8 years agobsnmpd: Fix size of trapsink::comm to match other community arrays
Conrad Meyer [Wed, 11 May 2016 17:06:03 +0000 (17:06 +0000)]
bsnmpd: Fix size of trapsink::comm to match other community arrays

This fixes a number of possible strcpy() buffer overruns between the various
community strings in trap.c.

Reported by: Coverity
CIDs: 100682010068211006822
Sponsored by: EMC / Isilon Storage Division

8 years agobsnmp: Don't overrun privkey buffer by copying wrong size
Conrad Meyer [Wed, 11 May 2016 16:54:34 +0000 (16:54 +0000)]
bsnmp: Don't overrun privkey buffer by copying wrong size

The 'priv_key' array is SNMP_PRIV_KEY_SIZ bytes, not SNMP_AUTH_KEY_SIZ.

Reported by: Coverity
CIDs: 10083261009675
Sponsored by: EMC / Isilon Storage Division

8 years agolibcrypto: add "Do not modify" comment to generated source files
Ed Maste [Wed, 11 May 2016 16:53:56 +0000 (16:53 +0000)]
libcrypto: add "Do not modify" comment to generated source files

Reviewed by: jkim
Differential Revision: https://reviews.freebsd.org/D6237

8 years agoOn arm64 always create a bus_dmamap_t object. This will be use to hold the
Andrew Turner [Wed, 11 May 2016 16:53:41 +0000 (16:53 +0000)]
On arm64 always create a bus_dmamap_t object. This will be use to hold the
list of memory that the kernel will need to sync when operating with a
non-cache coherent DMA engine.

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

8 years agoEnable linker error if libcrypto.so contains a relocation against text. It
Jung-uk Kim [Wed, 11 May 2016 16:45:58 +0000 (16:45 +0000)]
Enable linker error if libcrypto.so contains a relocation against text.  It
is position independent on all platforms since r299389.

Submitted by: kib

8 years agoffs_bswap: Copy one UFS dinode member at a time
Conrad Meyer [Wed, 11 May 2016 16:42:13 +0000 (16:42 +0000)]
ffs_bswap: Copy one UFS dinode member at a time

No functional change.

Reported by: Coverity
CIDs: 974635, 974636, 977396, 977397, 977398, 977399
Sponsored by: EMC / Isilon Storage Division

8 years agofsck_ffs: Don't overrun mount device buffer
Conrad Meyer [Wed, 11 May 2016 16:20:23 +0000 (16:20 +0000)]
fsck_ffs: Don't overrun mount device buffer

Maybe this case is impossible.  Either way, when attempting to "/dev/"-prefix a
non-global device name, check that we do not overrun the f_mntfromname buffer.

In this case, truncating (with strlcpy or similar) would not be useful, since
the f_mntfromname result of getmntpt() is passed directly to open(2) later.

Reported by: Coverity
CID: 1006789
Sponsored by: EMC / Isilon Storage Division

8 years agocompat/opensolaris: Don't redefined off64_t if already defined
Conrad Meyer [Wed, 11 May 2016 16:05:32 +0000 (16:05 +0000)]
compat/opensolaris: Don't redefined off64_t if already defined

A follow-up to r299456.

Reported by: gjb
Sponsored by: EMC / Isilon Storage Division

8 years agoFix buffer overrun in gcore(1) NT_PRPSINFO
Conrad Meyer [Wed, 11 May 2016 15:31:31 +0000 (15:31 +0000)]
Fix buffer overrun in gcore(1) NT_PRPSINFO

Use size of destination buffer, rather than a constant that may or may not
correspond to the source buffer, to restrict the length of copied strings.  In
particular, pr_fname has 16+1 characters but MAXCOMLEN is 18+1.

Use strlcpy instead of strncpy to ensure the result is nul-terminated.  This
seems to be what is expected of these fields.

Reported by: Coverity
CIDs: 10113021011378
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd data barriers to the arm64 bus_dmamap_sync function. We need these
Andrew Turner [Wed, 11 May 2016 14:59:54 +0000 (14:59 +0000)]
Add data barriers to the arm64 bus_dmamap_sync function. We need these
to ensure ordering between the CPU and device. As the CPU and DMA target
may be in different shareability domains they need to be full system
barriers.

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

8 years agolibc: Add fopencookie(3) wrapper around funopen(3)
Conrad Meyer [Wed, 11 May 2016 14:38:27 +0000 (14:38 +0000)]
libc: Add fopencookie(3) wrapper around funopen(3)

Reviewed by: jhb, oshogbo
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6282

8 years agolibrpcsec_gss: remove redundant code.
Pedro F. Giffuni [Wed, 11 May 2016 14:37:33 +0000 (14:37 +0000)]
librpcsec_gss: remove redundant code.

We have identical code no matter the expression behind the if.
Avoid the desision altogether and keep doing what is expected.

Reviewed by: dfr
CID: 1305689

8 years agoMFV r299453: 6765 zfs_zaccess_delete() comments do not accurately reflect
Alexander Motin [Wed, 11 May 2016 13:53:29 +0000 (13:53 +0000)]
MFV r299453: 6765 zfs_zaccess_delete() comments do not accurately reflect
delete permissions for ACLs

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

openzfs/openzfs@a40149b935cbbe87bf95e2cc44b3bc99d400513a

8 years ago6765 zfs_zaccess_delete() comments do not accurately reflect
Alexander Motin [Wed, 11 May 2016 13:51:53 +0000 (13:51 +0000)]
6765 zfs_zaccess_delete() comments do not accurately reflect
delete permissions for ACLs

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

openzfs/openzfs@a40149b935cbbe87bf95e2cc44b3bc99d400513a

8 years agoMFV r299451: 6764 zfs issues with inheritance flags during chmod(2) with
Alexander Motin [Wed, 11 May 2016 13:50:34 +0000 (13:50 +0000)]
MFV r299451: 6764 zfs issues with inheritance flags during chmod(2) with
aclmode=passthrough

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Albert Lee <trisk@nexenta.com>

openzfs/openzfs@1bcf0d240bdebed61b4261f7c0ee323e07c8dfac

8 years ago6764 zfs issues with inheritance flags during chmod(2) with
Alexander Motin [Wed, 11 May 2016 13:49:50 +0000 (13:49 +0000)]
6764 zfs issues with inheritance flags during chmod(2) with
aclmode=passthrough

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Albert Lee <trisk@nexenta.com>

openzfs/openzfs@1bcf0d240bdebed61b4261f7c0ee323e07c8dfac

8 years agoMFV r299449: 6763 aclinherit=restricted masks inherited permissions by group
Alexander Motin [Wed, 11 May 2016 13:48:15 +0000 (13:48 +0000)]
MFV r299449: 6763 aclinherit=restricted masks inherited permissions by group
perms (groupmask)

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Albert Lee <trisk@nexenta.com>

openzfs/openzfs@eebb483d0cd68bdc4cf03c01fdeba9af160c17af

8 years ago6763 aclinherit=restricted masks inherited permissions by group
Alexander Motin [Wed, 11 May 2016 13:46:44 +0000 (13:46 +0000)]
6763 aclinherit=restricted masks inherited permissions by group
perms (groupmask)

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Albert Lee <trisk@nexenta.com>

openzfs/openzfs@eebb483d0cd68bdc4cf03c01fdeba9af160c17af

8 years agoMFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories - and
Alexander Motin [Wed, 11 May 2016 13:43:20 +0000 (13:43 +0000)]
MFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories - and
some additional considerations

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916

8 years agoAdd support for MTU chaning and Jumbo frames to VNIC
Zbigniew Bodek [Wed, 11 May 2016 13:42:20 +0000 (13:42 +0000)]
Add support for MTU chaning and Jumbo frames to VNIC

Enable previously added code for MTU handling (based on
Cavium 1.0 driver released on BSD license).
This commit enables possibility to change MTU on VNIC driver.

Obtained from: Semihalf
Sponsored by:  Cavium

8 years agoFix deadlock in VNIC when using single CPU only
Zbigniew Bodek [Wed, 11 May 2016 13:38:29 +0000 (13:38 +0000)]
Fix deadlock in VNIC when using single CPU only

Number of free Tx descriptors does not need to be locked since
it can be modified atomically between SND and CQ tasks.
It will also block Tx routine from sending packets while CQ will not
be able to free descriptors.

Obtained from: Semihalf
Sponsored by: Cavium
Differential Revision: https://reviews.freebsd.org/D6266

8 years agoFix I/O coherence issues on ThunderX when SMP is disabled
Zbigniew Bodek [Wed, 11 May 2016 13:23:56 +0000 (13:23 +0000)]
Fix I/O coherence issues on ThunderX when SMP is disabled

To maintain coherence between cache and DMA memory appropriate
shareability flags need to be set in the PTE regardless of SMP
option.

Reviewed by: wma
Obtained from: Semihalf
Sponsored by: Cavium
Differential Revision: https://reviews.freebsd.org/D6231

8 years agoAdd HW RSS support to VNIC driver
Zbigniew Bodek [Wed, 11 May 2016 13:22:13 +0000 (13:22 +0000)]
Add HW RSS support to VNIC driver

Based on v1.0 driver provided by Cavium under BSD license.
Support in-hardware RSS to distribute IP, UDP and TCP traffic
among available RX Queues and hence multiple CPUs.

Reviewed by: wma
Obtained from: Semihalf
Sponsored by: Cavium
Differential Revision: https://reviews.freebsd.org/D6230

8 years agoBind CQ interrupts and tasks to separate CPUs in VNIC
Zbigniew Bodek [Wed, 11 May 2016 13:20:29 +0000 (13:20 +0000)]
Bind CQ interrupts and tasks to separate CPUs in VNIC

Delegate interrupts and completion tasks on separate CPUs
for each VNIC.

Reviewed by: wma
Obtained from: Semihalf
Sponsored by: Cavium
Differential Revision: https://reviews.freebsd.org/D6229

8 years ago6762 POSIX write should imply DELETE_CHILD on directories - and
Alexander Motin [Wed, 11 May 2016 12:58:12 +0000 (12:58 +0000)]
6762 POSIX write should imply DELETE_CHILD on directories - and
some additional considerations

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916

8 years agoMFV r299440: 6736 ZFS per-vdev ZAPs
Alexander Motin [Wed, 11 May 2016 12:54:00 +0000 (12:54 +0000)]
MFV r299440: 6736 ZFS per-vdev ZAPs

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Joe Stein <joe.stein@delphix.com>

openzfs/openzfs@215198a6ad15cf4832370e2f19247abeb36b951a

8 years ago6736 ZFS per-vdev ZAPs
Alexander Motin [Wed, 11 May 2016 12:50:58 +0000 (12:50 +0000)]
6736 ZFS per-vdev ZAPs

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Joe Stein <joe.stein@delphix.com>

openzfs/openzfs@215198a6ad15cf4832370e2f19247abeb36b951a

8 years agoMFV r299438: 6842 Fix empty xattr dir causing lockup
Alexander Motin [Wed, 11 May 2016 12:46:07 +0000 (12:46 +0000)]
MFV r299438: 6842 Fix empty xattr dir causing lockup

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chunwei Chen <tuxoko@gmail.com>

openzfs/openzfs@02525cd08fb3730fff3a69cb5376443d481f7839

8 years ago6842 Fix empty xattr dir causing lockup
Alexander Motin [Wed, 11 May 2016 12:45:21 +0000 (12:45 +0000)]
6842 Fix empty xattr dir causing lockup

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chunwei Chen <tuxoko@gmail.com>

openzfs/openzfs@02525cd08fb3730fff3a69cb5376443d481f7839

8 years agoMFV r299436: 6843 Make xattr dir truncate and remove in one tx
Alexander Motin [Wed, 11 May 2016 12:43:54 +0000 (12:43 +0000)]
MFV r299436: 6843 Make xattr dir truncate and remove in one tx

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chunwei Chen <tuxoko@gmail.com>

openzfs/openzfs@399cc7d5d9aff97c714b708af3e3f0280ceab93f

8 years ago6843 Make xattr dir truncate and remove in one tx
Alexander Motin [Wed, 11 May 2016 12:39:53 +0000 (12:39 +0000)]
6843 Make xattr dir truncate and remove in one tx

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chunwei Chen <tuxoko@gmail.com>

openzfs/openzfs@399cc7d5d9aff97c714b708af3e3f0280ceab93f

8 years agoMFV r299434: 6841 Undirty freed spill blocks
Alexander Motin [Wed, 11 May 2016 12:38:07 +0000 (12:38 +0000)]
MFV r299434: 6841 Undirty freed spill blocks

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Tim Chase <tim@chase2k.com>

openzfs/openzfs@445e67805dd2ca6c3a2363b2ec9e163c62370233

8 years ago6841 Undirty freed spill blocks
Alexander Motin [Wed, 11 May 2016 12:36:19 +0000 (12:36 +0000)]
6841 Undirty freed spill blocks

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Tim Chase <tim@chase2k.com>

openzfs/openzfs@445e67805dd2ca6c3a2363b2ec9e163c62370233

8 years agoReturn a proper error code instead of panicing when an I/O vector
Hans Petter Selasky [Wed, 11 May 2016 10:50:59 +0000 (10:50 +0000)]
Return a proper error code instead of panicing when an I/O vector
having the wrong number of entries is detected.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoAdd more IDR and IDA related functions to the LinuxKPI.
Hans Petter Selasky [Wed, 11 May 2016 10:40:04 +0000 (10:40 +0000)]
Add more IDR and IDA related functions to the LinuxKPI.

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

8 years agoFactor out common code into "idr_find_layer_locked()" and fix inverted
Hans Petter Selasky [Wed, 11 May 2016 10:35:15 +0000 (10:35 +0000)]
Factor out common code into "idr_find_layer_locked()" and fix inverted
bitmap test for free entry in "idr_replace()".

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

8 years agoUpdate vendor/libarchive/dist to git commit 61c56e5 (post 3.2.0)
Martin Matuska [Wed, 11 May 2016 10:19:44 +0000 (10:19 +0000)]
Update vendor/libarchive/dist to git commit 61c56e5 (post 3.2.0)

8 years agoxen/resume: only send BITMAP IPIs if CPUs > 1
Roger Pau Monné [Wed, 11 May 2016 10:10:25 +0000 (10:10 +0000)]
xen/resume: only send BITMAP IPIs if CPUs > 1

This is quite harmless on HEAD, but it's worse on stable/10 where
lapic_ipi_vectored is the local APIC native IPI implementation. On
stable/10 cpu_ops.ipi_vectored should be used instead.

MFC after: 5 days
Sponsored by: Citrix Systems R&D

8 years agoKeep full libarchive distribution in vendor branch (prep for 3.2.0 update)
Martin Matuska [Wed, 11 May 2016 10:10:11 +0000 (10:10 +0000)]
Keep full libarchive distribution in vendor branch (prep for 3.2.0 update)

8 years agoAdd missing destruction of mutex.
Hans Petter Selasky [Wed, 11 May 2016 10:06:58 +0000 (10:06 +0000)]
Add missing destruction of mutex.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoFix memory leak possible in error case.
Andrey V. Elsukov [Wed, 11 May 2016 10:04:32 +0000 (10:04 +0000)]
Fix memory leak possible in error case.
Use free_rule() instead of free(), it will also release memory allocated
for rule counters.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

8 years agoWhen rerooting, take the init(8) path from argv[0] instead of fetching
Edward Tomasz Napierala [Wed, 11 May 2016 10:03:13 +0000 (10:03 +0000)]
When rerooting, take the init(8) path from argv[0] instead of fetching
it via kern.proc.pathname sysctl(2).  In some cases - booting from NFS
or rerooting after replacing the init binary with a new one - the sysctl
would fail.  In other cases - after upgrading, which moves the old init
to /sbin/init.bak - it would return /sbin/init.bak, which is the actual
path of the running init, instead of /sbin/init.

Reported by: Melissa Jenkins <melissa-freebsd at littlebluecar.co.uk>, jilles@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRemove NULL checks after M_WAITOK allocations from sys/mips/.
Edward Tomasz Napierala [Wed, 11 May 2016 09:42:24 +0000 (09:42 +0000)]
Remove NULL checks after M_WAITOK allocations from sys/mips/.

Reviewed by: adrian@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6301

8 years agoWhen rerooting, ignore ESRCH returned from kill(2). I couldn't reproduce
Edward Tomasz Napierala [Wed, 11 May 2016 09:30:18 +0000 (09:30 +0000)]
When rerooting, ignore ESRCH returned from kill(2).  I couldn't reproduce
this by myself, but apparently it sometimes happens when rerooting from
single user mode.

Reported by: jilles@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoCosmetic fixes for growfs(8) - remove unneeded capitalization and a spurious
Edward Tomasz Napierala [Wed, 11 May 2016 09:26:23 +0000 (09:26 +0000)]
Cosmetic fixes for growfs(8) - remove unneeded capitalization and a spurious
newline, clarify a message.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoAdd more atomic LinuxKPI functions.
Hans Petter Selasky [Wed, 11 May 2016 07:58:43 +0000 (07:58 +0000)]
Add more atomic LinuxKPI functions.

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

8 years agoMake sdhci(4) work after suspend/resume for chipsets that require
Edward Tomasz Napierala [Wed, 11 May 2016 07:50:35 +0000 (07:50 +0000)]
Make sdhci(4) work after suspend/resume for chipsets that require
the frequency quirk. This makes it work on eg ThinkPad T420.

Without it, after resume one can see this:

mmc0: ACMD42 failed, RESULT: 4
mmcsd0: Error indicated: 1 Timeout
mmcsd0: Error indicated: 2 Bad CRC
mmcsd0: Error indicated: 2 Bad CRC
mmcsd0: Error indicated: 2 Bad CRC
mmcsd0: Error indicated: 2 Bad CRC
sdhci_pci0-slot0: Got data interrupt 0x00200000, but there is no active command.
sdhci_pci0-slot0: ============== REGISTER DUMP ==============
sdhci_pci0-slot0: Sys addr: 0x06317200 | Version: 0x00000502
sdhci_pci0-slot0: Blk size: 0x00000200 | Blk cnt: 0x00000010
sdhci_pci0-slot0: Argument: 0x00000200 | Trn mode: 0x00000037
sdhci_pci0-slot0: Present: 0x01ff0000 | Host ctl: 0x00000007
sdhci_pci0-slot0: Power: 0x0000000f | Blk gap: 0x00000000
sdhci_pci0-slot0: Wake-up: 0x00000000 | Clock: 0x00000007
sdhci_pci0-slot0: Timeout: 0x0000000d | Int stat: 0x00000000
sdhci_pci0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fb
sdhci_pci0-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_pci0-slot0: Caps: 0x21e8c8b2 | Max curr: 0x00000040
sdhci_pci0-slot0: ===========================================
sdhci_pci0-slot0: Got data interrupt 0x00200000, but there is no active command.
sdhci_pci0-slot0: ============== REGISTER DUMP ==============
sdhci_pci0-slot0: Sys addr: 0x06317200 | Version: 0x00000502
sdhci_pci0-slot0: Blk size: 0x00000200 | Blk cnt: 0x00000001
sdhci_pci0-slot0: Argument: 0x00000040 | Trn mode: 0x00000013
sdhci_pci0-slot0: Present: 0x01ff0000 | Host ctl: 0x00000007
sdhci_pci0-slot0: Power: 0x0000000f | Blk gap: 0x00000000
sdhci_pci0-slot0: Wake-up: 0x00000000 | Clock: 0x00000007
sdhci_pci0-slot0: Timeout: 0x0000000d | Int stat: 0x00000000
autofs_flush: /net flushed
sdhci_pci0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fb
autofs_flush: /media flushed
sdhci_pci0-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_pci0-slot0: Caps: 0x21e8c8b2 | Max curr: 0x00000040
sdhci_pci0-slot0: ===========================================

Afterwards all operations on /dev/mmcsd0 fail with EIO.

Reviewed by: jhb@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6265