Commit Graph

221609 Commits

Author SHA1 Message Date
Dimitry Andric
2d23488dac 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
2017-03-22 21:45:42 +00:00
Enji Cooper
7ce037341c 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
2017-03-22 21:39:00 +00:00
Baptiste Daroussin
42c88c4100 Use MAX and MIN macros from sys/param.h 2017-03-22 21:35:01 +00:00
Enji Cooper
67d01c2bab 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
2017-03-22 21:32:44 +00:00
Kristof Provost
2f8fb3a868 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
2017-03-22 21:18:18 +00:00
Warner Losh
62fd382c43 Simplify the code a little.
Submitted by: rppokala
Sponsored by: Netflix
2017-03-22 20:51:52 +00:00
Enji Cooper
05dad2b781 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
2017-03-22 20:06:29 +00:00
Enji Cooper
cf4097dfdf 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
2017-03-22 19:48:09 +00:00
Enji Cooper
c25e946c34 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
2017-03-22 19:23:13 +00:00
Ed Schouten
75865d0d75 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.
2017-03-22 19:20:39 +00:00
Warner Losh
79d80af216 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.
2017-03-22 19:18:47 +00:00
Enji Cooper
eea7b35fb9 style(9): sort #includes
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-22 19:17:13 +00:00
Warner Losh
37b5835028 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
2017-03-22 19:00:41 +00:00
Ed Schouten
8b36e24529 Add forward declaration for struct vnode.
The coredump() function provided by this header file has struct vnode *
as an argument.

MFC after:	1 week
2017-03-22 18:45:13 +00:00
Mark Johnston
643fc6b26f Add initializations missed in r315728.
X-MFC With:	r315728
2017-03-22 18:33:29 +00:00
Mark Johnston
8440c5e621 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
2017-03-22 18:31:44 +00:00
Mark Johnston
48da4e2024 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
2017-03-22 18:14:55 +00:00
Enji Cooper
78b83a1ea1 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
2017-03-22 18:13:14 +00:00
Conrad Meyer
0a8ff54eb1 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:		1329566, 1372625
Sponsored by:	Dell EMC Isilon
2017-03-22 17:37:47 +00:00
Mark Johnston
e5fe3ae2b4 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
2017-03-22 17:33:57 +00:00
Mark Johnston
3d6732549d 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
2017-03-22 17:29:04 +00:00
Enji Cooper
84eb6b9887 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
2017-03-22 17:28:53 +00:00
Peter Grehan
e9517d2481 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
2017-03-22 17:06:57 +00:00
Peter Grehan
b9c1cdd190 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
2017-03-22 16:53:03 +00:00
Hans Petter Selasky
82d0140707 Add full VNET support to the inet_get_local_port_range() function in
the LinuxKPI.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-03-22 15:46:31 +00:00
Hans Petter Selasky
303bd80ad5 Add support for more IPv4 and IPv6 related macros in the LinuxKPI.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-03-22 15:44:00 +00:00
Andrew Turner
e336138c40 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
2017-03-22 14:30:02 +00:00
Alexander Motin
f988d55683 Fix printing bits above first eight.
Reported by:	Coverity
CID:		1372596
MFC after:	1 week
2017-03-22 13:53:21 +00:00
Dag-Erling Smørgrav
3869fb7832 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
2017-03-22 13:16:04 +00:00
Alexander Motin
ea8e769e42 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
2017-03-22 11:06:33 +00:00
Alexander Motin
2d24b6af63 Cleanup response queue processing.
MFC after:	2 weeks
2017-03-22 08:56:03 +00:00
Ed Schouten
ae2373da91 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
2017-03-22 07:05:27 +00:00
Ed Schouten
36cc183884 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().
2017-03-22 06:43:10 +00:00
Enji Cooper
8b69c3e79f 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
2017-03-22 05:27:20 +00:00
Enji Cooper
25e76a1d57 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
2017-03-22 02:44:39 +00:00
Enji Cooper
881b0edb8f 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
2017-03-22 02:42:00 +00:00
Eric van Gyzen
16fe28bb9f 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
2017-03-22 00:50:36 +00:00
Conrad Meyer
5abb3b74d3 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
2017-03-21 22:41:37 +00:00
Ian Lepore
83157972d6 Eliminate a "format string is not a string literal" warning. 2017-03-21 22:21:29 +00:00
Bryan Drewery
3507006763 Rename _cc to _gcc to be more clear.
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-21 22:09:00 +00:00
Enji Cooper
c9f1eca5c4 Delete trailing whitespace (no functional change)
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-21 22:00:52 +00:00
Dimitry Andric
d006dde2fd 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
2017-03-21 21:07:37 +00:00
Enji Cooper
0f5425a4fc 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
2017-03-21 20:48:36 +00:00
Enji Cooper
279e2af5d1 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
2017-03-21 19:10:07 +00:00
Enji Cooper
7d0a282a12 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
2017-03-21 19:02:17 +00:00
Ed Maste
26af611582 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
2017-03-21 18:02:14 +00:00
Gleb Smirnoff
3ae4b0e7e8 Force same alignment on struct xinpgen as we have on struct xinpcb. This
fixes 32-bit builds.
2017-03-21 16:23:44 +00:00
Alexander Motin
cf8242898d Remove another remnants left after r246713.
MFC after:	2 weeks
2017-03-21 14:14:11 +00:00
Alexander Motin
97dfdd4efa Remove some dead code left after r246713.
MFC after:	2 weeks
2017-03-21 13:49:43 +00:00
Alexander Motin
31c161a615 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
2017-03-21 13:10:37 +00:00