]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoImplement quote escaping. String values may now contain " if you
Warner Losh [Thu, 23 Mar 2017 02:36:51 +0000 (02:36 +0000)]
Implement quote escaping. String values may now contain " if you
it is preceded by \.

foo="I \"like\" C++"

gives the value 'I "like" C++' to the variable 'foo'. If a character
other than " follows the \, both the \ and that character are passed
through.

Differential Revision: https://reviews.freebsd.org/D6286
Sponsored by: Netflix

7 years agotmpfs(5): fix mdoc warnings
Enji Cooper [Thu, 23 Mar 2017 02:33:27 +0000 (02:33 +0000)]
tmpfs(5): fix mdoc warnings

- Delete trailing whitespace
- Sort SEE ALSO order: mmap(2)'s Xr should come before nmount(2)'s Xr.

MFC after: 1 week
Reported by: make manlint
Sponsored by: Dell EMC Isilon

7 years agoFix a coverity-discovered NULL pointer dereference.
Warner Losh [Thu, 23 Mar 2017 02:30:57 +0000 (02:30 +0000)]
Fix a coverity-discovered NULL pointer dereference.

*** CID 1372598:  Null pointer dereferences  (FORWARD_NULL)
/lib/libefivar/efivar-dp-parse.c: 3612 in UefiDevicePathLibConvertTextToDeviceNode()
   Dereferencing null pointer "FromText".

When ported from Tiano core, I commented this out with an ifdef. That
was in error because we're supposed to fallback to a filepath when
nothing else patches. Instead, restore the original code, but fix
DevPathFromTextFilePath to cope with the conversion to narrow
strings. Also, fix the off-by-one error in the size of the memory it
allocates.

The off by one error is documented in Tiano core bug
https://bugzilla.tianocore.org/show_bug.cgi?id=441

CID: 1372598
Sponsored by: Netflix

7 years agoDefine StrCmp in a funky was to be bug-compatible with EDK2 code.
Warner Losh [Thu, 23 Mar 2017 02:30:52 +0000 (02:30 +0000)]
Define StrCmp in a funky was to be bug-compatible with EDK2 code.

Paper over a coverity issue:

*** CID 1372592:  API usage errors  (BAD_COMPARE)
/lib/libefivar/efivar-dp-parse.c: 2723 in DevPathFromTextiSCSI()
   Truncating the result of "strcmp" to "unsigned short" may cause it
   to be misinterpreted as 0. Note that "strcmp" may return an integer
   besides -1, 0, or 1.

We do this by making StrCmp return either 0 or 1 for equal or
not-equal.  There's a bug in the DevPathFromTextiSCSI cast of the
return value and this workaround will fix it without breaking other
users of StrCmp (all of which test for == 0).

https://bugzilla.tianocore.org/show_bug.cgi?id=440 has been filed
upstream to log this issue.

CID: 1372592
Sponsored by: Netflix

7 years agoRegenerate src.conf(5) (again)
Enji Cooper [Thu, 23 Mar 2017 02:29:59 +0000 (02:29 +0000)]
Regenerate src.conf(5) (again)

Sponsored by: Dell EMC Isilon

7 years agoRemove the .Pa portion I added to the .An macro in AUTHORS section
Enji Cooper [Thu, 23 Mar 2017 02:26:15 +0000 (02:26 +0000)]
Remove the .Pa portion I added to the .An macro in AUTHORS section

That doesn't work (mandoc complains about the macro being empty).

That's what I get for being clever and not verifying before committing
things again *sigh*.

MFC after: 1 month
X-MFC with: r315766
Partyhat to: ngie
Sponsored by: Dell EMC Isilon

7 years agoRegenerate src.conf(5)
Enji Cooper [Thu, 23 Mar 2017 02:21:59 +0000 (02:21 +0000)]
Regenerate src.conf(5)

Sponsored by: Dell EMC Isilon

7 years agoNote that tools/build/options/makeman automatically generated src.conf(5)
Enji Cooper [Thu, 23 Mar 2017 02:16:56 +0000 (02:16 +0000)]
Note that tools/build/options/makeman automatically generated src.conf(5)

This (as a bonus) fixes mdoc warnings with src.conf(5) :)..

MFC after: 1 month
Sponsored by: Dell EMC Isilon

7 years agoFix mdoc(7) warning: new sentences should start on new lines
Enji Cooper [Thu, 23 Mar 2017 02:13:59 +0000 (02:13 +0000)]
Fix mdoc(7) warning: new sentences should start on new lines

MFC after: 1 week
X-MFC with: r315764
Sponsored by: Dell EMC Isilon

7 years agoAdd a WITHOUT_IPSEC_SUPPORT option description for src.conf(5)
Enji Cooper [Thu, 23 Mar 2017 02:01:25 +0000 (02:01 +0000)]
Add a WITHOUT_IPSEC_SUPPORT option description for src.conf(5)

This is a follow up commit to r313330.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAdd a WITHOUT_RATELIMIT option description for src.conf(5)
Enji Cooper [Thu, 23 Mar 2017 01:44:17 +0000 (01:44 +0000)]
Add a WITHOUT_RATELIMIT option description for src.conf(5)

This is a follow up commit for r312379

MFC after: 1 month
X-MFC with: r312379
Sponsored by: Dell EMC Isilon

7 years agorc.conf(5): fix a .Xr call for chroot(8)
Enji Cooper [Thu, 23 Mar 2017 01:16:26 +0000 (01:16 +0000)]
rc.conf(5): fix a .Xr call for chroot(8)

Add the missing section number to the .Xr call.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAdd cxgbe(4), ixl(4), and mlx4en(4) to the hardware release notes
Enji Cooper [Thu, 23 Mar 2017 00:56:52 +0000 (00:56 +0000)]
Add cxgbe(4), ixl(4), and mlx4en(4) to the hardware release notes

MFC after: 1 week
Reviewed by: gjb
Sponsored by: Dell EMC Isilon

7 years agoCorrect the dependency of mmc(4) on sdhci_tegra(4) after r314887.
Marius Strobl [Thu, 23 Mar 2017 00:41:33 +0000 (00:41 +0000)]
Correct the dependency of mmc(4) on sdhci_tegra(4) after r314887.

7 years agoAdd mlx5en(4) to the hardware page. [1]
Glen Barber [Wed, 22 Mar 2017 23:47:15 +0000 (23:47 +0000)]
Add mlx5en(4) to the hardware page. [1]
Belatedly bump copyright years after several changes.

Reported by: rgrimes [1]
Sponsored by: The FreeBSD Foundation

7 years agoFix hardware list build after r315742.
Glen Barber [Wed, 22 Mar 2017 22:29:14 +0000 (22:29 +0000)]
Fix hardware list build after r315742.

Sponsored by: The FreeBSD Foundation

7 years agoUpdate r315753 with the proper flag name.
Konstantin Belousov [Wed, 22 Mar 2017 22:28:13 +0000 (22:28 +0000)]
Update r315753 with the proper flag name.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoAdd a flag BI_BRAND_ONLY_STATIC to specify that the brand only
Konstantin Belousov [Wed, 22 Mar 2017 22:23:01 +0000 (22:23 +0000)]
Add a flag BI_BRAND_ONLY_STATIC to specify that the brand only
matches static binaries.

Interpretation of the 'static' there is that the binary must not
specify an interpreter.  In particular, shared objects are matched by
the brand if BI_CAN_EXEC_DYN is also set.

This improves precision of the brand matching, which should eliminate
surprises due to brand ordering.

Revert r315701.

Discussed with and tested by: ed (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoAdjust r314851 to not require every brand to specify interpreter path.
Konstantin Belousov [Wed, 22 Mar 2017 22:06:48 +0000 (22:06 +0000)]
Adjust r314851 to not require every brand to specify interpreter path.

Reported and tested by: ed
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoUse MIN macros from sys/param.h
Baptiste Daroussin [Wed, 22 Mar 2017 21:59:04 +0000 (21:59 +0000)]
Use MIN macros from sys/param.h

7 years agoUse strndup(3) instead of malloc + memcpy
Baptiste Daroussin [Wed, 22 Mar 2017 21:52:22 +0000 (21:52 +0000)]
Use strndup(3) instead of malloc + memcpy

7 years agoCherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:
Dimitry Andric [Wed, 22 Mar 2017 21:45:42 +0000 (21:45 +0000)]
Cherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:

Author: David Chisnall <theraven@FreeBSD.org>
Date:   Wed Mar 22 12:27:08 2017 +0000

    Simplify some code.

    realloc() with a null pointer is equivalent to malloc, so we don't need
    to handle the two cases independently.

    Fixes #46

This should help with lang/beignet and other programs, which expect
__cxa_demangle(name, NULL, NULL, &status) to return zero in status.

PR: 213732
MFC after: 3 days

7 years agoCommit Makefiles changes not build manpage for igb(4), accidentally
Enji Cooper [Wed, 22 Mar 2017 21:39:00 +0000 (21:39 +0000)]
Commit Makefiles changes not build manpage for igb(4), accidentally
forgotten in r315742.

X-MFC with: r311849, r315742
Pointyhat to: ngie
Sponsored by: Dell EMC Isilon

7 years agoUse MAX and MIN macros from sys/param.h
Baptiste Daroussin [Wed, 22 Mar 2017 21:35:01 +0000 (21:35 +0000)]
Use MAX and MIN macros from sys/param.h

7 years agoMerge documentation for em(4) and igb(4)
Enji Cooper [Wed, 22 Mar 2017 21:32:44 +0000 (21:32 +0000)]
Merge documentation for em(4) and igb(4)

Document work done by mmacy/sbruno to merge the two drivers together
and convert em(4) to the iflib framework.

X-MFC with: r311849
Sponsored by: Dell EMC Isilon

7 years agopf: Fix possible shutdown race
Kristof Provost [Wed, 22 Mar 2017 21:18:18 +0000 (21:18 +0000)]
pf: Fix possible shutdown race

Prevent possible races in the pf_unload() / pf_purge_thread() shutdown
code. Lock the pf_purge_thread() with the new pf_end_lock to prevent
these races.

Use a shared/exclusive lock, as we need to also acquire another sx lock
(VNET_LIST_RLOCK). It's fine for both pf_purge_thread() and pf_unload()
to sleep,

Pointed out by: eri, glebius, jhb
Differential Revision: https://reviews.freebsd.org/D10026

7 years agoSimplify the code a little.
Warner Losh [Wed, 22 Mar 2017 20:51:52 +0000 (20:51 +0000)]
Simplify the code a little.

Submitted by: rppokala
Sponsored by: Netflix

7 years agoGarbage collect if_igb reference in loader.conf
Enji Cooper [Wed, 22 Mar 2017 20:06:29 +0000 (20:06 +0000)]
Garbage collect if_igb reference in loader.conf

if_igb was merged with if_em in r311849

X-MFC with: r311849
Sponsored by: Dell EMC Isilon

7 years agoDocument some more 10GbE+ network drivers in loader.conf
Enji Cooper [Wed, 22 Mar 2017 19:48:09 +0000 (19:48 +0000)]
Document some more 10GbE+ network drivers in loader.conf

- if_cxgbe
- if_ixl
- if_ixlv
- sfxge

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoUnbreak world by adding sys/stat.h for stat(2)
Enji Cooper [Wed, 22 Mar 2017 19:23:13 +0000 (19:23 +0000)]
Unbreak world by adding sys/stat.h for stat(2)

X-MFC with: r315733
Reported by: O. Hartmann <ohartmann@walstatt.org>
Sponsored by: Dell EMC Isilon

7 years agoMake file descriptor passing for CloudABI's recvmsg() work.
Ed Schouten [Wed, 22 Mar 2017 19:20:39 +0000 (19:20 +0000)]
Make file descriptor passing for CloudABI's recvmsg() work.

Similar to the change for sendmsg(), create a pointer size independent
implementation of recvmsg() and let cloudabi32 and cloudabi64 call into
it. In case userspace requests one or more file descriptors, call
kern_recvit() in such a way that we get the control message headers in
an mbuf. Iterate over all of the headers and copy the file descriptors
to userspace.

7 years agoImplement moving SD.
Warner Losh [Wed, 22 Mar 2017 19:18:47 +0000 (19:18 +0000)]
Implement moving SD.

From the paper "Incremental calculation of weighted mean and variance"
by Tony Finch Februrary 2009, retrieved from
http://people.ds.cam.ac.uk/fanf2/hermes/doc/antiforgery/stats.pdf
converted to use shifting.

7 years agostyle(9): sort #includes
Enji Cooper [Wed, 22 Mar 2017 19:17:13 +0000 (19:17 +0000)]
style(9): sort #includes

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoImpelemnt ttys onifexists in init.
Warner Losh [Wed, 22 Mar 2017 19:00:41 +0000 (19:00 +0000)]
Impelemnt ttys onifexists in init.

Implement a new init(8) option in /etc/ttys. If this option is present
on the entry in /etc/ttys, the entry will be active if and only if it
exists.  If the name starts with a '/', it will be considered an
absolute path. If not, it will be a path relative to /dev.

This allows one to turn off video console getty that aren't present
(while running a getty on them even when they aren't the system
console). Likewise with serial ports.

It differs from onifconsole in only requiring the device exist rather
than it be listed as one of the system consoles.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D10037

7 years agoAdd forward declaration for struct vnode.
Ed Schouten [Wed, 22 Mar 2017 18:45:13 +0000 (18:45 +0000)]
Add forward declaration for struct vnode.

The coredump() function provided by this header file has struct vnode *
as an argument.

MFC after: 1 week

7 years agoAdd initializations missed in r315728.
Mark Johnston [Wed, 22 Mar 2017 18:33:29 +0000 (18:33 +0000)]
Add initializations missed in r315728.

X-MFC With: r315728

7 years agoAvoid accessing an uninitialized variable when vfork() fails.
Mark Johnston [Wed, 22 Mar 2017 18:31:44 +0000 (18:31 +0000)]
Avoid accessing an uninitialized variable when vfork() fails.

Reported by: Miles Ohlrich <miles.ohlrich@isilon.com>
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAvoid double-closing an fd if elf_begin() fails.
Mark Johnston [Wed, 22 Mar 2017 18:14:55 +0000 (18:14 +0000)]
Avoid double-closing an fd if elf_begin() fails.

Reported by: Miles Ohlrich <miles.ohlrich@isilon.com>
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agodiff(1): fix SYNOPSIS section noting non-existent option, --no-ignore-case
Enji Cooper [Wed, 22 Mar 2017 18:13:14 +0000 (18:13 +0000)]
diff(1): fix SYNOPSIS section noting non-existent option, --no-ignore-case

`--no-ignore-case` should be `--no-ignore-file-name-case` per code for
compatibility with [g]diff(1).

Sponsored by: Dell EMC Isilon

7 years agoscandir: Fix NULL dereference, uninitialized value use in error case
Conrad Meyer [Wed, 22 Mar 2017 17:37:47 +0000 (17:37 +0000)]
scandir: Fix NULL dereference, uninitialized value use in error case

If opendir succeeds but malloc fails, numitems was used uninitialized in
error handling under the 'fail' label.  If it happened to have a non-zero
value, the NULL 'names' was dereferenced.

Reported by: Coverity
CIDs: 13295661372625
Sponsored by: Dell EMC Isilon

7 years agoExtend cmpxchg() to support 8- and 16-bit values, and add xchg().
Mark Johnston [Wed, 22 Mar 2017 17:33:57 +0000 (17:33 +0000)]
Extend cmpxchg() to support 8- and 16-bit values, and add xchg().

These are needed to support updated revisions of the DRM code.

Reviewed by: hselasky (previous version)
MFC after: 2 weeks

7 years agoAdd support for 8- and 16-bit atomic_(f)cmpset to x86.
Mark Johnston [Wed, 22 Mar 2017 17:29:04 +0000 (17:29 +0000)]
Add support for 8- and 16-bit atomic_(f)cmpset to x86.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10068

7 years agoctm: fix memory leaks in Pass1(..)
Enji Cooper [Wed, 22 Mar 2017 17:28:53 +0000 (17:28 +0000)]
ctm: fix memory leaks in Pass1(..)

Call `Delete(..)` (a free(3) wrapper) on `name` when bailing from the
function.

Submitted by: Tom Rix <trix@juniper.net>
Reviewed by: ngie
Differential Revision: D10097
Sponsored by: Dell EMC Isilon, Juniper

7 years agoBring the handling of the y axis in the ums driver in-line with the other
Peter Grehan [Wed, 22 Mar 2017 17:06:57 +0000 (17:06 +0000)]
Bring the handling of the y axis in the ums driver in-line with the other
axes.

No functional change.

Submitted by: Vicki Pfau (vi AT endrift.com)
Approved by: hps
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D9595

7 years agoThis fixes a typo in bhyve's USB mouse emulation.
Peter Grehan [Wed, 22 Mar 2017 16:53:03 +0000 (16:53 +0000)]
This fixes a typo in bhyve's USB mouse emulation.
There is no behavioral difference, as it's just swapping
out the name of two identically-valued constants.

Submitted by: Vicki Pfau (vi AT endrift.com)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D9597

7 years agoAdd full VNET support to the inet_get_local_port_range() function in
Hans Petter Selasky [Wed, 22 Mar 2017 15:46:31 +0000 (15:46 +0000)]
Add full VNET support to the inet_get_local_port_range() function in
the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd support for more IPv4 and IPv6 related macros in the LinuxKPI.
Hans Petter Selasky [Wed, 22 Mar 2017 15:44:00 +0000 (15:44 +0000)]
Add support for more IPv4 and IPv6 related macros in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd the early hypervisor code needed on 32-bit ARMv7. This will be used
Andrew Turner [Wed, 22 Mar 2017 14:30:02 +0000 (14:30 +0000)]
Add the early hypervisor code needed on 32-bit ARMv7. This will be used
when we bring in bhyve support.

Submitted by: Mihai Carabas <mihai.carabas AT gmail.com>
Differential Revision: https://reviews.freebsd.org/D10045

7 years agoFix printing bits above first eight.
Alexander Motin [Wed, 22 Mar 2017 13:53:21 +0000 (13:53 +0000)]
Fix printing bits above first eight.

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

7 years agoAdd options to capture stdout and / or stderr and pass the output on
Dag-Erling Smørgrav [Wed, 22 Mar 2017 13:16:04 +0000 (13:16 +0000)]
Add options to capture stdout and / or stderr and pass the output on
to the user.  There is currently no buffering, so the result may be
somewhat unpredictable if the conversation function adds a newline,
like openpam_ttyconv() does.

Clean up and simplify the environment handling code, which triggered
an inexplicable bug on some systems.

MFC after: 2 weeks

7 years agoSwitch from using periph_links to sim_links.
Alexander Motin [Wed, 22 Mar 2017 11:06:33 +0000 (11:06 +0000)]
Switch from using periph_links to sim_links.

periph_links field belongs to periph drivers and must not be used here.

MFC after: 2 weeks

7 years agoCleanup response queue processing.
Alexander Motin [Wed, 22 Mar 2017 08:56:03 +0000 (08:56 +0000)]
Cleanup response queue processing.

MFC after: 2 weeks

7 years agoSet the interpreter path to /nonexistent.
Ed Schouten [Wed, 22 Mar 2017 07:05:27 +0000 (07:05 +0000)]
Set the interpreter path to /nonexistent.

CloudABI executables are statically linked and don't have an
interpreter. Setting the interpreter path to NULL used to work
previously, but r314851 introduced code that checks the string
unconditionally. Running CloudABI executables now causes a null pointer
dereference.

Looking at the rest of imgact_elf.c, it seems various other codepaths
already leaned on the fact that the interpreter path is set. Let's just
go ahead and pick an obviously incorrect interpreter path to appease
imgact_elf.c.

MFC after: 1 week

7 years agoMake file descriptor passing work for CloudABI's sendmsg().
Ed Schouten [Wed, 22 Mar 2017 06:43:10 +0000 (06:43 +0000)]
Make file descriptor passing work for CloudABI's sendmsg().

Reduce the potential amount of code duplication between cloudabi32 and
cloudabi64 by creating a cloudabi_sock_recv() utility function. The
cloudabi32 and cloudabi64 modules will then only contain code to convert
the iovecs to the native pointer size.

In cloudabi_sock_recv(), we can now construct an SCM_RIGHTS cmsghdr in
an mbuf and pass that on to kern_sendit().

7 years agoPrint out name of non-dynamic sysctl in sysctl_remove_oid_locked
Enji Cooper [Wed, 22 Mar 2017 05:27:20 +0000 (05:27 +0000)]
Print out name of non-dynamic sysctl in sysctl_remove_oid_locked

This will provide a slightly better smoking gun than just stating
"can't remove non-dynamic nodes!" when calling sysctl_ctx_free(9)
and sysctl_remove_{name,oid}(9) with a non-dynamic (likely
static) sysctl.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agolibkvm: bump WARNS to 6 after recent commits done to resolve warnings issues
Enji Cooper [Wed, 22 Mar 2017 02:44:39 +0000 (02:44 +0000)]
libkvm: bump WARNS to 6 after recent commits done to resolve warnings issues

MFC after: 1 month
Tested with: make tinderbox; clang 4.0.0 (amd64), gcc 4.2.1/6.3.0 (amd64)
Sponsored by: Dell EMC Isilon

7 years agolibkvm: fix warning issues post-r291406
Enji Cooper [Wed, 22 Mar 2017 02:42:00 +0000 (02:42 +0000)]
libkvm: fix warning issues post-r291406

- Fix -Wunused warnings with *_native detection handlers by marking `kd`
  __unused, except with arm/mips, where a slightly more complicated scheme
  is required to handle the native case vs the non-native case.
- Fix -Wmissing-variable-declarations warnings by marking struct kvm_arch
  objects static.

Differential Revision: D10071
MFC after: 1 week
Reviewed by: vangyzen
Tested with: WIP test code (D10024) // kgdb7121 (i386 crash/kernel on amd64)
Sponsored by: Dell EMC Isilon

7 years agoclock_gettime.2: add some clock IDs
Eric van Gyzen [Wed, 22 Mar 2017 00:50:36 +0000 (00:50 +0000)]
clock_gettime.2: add some clock IDs

Add the CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clock_id
values to the clock_gettime(2) man page.  Reformat the excessively
long paragraph (sentence!) into a tag list.

Reported by: jilles in https://reviews.freebsd.org/D10020
MFC after: 3 days
Sponsored by: Dell EMC

7 years agokern_fail: Allow sleeping for more than 2147483/hz seconds
Conrad Meyer [Tue, 21 Mar 2017 22:41:37 +0000 (22:41 +0000)]
kern_fail: Allow sleeping for more than 2147483/hz seconds

Because of integer types, the timeout calculation result was limited to
INT_MAX / (1000 * hz) seconds.  For systems with hz=10000, this is only 215
seconds.  Perform the calculation with 64-bit math to allow sleeping for the
full INT_MAX / hz interval (215000 seconds on such hz=10000 systems).

Submitted by: Scott Ferris <sferris at isilon.com>
Sponsored by: Dell EMC Isilon

7 years agoEliminate a "format string is not a string literal" warning.
Ian Lepore [Tue, 21 Mar 2017 22:21:29 +0000 (22:21 +0000)]
Eliminate a "format string is not a string literal" warning.

7 years agoRename _cc to _gcc to be more clear.
Bryan Drewery [Tue, 21 Mar 2017 22:09:00 +0000 (22:09 +0000)]
Rename _cc to _gcc to be more clear.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoDelete trailing whitespace (no functional change)
Enji Cooper [Tue, 21 Mar 2017 22:00:52 +0000 (22:00 +0000)]
Delete trailing whitespace (no functional change)

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoGcc has incompatible internal declarations for __divtc3 and __multc3 as
Dimitry Andric [Tue, 21 Mar 2017 21:07:37 +0000 (21:07 +0000)]
Gcc has incompatible internal declarations for __divtc3 and __multc3 as
defined in compiler-rt, but it has no option to silence its warning, so
make gcc warnings for libcompiler_rt non-fatal.

Noticed by: lwhsu
MFC after: 3 days

7 years agokvm_write: fix -Wcast-qual warning in pointer arithmetic argument
Enji Cooper [Tue, 21 Mar 2017 20:48:36 +0000 (20:48 +0000)]
kvm_write: fix -Wcast-qual warning in pointer arithmetic argument

Cast buf to `const char *` when doing arithmetic operation to match
`cp`'s type [1].

Differential Revision: D10082
MFC after: 1 week
Reviewed by: cem (earlier diff), vangyzen
Submitted by: cem [1]
Sponsored by: Dell EMC Isilon

7 years agoDocument sbuf_hexdump(9) in just sbuf(9)
Enji Cooper [Tue, 21 Mar 2017 19:10:07 +0000 (19:10 +0000)]
Document sbuf_hexdump(9) in just sbuf(9)

- Remove duplicate references to sbuf_hexdump(9) from hexdump(3).
  sbuf_hexdump(9) already pointed back to hexdump(3) for implementation
  details.
- Refer to sbuf_hexdump(9) instead of sbuf(9) for completeness

MFC after: 1 week
Reviewed by: vangyzen (earlier diff)
Sponsored by: Dell EMC Isilon
Differential Revision: D9912

7 years agokvm_geterr: handle `kd` == NULL in a deterministic/graceful manner
Enji Cooper [Tue, 21 Mar 2017 19:02:17 +0000 (19:02 +0000)]
kvm_geterr: handle `kd` == NULL in a deterministic/graceful manner

Return a NUL string instead of just working by accident with kvm_geterr(3)
when MALLOC_PRODUCTION is disabled (I didn't confirm the MALLOC_PRODUCTION
being enabled path).

Document the new explicit return behavior for kvm_geterr(3), as well
as the previous implicit behavior, i.e., the buffer attached to
returned via kvm_geterr(3) would be empty if a previous error hadn't been
stored in `kd`.

Differential Revision: D10022
MFC after: 1 week
Reviewed by: vangyzen
Sponsored by: Dell EMC Isilon

7 years agotighten buffer bounds in imgact_binmisc_populate_interp
Ed Maste [Tue, 21 Mar 2017 18:02:14 +0000 (18:02 +0000)]
tighten buffer bounds in imgact_binmisc_populate_interp

We must ensure there's space for the terminating null in the temporary
buffer in imgact_binmisc_populate_interp().

Note that there's no buffer overflow here because xbe->xbe_interpreter's
length and null termination is checked in imgact_binmisc_add_entry()
before imgact_binmisc_populate_interp() is called. However, the latter
should correctly enforce its own bounds.

Reviewed by: sbruno
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10042

7 years agoForce same alignment on struct xinpgen as we have on struct xinpcb. This
Gleb Smirnoff [Tue, 21 Mar 2017 16:23:44 +0000 (16:23 +0000)]
Force same alignment on struct xinpgen as we have on struct xinpcb.  This
fixes 32-bit builds.

7 years agoRemove another remnants left after r246713.
Alexander Motin [Tue, 21 Mar 2017 14:14:11 +0000 (14:14 +0000)]
Remove another remnants left after r246713.

MFC after: 2 weeks

7 years agoRemove some dead code left after r246713.
Alexander Motin [Tue, 21 Mar 2017 13:49:43 +0000 (13:49 +0000)]
Remove some dead code left after r246713.

MFC after: 2 weeks

7 years agoImprove command timeout handling.
Alexander Motin [Tue, 21 Mar 2017 13:10:37 +0000 (13:10 +0000)]
Improve command timeout handling.

Let firmware do its best first, and if it can't, try software recovery.
I would remove software timeout handler completely, but found bunch of
complains on command timeout on sparc64 mailing list few years ago, so
better be safe in case of interrupt loss.

MFC after: 2 weeks

7 years agoThe .Cm macro usage fixed.
Maxim Konovalov [Tue, 21 Mar 2017 13:01:08 +0000 (13:01 +0000)]
The .Cm macro usage fixed.

PR: 217977
Submitted by: tobik

7 years agoRemove questionable reqp->req_time access.
Alexander Motin [Tue, 21 Mar 2017 11:26:31 +0000 (11:26 +0000)]
Remove questionable reqp->req_time access.

MFC after: 2 weeks

7 years agoClean/unify some macro usage.
Alexander Motin [Tue, 21 Mar 2017 10:34:34 +0000 (10:34 +0000)]
Clean/unify some macro usage.

MFC after: 2 weeks

7 years agoMinor cosmetic addition to r315673.
Alexander Motin [Tue, 21 Mar 2017 09:24:07 +0000 (09:24 +0000)]
Minor cosmetic addition to r315673.

Now CAM_SIM_LOCK() macros are not used and may be removed later.

MFC after: 2 weeks

7 years agoMake CAM SIM lock optional.
Alexander Motin [Tue, 21 Mar 2017 09:12:41 +0000 (09:12 +0000)]
Make CAM SIM lock optional.

For three years now CAM does not use SIM lock, but still enforces SIM to
use it.  Remove this requirement, allowing SIMs to have any locking they
prefer, if they pass no mutex to cam_sim_alloc().

MFC after: 2 weeks

7 years agoMake sdp compilable after r315662.
Gleb Smirnoff [Tue, 21 Mar 2017 09:07:05 +0000 (09:07 +0000)]
Make sdp compilable after r315662.

7 years agoShut up gcc.
Gleb Smirnoff [Tue, 21 Mar 2017 08:57:20 +0000 (08:57 +0000)]
Shut up gcc.

7 years agoAddition to r315579: drop the lock while allocating IRQs.
Alexander Motin [Tue, 21 Mar 2017 08:56:13 +0000 (08:56 +0000)]
Addition to r315579: drop the lock while allocating IRQs.

MFC after: 12 days

7 years agoHide struct inpcb, struct tcpcb from the userland.
Gleb Smirnoff [Tue, 21 Mar 2017 06:39:49 +0000 (06:39 +0000)]
Hide struct inpcb, struct tcpcb from the userland.

This is a painful change, but it is needed.  On the one hand, we avoid
modifying them, and this slows down some ideas, on the other hand we still
eventually modify them and tools like netstat(1) never work on next version of
FreeBSD.  We maintain a ton of spares in them, and we already got some ifdef
hell at the end of tcpcb.

Details:
- Hide struct inpcb, struct tcpcb under _KERNEL || _WANT_FOO.
- Make struct xinpcb, struct xtcpcb pure API structures, not including
  kernel structures inpcb and tcpcb inside.  Export into these structures
  the fields from inpcb and tcpcb that are known to be used, and put there
  a ton of spare space.
- Make kernel and userland utilities compilable after these changes.
- Bump __FreeBSD_version.

Reviewed by: rrs, gnn
Differential Revision: D10018

7 years agoFix back-to-back runs of sys/netinet/fibs_test;slaac_on_nondefault_fib6
Alan Somers [Mon, 20 Mar 2017 23:07:34 +0000 (23:07 +0000)]
Fix back-to-back runs of sys/netinet/fibs_test;slaac_on_nondefault_fib6

This test was failing if run twice because rtadvd takes too long to die.
The rtadvd process from the first run was still running when the
second run created its interfaces.  The solution is to use SIGKILL during
the cleanup instead of SIGTERM so rtadvd will die faster.

While I'm here, randomize the addresses used for the test, which makes bugs
like this easier to spot, and fix the cleanup order to be the opposite of
the setup order

PR: 217871
MFC after: 18 days
X-MFC-With: 315458
Sponsored by: Spectra Logic Corp

7 years agoFixes to chkprintcap:
Garance A Drosehn [Mon, 20 Mar 2017 22:36:28 +0000 (22:36 +0000)]
Fixes to chkprintcap:
- Check the return from a call to malloc() in skim_printcap(), and
  return a NULL if that fails.
- Fix a small memory leak in main() that happens if skim_printcap()
  returns an error, including the new error-return of NULL.

Submitted by: Tom Rix <trix@juniper.net>
Reviewed by: pfg, ngie
MFC after: 4 weeks
Sponsored by: Dell EMC Isilon, Juniper
Differential Revision: D9954, D9982

7 years agoFix linking /rescue/rescue to multiple programs in usr.bin after r315113
Enji Cooper [Mon, 20 Mar 2017 22:33:22 +0000 (22:33 +0000)]
Fix linking /rescue/rescue to multiple programs in usr.bin after r315113

I meant for the line that conditionally added in /usr/bin/nc support to
be `+=', not `=`. This restores hardlinks for all programs in usr.bin
specified before nc(1), e.g., bunzip2 and tar.

Reported by: Andrzej Tobola <ato@iem.pw.edu.pl>
Submitted by: Scott Allendorf <scott-allendorf@uiowa.edu>
Pointyhat to: ngie
MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoloader: verify the value from dhcp.interface-mtu and use snprintf to set mtu
Toomas Soome [Mon, 20 Mar 2017 22:20:17 +0000 (22:20 +0000)]
loader: verify the value from dhcp.interface-mtu and use snprintf to set mtu

Since the uset can set dhcp.interface-mtu, we need to try to validate the
value. So we verify if the conversion to int is successful and we will not
allow to set value greater than max IPv4 packet size.

Also use snprintf for safety.

Reviewed by: allanjude, bapt
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8492

7 years agoRemove some more dead code.
Alexander Motin [Mon, 20 Mar 2017 20:44:14 +0000 (20:44 +0000)]
Remove some more dead code.

MFC after: 2 weeks

7 years agoIntegrate BCM4706 PMU (rev6) support, derived from the ISC-licensed Broadcom
Landon J. Fuller [Mon, 20 Mar 2017 19:27:35 +0000 (19:27 +0000)]
Integrate BCM4706 PMU (rev6) support, derived from the ISC-licensed Broadcom
sbchipc.h and hndpmu.c sources included in the RT-N16 and later firmware
source drops.

Approved by: adrian (mentor, implicit)

7 years agoUse tc_priv to find the softc in the i.MX timer driver.
Andrew Turner [Mon, 20 Mar 2017 19:25:42 +0000 (19:25 +0000)]
Use tc_priv to find the softc in the i.MX timer driver.

Sponsored by: ABT Systems Ltd

7 years agoCache tzdata when running under capsicum
Baptiste Daroussin [Mon, 20 Mar 2017 19:24:16 +0000 (19:24 +0000)]
Cache tzdata when running under capsicum

PR: 217957
Reported by: tobik@

7 years agolibstand: verify value provided by nfs.read_size
Toomas Soome [Mon, 20 Mar 2017 19:16:28 +0000 (19:16 +0000)]
libstand: verify value provided by nfs.read_size

Implement simple value check and feedback.

Reviewed by: allanjude, rpokala
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8491

7 years agoHandle kd == NULL gracefully with kvm_close(3)
Enji Cooper [Mon, 20 Mar 2017 18:28:22 +0000 (18:28 +0000)]
Handle kd == NULL gracefully with kvm_close(3)

Don't segfault in kvm_close(3) if provided a NULL pointer. Instead, return
-1 and set errno to EINVAL.

Document this new behavior explicitly.

MFC after: 1 week
Reviewed by: vangyzen
Sponsored by: Dell EMC Isilon
Differential Revision: D10065

7 years agoloader: pxe.h constants have wrong values
Toomas Soome [Mon, 20 Mar 2017 18:15:36 +0000 (18:15 +0000)]
loader: pxe.h constants have wrong values

FLTR_PRMSCS should be 0x4 and FLTR_SRC_RTG should be 0x8

PXE Specification 2.1 PXENV_UNDI_OPEN, page 59.

http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D10056

7 years agoloader: disk_cleanup was left in userboot_disk.c
Toomas Soome [Mon, 20 Mar 2017 18:03:40 +0000 (18:03 +0000)]
loader: disk_cleanup was left in userboot_disk.c

In r315408, disk_cleanup was removed, which is called at
sys/boot/userboot/userboot/userboot_disk.c:113.
This causes bhyveload to fail.

PR: 217935
Reported by: Fabian Freyer
Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D10060

7 years agoSimplify a pipe for signal handling.
Hiroki Sato [Mon, 20 Mar 2017 17:57:24 +0000 (17:57 +0000)]
Simplify a pipe for signal handling.

7 years agoFix a regression which prevented an IPv6 address in a -b option from
Hiroki Sato [Mon, 20 Mar 2017 17:46:33 +0000 (17:46 +0000)]
Fix a regression which prevented an IPv6 address in a -b option from
working.

PR: 217939
Differential Revision: https://reviews.freebsd.org/D10064

7 years agobsnmp: explicitly test the return value for open_client_{local,udp} in snmp_open(..)
Enji Cooper [Mon, 20 Mar 2017 17:26:13 +0000 (17:26 +0000)]
bsnmp: explicitly test the return value for open_client_{local,udp} in snmp_open(..)

open_client_* returns -1 on failure; 0 on success. Ensure that the return value is
0 -- otherwise exit snmp_open(..).

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agobsnmp: don't leak snmp_client.fd in open_client_udp(..) on connect(2) failure
Enji Cooper [Mon, 20 Mar 2017 17:17:54 +0000 (17:17 +0000)]
bsnmp: don't leak snmp_client.fd in open_client_udp(..) on connect(2) failure

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoPort the getaddrinfo(1) utility from NetBSD
Eric van Gyzen [Mon, 20 Mar 2017 16:44:55 +0000 (16:44 +0000)]
Port the getaddrinfo(1) utility from NetBSD

Submitted by: Lohith Bellad <lohithbsd@gmail.com>
Reviewed by: hiren (earlier rev), ae
Obtained from: NetBSD
MFC after: 1 week
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9365

7 years agolibcam: NULL out freed `ccb.cdm.matches` and `ccb.cdm.patterns` pointers
Enji Cooper [Mon, 20 Mar 2017 16:30:02 +0000 (16:30 +0000)]
libcam: NULL out freed `ccb.cdm.matches` and `ccb.cdm.patterns` pointers

This is being done to avoid potential double frees with the values.

Differential Revision: D9970
MFC after: 1 week
Reviewed by: imp
Sponsored by: Dell EMC Isilon

7 years agoMFV r315633, 315635:
Martin Matuska [Mon, 20 Mar 2017 13:02:27 +0000 (13:02 +0000)]
MFV r315633, 315635:

Sync libarchive with vendor

Vendor changes/bugfixes (FreeBSD-related):
  PR 867 (bsdcpio): show numeric uid/gid when names are not found
  PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
  PR 880 (pax): Fix handling of "size" pax header keyword
  PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
  OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
  Break ACL read/write code into platform-specific source files
  Unbreak static dependency on libbz2

MFC after: 1 week

7 years agoUpdate vendor/libarchive to git 5881c9021a85668bd945593f5ba43a0d22c53d71
Martin Matuska [Mon, 20 Mar 2017 11:12:31 +0000 (11:12 +0000)]
Update vendor/libarchive to git 5881c9021a85668bd945593f5ba43a0d22c53d71

Vendor changes (FreeBSD-related):
  Break ACL read/write code into platform-specific source files

Vendor bugfixes (FreeBSD-related):
  PR 867 (bsdcpio): show numeric uid/gid when names are not found
  PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
  PR 880 (pax): Fix handling of "size" pax header keyword
  PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
  OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
  Unbreak static dependency on libbz2