]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoFix the signature of the psignal() function.
ed [Mon, 30 May 2016 13:51:27 +0000 (13:51 +0000)]
Fix the signature of the psignal() function.

POSIX 2008 added the psignal() function which has already been part of
the BSDs for a long time. The only difference is, the POSIX version uses
an 'int' for the signal number, unlike our version which uses an
'unsigned int'. Fix up the function to use an 'int'. This should not
affect the ABI.

8 years agoAdd missing types and constants to <netdb.h>.
ed [Mon, 30 May 2016 13:37:11 +0000 (13:37 +0000)]
Add missing types and constants to <netdb.h>.

According to POSIX, the netdb.h header must also provide in_addr_t and
in_port_t. It should also provide IPPORT_RESERVED. Copy over the
necessary bits from <netinet/in.h> to achieve that.

8 years agoFix a byte order issue for the scope stored in the SCTP cookie.
tuexen [Mon, 30 May 2016 11:18:39 +0000 (11:18 +0000)]
Fix a byte order issue for the scope stored in the SCTP cookie.

MFC after: 1 week

8 years agohyperv/et: Allow Hyper-V event timer be disabled
sephe [Mon, 30 May 2016 09:44:17 +0000 (09:44 +0000)]
hyperv/et: Allow Hyper-V event timer be disabled

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

8 years agohyperv/et: Device renaming; consistent w/ other Hyper-V utils
sephe [Mon, 30 May 2016 09:35:36 +0000 (09:35 +0000)]
hyperv/et: Device renaming; consistent w/ other Hyper-V utils

While I'm here, prefix function names w/ vmbus, since unlike Hyper-V
timecounter, Hyper-V event timer will not work w/o vmbus.

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

8 years agohyperv: Move timer frequency definition to common place.
sephe [Mon, 30 May 2016 09:20:08 +0000 (09:20 +0000)]
hyperv: Move timer frequency definition to common place.

And cleanup event timer period settings.

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

8 years agoAdd missing restrict keywords to lio_listio().
ed [Mon, 30 May 2016 09:18:12 +0000 (09:18 +0000)]
Add missing restrict keywords to lio_listio().

8 years agoFix ig4 operation for certain machines
grembo [Mon, 30 May 2016 09:05:24 +0000 (09:05 +0000)]
Fix ig4 operation for certain machines

Some machine BIOSes use the I2C bus and leave it in a state that causes
interrupts to not work properly due to a pending interrupt having been
latched.

Refactor the code a bit to clear pending interrupts when I2C is enabled.
This fixes the primary problem.

Also fix a possible race condition in the interrupt handler where the
interrupt was being cleared after reading the status instead of before.

Reported by: pfg
Reviewed by: jhb
Approved by: jhb
Obtained from: DragonFly BSD
Differential Revision: https://reviews.freebsd.org/D6586

8 years agohyperv/et: Make sure only one event timer will be registered
sephe [Mon, 30 May 2016 08:50:33 +0000 (08:50 +0000)]
hyperv/et: Make sure only one event timer will be registered

This nullifies the need to use softc.

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

8 years agohyperv/vmbus: Move SINT settings to vmbus_var.h
sephe [Mon, 30 May 2016 08:42:35 +0000 (08:42 +0000)]
hyperv/vmbus: Move SINT settings to vmbus_var.h

While I'm here remove the event timer's dependency on hv_vmbus_priv.h

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

8 years agohyperv/et: Fix STIMER0 operations.
sephe [Mon, 30 May 2016 08:25:09 +0000 (08:25 +0000)]
hyperv/et: Fix STIMER0 operations.

- Make sure that STIMER0 is disabled before writting to it, since
  writing to an enabled STIMER will result in undefined behaviour.
- It is unnecessary to reconfigure STIMER0 upon each et_start().
- Make sure that MSR_HV_REF_TIME_COUNT will not return 0, since
  writing 0 to STIMER_COUNT will disable the target STIMER.

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

8 years agoAdd missing declaration of ino_t.
ed [Mon, 30 May 2016 07:50:57 +0000 (07:50 +0000)]
Add missing declaration of ino_t.

POSIX requires that <dirent.h> provides ino_t in the XSI case. In our
case, this wasn't being exposed, as d_ino is a macro that expands to
d_fileno that is an uint32_t, not an ino_t.

8 years agobge: Support 5717 C0, which is almost same as 5720 A0
sephe [Mon, 30 May 2016 06:49:01 +0000 (06:49 +0000)]
bge: Support 5717 C0, which is almost same as 5720 A0

PR: 209758
Obtained from: DragonFlyBSD d79f5d8f5fe94cd6769207b2901422977d502bc0
MFC after: 1 week

8 years agoBump __FreeBSD_cc_version after r300974.
dim [Mon, 30 May 2016 06:44:10 +0000 (06:44 +0000)]
Bump __FreeBSD_cc_version after r300974.

8 years agoMark jail(2), and the sysctls that it (and only it) uses as deprecated.
jamie [Mon, 30 May 2016 05:21:24 +0000 (05:21 +0000)]
Mark jail(2), and the sysctls that it (and only it) uses as deprecated.
jail(8) has long used jail_set(2), and those sysctl only cause confusion.

8 years agombuf: Add a flag for M_HASHTYPE_ to indicate the type has hash properties
sephe [Mon, 30 May 2016 04:48:06 +0000 (04:48 +0000)]
mbuf: Add a flag for M_HASHTYPE_ to indicate the type has hash properties

This flag has not been used, and drivers setting M_HASHTYPE_OPAQUE have
not been converted as of this commit.

Reviewed by: hps, gallatin (early version)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6406

8 years agotcp: Don't prematurely drop receiving-only connections
sephe [Mon, 30 May 2016 03:31:37 +0000 (03:31 +0000)]
tcp: Don't prematurely drop receiving-only connections

If the connection was persistent and receiving-only, several (12)
sporadic device insufficient buffers would cause the connection be
dropped prematurely:
Upon ENOBUFS in tcp_output() for an ACK, retransmission timer is
started.  No one will stop this retransmission timer for receiving-
only connection, so the retransmission timer promises to expire and
t_rxtshift is promised to be increased.  And t_rxtshift will not be
reset to 0, since no RTT measurement will be done for receiving-only
connection.  If this receiving-only connection lived long enough
(e.g. >350sec, given the RTO starts from 200ms), and it suffered 12
sporadic device insufficient buffers, i.e. t_rxtshift >= 12, this
receiving-only connection would be dropped prematurely by the
retransmission timer.

We now assert that for data segments, SYNs or FINs either rexmit or
persist timer was wired upon ENOBUFS.  And don't set rexmit timer
for other cases, i.e. ENOBUFS upon ACKs.

Discussed with: lstewart, hiren, jtl, Mike Karels
MFC after: 3 weeks
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5872

8 years agoRemove extraneous altq header files
lidl [Mon, 30 May 2016 02:09:19 +0000 (02:09 +0000)]
Remove extraneous altq header files

At some point during stable/10, the headers altq_codel.h and
altq_fairq.h where added to /usr/include/altq, before all of altq
was moved to /usr/include/net/altq.

Reviewed by: rpaulo
Approved by: rpaulo
Differential Revision: https://reviews.freebsd.org/D6596

8 years agoRegenerate timedef:
bapt [Sun, 29 May 2016 22:28:39 +0000 (22:28 +0000)]
Regenerate timedef:

For Russian:
- Convert AM/PM which are badly formatted in CLDR to replace it by the proper
  cyrillic
- Add a dependency on Text::Iconv so non unicode get the proper encoding for
  AM/PM
- fix the date format having 'r.,' and convert it to 'r.' (also fixed in Bulgarian)

For All:
- Use complete Day of Week instead of the abbreviated one

Reported by: ache

8 years agoAdd more hacks to correct CLDR data
bapt [Sun, 29 May 2016 22:27:42 +0000 (22:27 +0000)]
Add more hacks to correct CLDR data

For Russian:
- Convert AM/PM which are badly formatted in CLDR to replace it by the proper
  cyrillic
- Add a dependency on Text::Iconv so non unicode get the proper encoding for
  AM/PM
- fix the date format having 'r.,' and convert it to 'r.' (also fixed in Bulgarian)

For All:
- Use complete Day of Week instead of the abbreviated one

Reported by: ache

8 years agoPull in r269908 from upstream llvm trunk (by James Molloy):
dim [Sun, 29 May 2016 20:54:16 +0000 (20:54 +0000)]
Pull in r269908 from upstream llvm trunk (by James Molloy):

  [VectorUtils] Fix nasty use-after-free

  In truncateToMinimalBitwidths() we were RAUW'ing an instruction then
  erasing it. However, that intruction could be cached in the map we're
  iterating over. The first check is "I->use_empty()" which in most
  cases would return true, as the (deleted) object was RAUW'd first so
  would have zero use count. However in some cases the object could
  have been polluted or written over and this wouldn't be the case.
  Also it makes valgrind, asan and traditionalists who don't like their
  compiler to crash sad.

  No testcase as there are no externally visible symptoms apart from a
  crash if the stars align.

  Fixes PR26509.

This should fix crashes when building a number of ports on arm64.

Reported by: andrew

8 years agoFollow up to r300932
ngie [Sun, 29 May 2016 20:28:01 +0000 (20:28 +0000)]
Follow up to r300932

In the event MK_INET6 != no in userspace, but is disabled in the
kernel, or if there aren't any IPv6 addresses configured in userspace
(for lo0 and all physical interfaces), rpcbind would terminate
immediately instead of silently failing on

Skip over the IPv6 block to its respective cleanup with freeifaddrs if
creating the socket failed instead of terminating rpcbind immediately

MFC after: 6 days
X-MFC with: r300932
Reported by: O. Hartmann <ohartman@zedat.fu-berlin.de>
Sponsored by: EMC / Isilon Storage Division

8 years agoFix rpcbind init after r300941.
markj [Sun, 29 May 2016 19:46:34 +0000 (19:46 +0000)]
Fix rpcbind init after r300941.

- getaddrinfo() sets res = NULL on failure and freeaddrinfo() always
  dereferences its argument, so we should only free the address list after
  a successful call.
- Address a second potential leak caused by getaddrinfo(AF_INET6)
  overwriting the address list returned by getaddrinfo(AF_INET).

X-MFC-With: r300941

8 years agoStop inlining the struct ucond definition into struct pthread_cond.
kib [Sun, 29 May 2016 19:35:55 +0000 (19:35 +0000)]
Stop inlining the struct ucond definition into struct pthread_cond.
This avoids unneccessary casts and make the calls to _thr_ucond_*()
functions less questionable.

The c_spare field was not included into struct pthread_cond, so the
change modifies libthr ABI for shared condvars.  But since an off-page
does not legitimately contains any other data past the struct
pthread_cond, the change keeps shared condvars from pre- and post-
changed libthr compatible.  Also note that the whole struct ucond was
never copied in or out by kernel.

For private condvars, the privately allocated memory was never exposed
outside libthr.

Sponsored by: The FreeBSD Foundation

8 years agoRemove non-history libkse references and fix PTHREAD_PROCESSES_PRIVATE typo.
jilles [Sun, 29 May 2016 18:25:11 +0000 (18:25 +0000)]
Remove non-history libkse references and fix PTHREAD_PROCESSES_PRIVATE typo.

8 years agoImprove ARM debug_monitor for SMP machines
zbb [Sun, 29 May 2016 17:35:38 +0000 (17:35 +0000)]
Improve ARM debug_monitor for SMP machines

- Reset debug architecture and enable monitor for secondary
  CPUs in init_secondary() rather than when configuring watchpoint, etc.
- Disable HW debugging capabilities when one of the CPU cores fails
  to set up.
- Use dbg_capable() in a more atomic manner to avoid any mismatch
  between CPUs.

Differential Revision: https://reviews.freebsd.org/D6009

8 years agoFix debug_monitor code for older ARMs (ARM11)
zbb [Sun, 29 May 2016 17:33:49 +0000 (17:33 +0000)]
Fix debug_monitor code for older ARMs (ARM11)

- Enable monitor mode prior to accessing watchpoint
  registers for v6, v6.1 architectures.
- Fix configuration scheme for v6, v6.1 and v7 Debug Archs
- Enable monitor unconditionally and for good instead
  of enabling and disabling it (needed for single stepping
  on on v6/v6.1)

Tested on RPI-B and Arndale

Differential Revision: https://reviews.freebsd.org/D6008

8 years agoStop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling
dim [Sun, 29 May 2016 17:32:19 +0000 (17:32 +0000)]
Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling
for C++.  It clashes with the one in libc++'s <atomic> header.

(Previously, the _Atomic() macro was defined in <stdatomic.h>, which is
only for use with C11, but for various reasons it was moved to its
current location in r251804.)

Discussed with: bdrewery, ed
MFC after: 2 weeks

8 years agoRetune SHA2 code for improved performance on CPUs with more ILP and
cperciva [Sun, 29 May 2016 17:26:40 +0000 (17:26 +0000)]
Retune SHA2 code for improved performance on CPUs with more ILP and
a preference for memory load instructions over large code footprints
with embedded immediate variables.

On amd64 CPUs from 2007-2008 there is not a significant change, but
amd64 CPUs from 2009-2010 get roughly 10% more throughput with this
code; amd64 CPUs from 2011-2012 get roughly 15% more throughput; and
AMD64 CPUs from 2013-2015 get 20-25% more throughput.  The Raspberry
Pi 2 increases its throughput by 6-8%.

Sponsored by: Tarsnap Backup Inc.
Performance tested by: allanjude
MFC after: 3 weeks

8 years agoMicro optimize: C standard guarantees that right shift for unsigned value
ache [Sun, 29 May 2016 16:39:28 +0000 (16:39 +0000)]
Micro optimize: C standard guarantees that right shift for unsigned value
fills left bits with zero, and we have exact 32bit unsigned value
(uint32_t), so there is no reason to add "& 0x7fffffff" here.

MFC after:      1 week

8 years agoReplace local prototype of basename() with an inclusion of <libgen.h>.
ed [Sun, 29 May 2016 16:10:01 +0000 (16:10 +0000)]
Replace local prototype of basename() with an inclusion of <libgen.h>.

libiberty currently defines the prototype for basename() itself instead
of using <libgen.h>. It still uses the BSD-style prototype instead of
the POSIX one, meaning that if FreeBSD would switch over to the POSIX
one, you wouldn't be able to use libiberty.h and libgen.h in a single
source file. It turns out that kgdb does this. Patch up libiberty to
just include <libgen.h>.

I'm currently talking to upstream to see whether we can come up with a
more complete solution that could be integrated, but for our
unmaintained copy of GDB in base, let's just apply the simplest
workaround possible.

Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D6631

8 years agoDo not leak the vm object lock when swap reservation failed, in
kib [Sun, 29 May 2016 15:46:19 +0000 (15:46 +0000)]
Do not leak the vm object lock when swap reservation failed, in
vm_object_coalesce().

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

8 years ago_umtx_op(2): Note deprecation of UMTX_OP_MUTEX_WAKE.
jilles [Sun, 29 May 2016 15:02:55 +0000 (15:02 +0000)]
_umtx_op(2): Note deprecation of UMTX_OP_MUTEX_WAKE.

8 years ago_umtx_op(2),thr_*(2): Various spelling, grammar and mdoc fixes.
jilles [Sun, 29 May 2016 14:16:23 +0000 (14:16 +0000)]
_umtx_op(2),thr_*(2): Various spelling, grammar and mdoc fixes.

8 years ago1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes
ache [Sun, 29 May 2016 13:57:06 +0000 (13:57 +0000)]
1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes
reading hard.

2) Instead of doing range transformation in each and every function here,
do it single time directly in do_rand(). One "mod" operation overhead is not
a big deal, but the code looks nicer and possible future functions additions
or PRNG change do not miss range transformations neither have unneeded ones.

3) Use POSIX argument types for visible functions (cosmetic).

MFC after:      1 week

8 years agoFix style of the libgen.h header.
ed [Sun, 29 May 2016 12:21:54 +0000 (12:21 +0000)]
Fix style of the libgen.h header.

- Remove unneeded declarations of removed/unimplemented features.
- Add missing tab after #define.
- Add missing ! before trailing comment.

8 years ago1) Unifdef USE_WEAK_SEEDING it is too obsolete to support and makes reading
ache [Sun, 29 May 2016 11:54:09 +0000 (11:54 +0000)]
1) Unifdef USE_WEAK_SEEDING it is too obsolete to support and makes reading
harder.

2) ACM paper require seed to be in [1, 2^31-2] range, so use the same range
shifting as already done for rand(3). Also protect srandomdev() + TYPE_0 case
(non default) from negative seeds.

3) Don't check for valid "type" range in setstate(), it is always valid as
calculated. Instead add a check that rear pointer not exceeed end pointer.

MFC after:      1 week

8 years agoInvoke the dirname() function in a POSIX compliant way.
ed [Sun, 29 May 2016 10:41:27 +0000 (10:41 +0000)]
Invoke the dirname() function in a POSIX compliant way.

POSIX requires that the argument of dirname() is of type "char *". In
other words, the input buffer can be modified by the function to store
the directory name.

Pull a copy of the string before calling dirname(). We don't care about
freeing up the memory afterwards, as this is done at the very bottom of
main(), right before the program terminates.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D6628

8 years agoARM GIC: Allow to setup interrupt without configuration data.
mmel [Sun, 29 May 2016 07:39:56 +0000 (07:39 +0000)]
ARM GIC: Allow to setup interrupt without configuration data.
In some cases, like for PCI devices, only interrupt numbers are enumerated
from HW. In this case, use INTR_foo_CONFORM as level and trigger values.

8 years agoNow that PIE is free of runtime floating point, revert r300853 to
truckman [Sun, 29 May 2016 07:29:35 +0000 (07:29 +0000)]
Now that PIE is free of runtime floating point,  revert r300853 to
reconnect PIE to the build.

8 years agoCast some expressions that multiply a long long constant by a
truckman [Sun, 29 May 2016 07:23:56 +0000 (07:23 +0000)]
Cast some expressions that multiply a long long constant by a
floating point constant to int64_t.  This avoids the runtime
conversion of the the other operand in a set of comparisons from
int64_t to floating point and doing the comparisions in floating
point.

Suggested by: lidl
Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after: 2 weeks (with r300779)

8 years agoStaticize variables only used in rpcbind.c
ngie [Sun, 29 May 2016 07:01:12 +0000 (07:01 +0000)]
Staticize variables only used in rpcbind.c

This is some low hanging fruit necessary for making this WARNS?= 6 clean

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unnecessary caller_uaddr != NULL test before calling free on it
ngie [Sun, 29 May 2016 06:29:22 +0000 (06:29 +0000)]
Remove unnecessary caller_uaddr != NULL test before calling free on it

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoLibcompat: Swap CXX/CFLAGS.
bdrewery [Sun, 29 May 2016 06:20:36 +0000 (06:20 +0000)]
Libcompat: Swap CXX/CFLAGS.

This is the same as done for the native build in r300770 to ensure that
the libc++ build reads from SYSROOT/usr/include/c++/v1 before reading
from SYSROOT/usr/include.

8 years agoGCC External: Revert r300886, r300904, r300917, r300918
bdrewery [Sun, 29 May 2016 06:20:15 +0000 (06:20 +0000)]
GCC External: Revert r300886, r300904, r300917, r300918

The fix in r300873 is mostly enough.  A fix for lib32 will be
committed.separately.

8 years agoRemove a useless if (x != NULL) check before calling free on allocated_uaddr
ngie [Sun, 29 May 2016 06:01:18 +0000 (06:01 +0000)]
Remove a useless if (x != NULL) check before calling free on allocated_uaddr

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't leak res in network_init(..)
ngie [Sun, 29 May 2016 05:55:21 +0000 (05:55 +0000)]
Don't leak res in network_init(..)

Call freeaddrinfo on it after it's been used

MFC after: 1 week
Reported by: Coverity
CID: 1225050
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove yacc and the yacc tests if MK_TOOLCHAIN == no
ngie [Sun, 29 May 2016 04:56:48 +0000 (04:56 +0000)]
Remove yacc and the yacc tests if MK_TOOLCHAIN == no

yacc's install is conditional based on MK_TOOLCHAIN != no

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoUse require.progs with bc instead of require.files with /usr/bin/bc
ngie [Sun, 29 May 2016 04:50:49 +0000 (04:50 +0000)]
Use require.progs with bc instead of require.files with /usr/bin/bc

This will make things more flexible if the program path changes in the future,
and the test in and of itself doesn't call /usr/bin/bc -- it just calls bc

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove the sa(8) tests if MK_ACCT == no when "make delete-old" is run
ngie [Sun, 29 May 2016 04:47:10 +0000 (04:47 +0000)]
Remove the sa(8) tests if MK_ACCT == no when "make delete-old" is run

sa(8) is conditionally installed based on MK_ACCT != no today

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove the etcupdate tests if MK_RCS == no when "make delete-old" is run
ngie [Sun, 29 May 2016 04:43:24 +0000 (04:43 +0000)]
Remove the etcupdate tests if MK_RCS == no when "make delete-old" is run

etcupdate is conditionally installed based on MK_RCS != no today

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove the calendar tests if MK_CALENDAR == no when "make delete-old"
ngie [Sun, 29 May 2016 04:39:20 +0000 (04:39 +0000)]
Remove the calendar tests if MK_CALENDAR == no when "make delete-old"
is run

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoMark out_of_mem(..) and usage(..) with __dead2 as they both directly call exit
ngie [Sun, 29 May 2016 04:18:47 +0000 (04:18 +0000)]
Mark out_of_mem(..) and usage(..) with __dead2 as they both directly call exit
as a hint to static analysis tools

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoPlug leak with ifp by calling freeifaddrs after calling getifaddrs
ngie [Sun, 29 May 2016 04:02:02 +0000 (04:02 +0000)]
Plug leak with ifp by calling freeifaddrs after calling getifaddrs

MFC after: 1 week
Obtained from: NetBSD v1.18
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd Documentation for missing ifconfig(8) flags
allanjude [Sun, 29 May 2016 03:44:37 +0000 (03:44 +0000)]
Add Documentation for missing ifconfig(8) flags

autoconf / -autoconf
deprecated / -deprecated
pltime
vltime

PR: 209822
Submitted by: Sevan Janiyan <venture37@geeklan.co.uk>
MFC after: 2 weeks

8 years agoCatch malloc(3) errors and socket(2) errors
ngie [Sun, 29 May 2016 03:42:50 +0000 (03:42 +0000)]
Catch malloc(3) errors and socket(2) errors

- malloc failing will result in a delayed segfault
- socket failing will result in delayed failures with setsockopt

Exit in the event that either of these high-level conditions are met.

Reported by: Coverity
CID: 976288, 976321, 976858
Sponsored by: EMC / Isilon Storage Division

8 years agoMake netif REQUIRE hostid
ngie [Sun, 29 May 2016 02:59:03 +0000 (02:59 +0000)]
Make netif REQUIRE hostid

As noted in the PR, if etc/rc.d/zvol is removed, netif will be run before
hostid, and the MAC address generated for any bridge devices will be
non-deterministic. Make the MAC address generated be deterministic for
bridge devices by explicitly REQUIRE'ing hostid.

This fixes up the rest of the PR, inadvertently committed in r299844

MFC after: 1 week
PR: 195188
Sponsored by: EMC / Isilon Storage Division

8 years agoDelete duplicate declaration for i40e_blink_phy_link_led(..)
ngie [Sun, 29 May 2016 01:52:05 +0000 (01:52 +0000)]
Delete duplicate declaration for i40e_blink_phy_link_led(..)

It was already declared on line 90

Differential Revision: https://reviews.freebsd.org/D6570
Reported by: gcc
Reviewed by: sbruno
Sponsored by: EMC / Isilon Storage Division

8 years agoLibcompat: Set build tools in environment rather than make overrides.
bdrewery [Sun, 29 May 2016 01:45:15 +0000 (01:45 +0000)]
Libcompat: Set build tools in environment rather than make overrides.

This allows the CXX hack in r300917 for external GCC to work for
the lib32 build.  It is also the same pattern as the native
build uses by adding the tools into CROSSENV for external
toolchain, rather than make overrides.

Sponsored by: EMC / Isilon Storage Division

8 years agoSubmitted by: phil
phil [Sun, 29 May 2016 01:43:28 +0000 (01:43 +0000)]
Submitted by: phil
Reviewed by: sjg (mentor)
Approved by: sjg

8 years agoFix "make installworld" with MK_CDDL == no after r300906 by
ngie [Sun, 29 May 2016 01:38:12 +0000 (01:38 +0000)]
Fix "make installworld" with MK_CDDL == no after r300906 by
adding a missing entry for ${TESTSBASE}/cddl/sbin

X-MFC with: r300906
Pointyhat to: asomers
Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
Sponsored by: EMC / Isilon Storage Division

8 years agoImport the skein hashing algorithm, based on the threefish block cipher
allanjude [Sun, 29 May 2016 01:15:36 +0000 (01:15 +0000)]
Import the skein hashing algorithm, based on the threefish block cipher

Connect it to userland (libmd, libcrypt, sbin/md5) and kernel (crypto.ko)

Support for skein as a ZFS checksum algorithm was introduced in r289422
but is disconnected because FreeBSD lacked a Skein implementation.

A further commit will enable it in ZFS.

Reviewed by: cem
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D6166

8 years agoFix with external GCC after r300886.
bdrewery [Sun, 29 May 2016 01:15:15 +0000 (01:15 +0000)]
Fix with external GCC after r300886.

Somehow the /usr/include path got lost in this particular case.
Just pass it along from --sysroot as was already done for
DIRDEPS_BUILD.

Sponsored by: EMC / Isilon Storage Division

8 years agoAvoid more literal-suffix errors with C++11
bdrewery [Sun, 29 May 2016 00:40:29 +0000 (00:40 +0000)]
Avoid more literal-suffix errors with C++11

8 years agoExternal GCC: Ensure our libstdc++ symlink to libc++ is found.
bdrewery [Sun, 29 May 2016 00:10:23 +0000 (00:10 +0000)]
External GCC: Ensure our libstdc++ symlink to libc++ is found.

Similar to r300917, the search path for our symlink hack must come
before the =/usr/lib search path.

This fixes the atf-check build after r300886.

8 years agoGCC XCC -isystem hack: Ensure CXX search =/usr/include/c++1/v1 first.
bdrewery [Sat, 28 May 2016 23:10:07 +0000 (23:10 +0000)]
GCC XCC -isystem hack: Ensure CXX search =/usr/include/c++1/v1 first.

The C++ header files must be searched before /usr/include.

The original code in Makefile.inc1 did this before the change in r297271 to
use -isystem.  The libc++ import in r300770 fixed the bug introduced in
r297271 by swapping XCFLAGS and XCXXFLAGS ordering in CROSSENV.

Moving the code from Makefile.inc1 to bsd.sys.mk in r300886 also made it
more difficult to control the order of the flags.  CXXFLAGS is based on
CFLAGS, so any additions to it will come after CFLAGS.  The CROSSENV
code from Makefile.inc1 was such that it was ensured the CXXFLAGS came
first by setting them directly in CXX.  Using CXXFLAGS+=-I would work
here, but instead continue to use -isystem by adding it to CXX so it
comes before CFLAGS.

Reported by: dim

8 years agoAvoid literal-suffix error due to missing space.
bdrewery [Sat, 28 May 2016 22:27:54 +0000 (22:27 +0000)]
Avoid literal-suffix error due to missing space.

8 years agoReadd week day to default dates
bapt [Sat, 28 May 2016 21:26:50 +0000 (21:26 +0000)]
Readd week day to default dates

Requested by: many

8 years agoAdd a hack to readd the day of weeks in default date formats
bapt [Sat, 28 May 2016 21:25:24 +0000 (21:25 +0000)]
Add a hack to readd the day of weeks in default date formats

8 years agoUndo meaningless local changes to libxo so we're in sync with the github repo.
phil [Sat, 28 May 2016 19:39:15 +0000 (19:39 +0000)]
Undo meaningless local changes to libxo so we're in sync with the github repo.

Submitted by: phil
Reviewed by: sjg (mentor)
Approved by: sjg

8 years agonet80211: replace m_getcl/m_gethdr pair with m_get2 in ieee80211_fragment()
avos [Sat, 28 May 2016 19:13:39 +0000 (19:13 +0000)]
net80211: replace m_getcl/m_gethdr pair with m_get2 in ieee80211_fragment()

- Switch to m_get2() for mbuf allocation instead of manual mbuf size
determination.
- Reuse MIN() macro for mbuf size selection.

8 years agonet80211: fix use-after-free in frame defragmentation procedure.
avos [Sat, 28 May 2016 18:49:17 +0000 (18:49 +0000)]
net80211: fix use-after-free in frame defragmentation procedure.

- Assign frame sequence/fragment number before frame concatenation;
otherwise, frame header pointer (wh) will be invalid.
- Move this code block upper and eliminate duplicate 'lwh = mtod()'
assignment.

Tested with wpi(4) (transmitter) (STA mode) and urtwn(4) (receiver)
(HOSTAP mode).

8 years agozfsd(8), the ZFS fault management daemon
asomers [Sat, 28 May 2016 17:43:40 +0000 (17:43 +0000)]
zfsd(8), the ZFS fault management daemon

Add zfsd, which deals with hard drive faults in ZFS pools. It manages
hotspares and replements in drive slots that publish physical paths.

cddl/usr.sbin/zfsd
Add zfsd(8) and its unit tests

cddl/usr.sbin/Makefile
Add zfsd to the build

lib/libdevdctl
A C++ library that helps devd clients process events

lib/Makefile
share/mk/bsd.libnames.mk
share/mk/src.libnames.mk
Add libdevdctl to the build. It's a private library, unusable by
out-of-tree software.

etc/defaults/rc.conf
By default, set zfsd_enable to NO

etc/mtree/BSD.include.dist
Add a directory for libdevdctl's include files

etc/mtree/BSD.tests.dist
Add a directory for zfsd's unit tests

etc/mtree/BSD.var.dist
Add /var/db/zfsd/cases, where zfsd stores case files while it's shut
down.

etc/rc.d/Makefile
etc/rc.d/zfsd
Add zfsd's rc script

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
Fix the resource.fs.zfs.statechange message. It had a number of
problems:

It was only being emitted on a transition to the HEALTHY state.
That made it impossible for zfsd to take actions based on drives
getting sicker.

It compared the new state to vdev_prevstate, which is the state that
the vdev had the last time it was opened.  That doesn't make sense,
because a vdev can change state multiple times without being
reopened.

vdev_set_state contains logic that will change the device's new
state based on various conditions.  However, the statechange event
was being posted _before_ that logic took effect.  Now it's being
posted after.

Submitted by: gibbs, asomers, mav, allanjude
Reviewed by: mav, delphij
Relnotes: yes
Sponsored by: Spectra Logic Corp, iX Systems
Differential Revision: https://reviews.freebsd.org/D6564

8 years agoUse a relative symlink for proper --sysroot support.
bdrewery [Sat, 28 May 2016 16:38:09 +0000 (16:38 +0000)]
Use a relative symlink for proper --sysroot support.

Sponsored by: EMC / Isilon Storage Division

8 years agoAlways export X_* vars.
bdrewery [Sat, 28 May 2016 16:21:05 +0000 (16:21 +0000)]
Always export X_* vars.

This fixes CROSS_TOOLCHAIN builds after r300886 since it
relies on X_COMPILER_TYPE being set.

The X_* vars will only represent the external compiler
being used.

Sponsored by: EMC / Isilon Storage Division

8 years agoImplement SHA-512 truncated (224 and 256 bits)
allanjude [Sat, 28 May 2016 16:06:07 +0000 (16:06 +0000)]
Implement SHA-512 truncated (224 and 256 bits)

This implements SHA-512/256, which generates a 256 bit hash by
calculating the SHA-512 then truncating the result. A different initial
value is used, making the result different from the first 256 bits of
the SHA-512 of the same input. SHA-512 is ~50% faster than SHA-256 on
64bit platforms, so the result is a faster 256 bit hash.

The main goal of this implementation is to enable support for this
faster hashing algorithm in ZFS. The feature was introduced into ZFS
in r289422, but is disconnected because SHA-512/256 support was missing.
A further commit will enable it in ZFS.

This is the follow on to r292782

Reviewed by: cem
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D6061

8 years agoDon't panic in hwpmc when stopping sampling.
andrew [Sat, 28 May 2016 13:05:39 +0000 (13:05 +0000)]
Don't panic in hwpmc when stopping sampling.

When hwpmc stops sampling it will set the pm_state to something other
than PMC_STATE_RUNNING. This means the following sequence can happen:

CPU 0: Enter the interrupt handler
CPU 0: Set the thread TDP_CALLCHAIN pflag
CPU 1: Stop sampling
CPU 0: Call pmc_process_samples, sampling is stopped so clears ps_nsamples
CPU 0: Finishes interrupt processing with the TDP_CALLCHAIN flag set
CPU 0: Call pmc_capture_user_callchain to capture the user call chain
CPU 0: Find all the pmc sample are free so no call chains need to be captured
CPU 0: KASSERT because of this

This fixes the issue by checking if any of the samples have been stopped
and including this in te KASSERT.

PR: 204273
Reviewed by: bz, gnn
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6581

8 years agoIn if_attachdomain1() there does not seem to be any reason
bz [Sat, 28 May 2016 08:32:15 +0000 (08:32 +0000)]
In if_attachdomain1() there does not seem to be any reason
to use TRYLOCK rather than just acquire the lock, so just do that.

Reviewed by: markj
Obtained from: projects/vnet
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6578

8 years ago[ath] add WB335 btcoex for initial testing.
adrian [Sat, 28 May 2016 02:14:24 +0000 (02:14 +0000)]
[ath] add WB335 btcoex for initial testing.

This is like the WB222 coexistence (ie, "MCI", a message bus inside the
chip), and it's currently a cut/paste so I can start using it to flesh
out the differences with WB222.

It doesn't completely /do/ bluetooth coexistence, because it turns out
I need to add some contigmalloc'ed buffers to the btcoex path for this
type of hardware.  I'm putting this work in the "people would like
to see functioning-ish btcoex before FreeBSD-11" bucket because I see
this as "broken".

Tested:

* QCA9535 (WB335) NIC, BT + 2GHz STA

8 years agocxgbe/t4_tom: Exempt RDMA connections from a TCP sanity test for now, to
np [Sat, 28 May 2016 00:38:17 +0000 (00:38 +0000)]
cxgbe/t4_tom: Exempt RDMA connections from a TCP sanity test for now, to
avoid panicking debug kernels.

t4_tom does not keep track of a connection once it switches to ULP mode
iWARP.  If the connection falls out of ULP mode the driver/hardware seq#
etc. are out of sync.  A better fix would be to figure out what the
current seq# are, update the driver's state, and perform all sanity
checks as usual.

8 years agoAdd gpiokeys to the list of GPIO modules built only if FDT is enabled
gonzo [Sat, 28 May 2016 00:22:39 +0000 (00:22 +0000)]
Add gpiokeys to the list of GPIO modules built only if FDT is enabled

8 years agoDon't truncate existing error when writing the log.
bdrewery [Fri, 27 May 2016 23:58:00 +0000 (23:58 +0000)]
Don't truncate existing error when writing the log.

Suggested by: markj
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRename function to be less generic.
bdrewery [Fri, 27 May 2016 23:57:57 +0000 (23:57 +0000)]
Rename function to be less generic.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoWrite to the log using the tracer's credentials.
bdrewery [Fri, 27 May 2016 23:57:53 +0000 (23:57 +0000)]
Write to the log using the tracer's credentials.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoexec: Cease tracing if credentials will change with the new image.
bdrewery [Fri, 27 May 2016 23:57:43 +0000 (23:57 +0000)]
exec: Cease tracing if credentials will change with the new image.

This also prevents tracing to a P_INEXEC process since it could race
with other processes attaching to it in filemon_event_process_exec() due
to the filemon_get_proc() race of incrementing ref and then locking the
filemon.  With the no-P_INEXEC invariant in place the p_filemon may only
be the same or NULL when trying to drop it in
filemon_event_process_exec().

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6545

8 years agoFix taskqueue groups to work with EARLY_AP_STARTUP.
jhb [Fri, 27 May 2016 23:49:16 +0000 (23:49 +0000)]
Fix taskqueue groups to work with EARLY_AP_STARTUP.

In the EARLY_AP_STARTUP case the APs are already running when a taskqgroup
is created, so adjust the group at the same time it is created.

Sponsored by: Netflix

8 years agoiw_cxgbe: Plug a lock leak in process_mpa_request().
np [Fri, 27 May 2016 23:44:33 +0000 (23:44 +0000)]
iw_cxgbe: Plug a lock leak in process_mpa_request().

If the parent is DEAD or connect_request_upcall() fails, the parent
mutex is left locked.  This leads to a hang when process_mpa_request()
is called again for another child of the listening endpoint.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Obtained from: upstream iw_cxgb4
Sponsored by: Chelsio Communications

8 years agoMove external GCC compiler hacks to bsd.sys.mk.
bdrewery [Fri, 27 May 2016 23:03:44 +0000 (23:03 +0000)]
Move external GCC compiler hacks to bsd.sys.mk.

This allows respecting -nostdinc, -nostdinc++ and -nostdlib before
making the decision to add in -isystem, etc.  The -isystem flags
are problematic for building lib/libc++ and lib/libcxxrt which wants
to only use its own headers.

More information the need of these flags can be found at
https://gcc.gnu.org/ml/gcc/2016-03/msg00219.html

This also reverts r300873.

Sponsored by: EMC / Isilon Storage Division

8 years agoLibcompat: Only pass -isystem =/usr/include for external GCC.
bdrewery [Fri, 27 May 2016 23:03:28 +0000 (23:03 +0000)]
Libcompat: Only pass -isystem =/usr/include for external GCC.

This is the same as the main build logic.  GCC with a cross-compiler
requires using -isystem to =/usr/include to get the search order
correct.

Reported by: dim, asomers
Sponsored by: EMC / Isilon Storage Division

8 years agoFix up r300870
ngie [Fri, 27 May 2016 22:56:00 +0000 (22:56 +0000)]
Fix up r300870

The sys/types.h fix I proposed was only tested with zfs(4), not with
libzpool, which is where the build failure actually existed

Remove vm/vm_pageout.h from arc.c and zfs_vnops.c because they're both
unneeded

MFC after: 1 week
X-MFC with: r300865, r300870
In collaboration with: kib
Submitted by: alc
Sponsored by: EMC / Isilon Storage Division

8 years agoFix typo from r300880
asomers [Fri, 27 May 2016 22:44:33 +0000 (22:44 +0000)]
Fix typo from r300880

Reported by: rpokala
MFC after: Never
Sponsored by: Spectra Logic Corp

8 years agoAlways create loopback routes on every fib
asomers [Fri, 27 May 2016 22:40:40 +0000 (22:40 +0000)]
Always create loopback routes on every fib

Always create loopback routes on every fib, for both IPv4 and IPv6

etc/rc.d/routing
Create loopback IPv4 and IPv6 routes on every fib at boot. Revert
278302; now that all FIBs have IPv6 loopback routes, the
"route add -reject" commands won't fail.

tests/etc/rc.d/routing_test.sh
Greatly simplify static_ipv6_loopback_route_for_each_fib. It was
written under the assumption that loopback routes would be added to
a given fib by the kernel as soon as an interface is configured on
that fib. However, the logic can be much simpler now that we simply
add loopback routes to all fibs at boot. This also removes the need
to run the test as root, removes the restriction that
net.add_addr_allfibs=0, and removes the need to configure fibs in
kyua.conf.

Also, add a test case for IPv4 loopback routes

Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6582

8 years agoAvoid issuing spa config updates for physical path when not necessary
asomers [Fri, 27 May 2016 22:32:44 +0000 (22:32 +0000)]
Avoid issuing spa config updates for physical path when not necessary

ZFS's configuration needs to be updated whenever the physical path for a
device changes, but not when a new device is introduced. This is because new
devices necessarily cause config updates, but only if they are actually
accepted into the pool.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Split vdev_geom_set_physpath out of vdev_geom_attrchanged.  When
setting the vdev's physical path, only request a config update if
the physical path has changed.  Don't request it when opening a
device for the first time, because the config sync will happen
anyway upstack.

sys/geom/geom_dev.c
Split g_dev_set_physpath and g_dev_set_media out of
g_dev_attrchanged

Submitted by: will, asomers
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6428

8 years agoStrip leading spaces off of a SCSI disk's serial number
asomers [Fri, 27 May 2016 22:26:43 +0000 (22:26 +0000)]
Strip leading spaces off of a SCSI disk's serial number

sys/cam/scsi/scsi_xpt.c
Strip leading spaces off of a SCSI disk's reported serial number
when populating the CAM serial number. This affects the output of
"diskinfo -v" and the names of /dev/diskid/DISK-* device nodes,
among other things.

SPC5r05 says that the Product Serial Number field from the Unit
Serial Number VPD page is right-aligned. So any leading spaces are
not part of the actual serial number. Most devices don't left-pad
their serial numbers, but some do. In particular, the SN VPD page
that an LSI HBA emulates for a SATA drive contains enough
left-padding to fill a 20-byte field.

UPDATING
Add a note to UPDATING, because some users may have to update
/etc/fstab or geom labels.

Reviewed by: ken, mav
MFC after: Never
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6516

8 years agoMerge ACPICA 20160527.
jkim [Fri, 27 May 2016 22:16:46 +0000 (22:16 +0000)]
Merge ACPICA 20160527.

Relnotes: yes

8 years agoFix erronious mixed use of tx/rx variables/constants in the same expression.
ian [Fri, 27 May 2016 22:14:39 +0000 (22:14 +0000)]
Fix erronious mixed use of tx/rx variables/constants in the same expression.

Pointed out by jmcneill; other instances found by grep -iE 'rx.*tx|tx.*rx'

8 years agoiw_cxgbe: Use vmem(9) to manage PBL and RQT allocations.
np [Fri, 27 May 2016 21:26:26 +0000 (21:26 +0000)]
iw_cxgbe: Use vmem(9) to manage PBL and RQT allocations.

Submitted by: Krishnamraju Eraparaju at Chelsio
Reviewed by: Steve Wise
Sponsored by: Chelsio Communications

8 years agoUpdate usage(..)
ngie [Fri, 27 May 2016 21:12:25 +0000 (21:12 +0000)]
Update usage(..)

- Document missing options
- Sync options with ioatcontrol(8).
- Make it clear that the first 2 parameters are always required.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoAfter r300770, for libc++ and libcxxrt, use -isystem instead of -I.
dim [Fri, 27 May 2016 20:45:32 +0000 (20:45 +0000)]
After r300770, for libc++ and libcxxrt, use -isystem instead of -I.
This should fix builds with external gcc toolchains from ports, which
also use -isystem to work around problems with gcc's --sysroot
implementation.  Thanks to Bryan Drewery for this workaround.

8 years agoGo back to unconditionally compiling modules/gpio now that the parts of it
ian [Fri, 27 May 2016 20:43:46 +0000 (20:43 +0000)]
Go back to unconditionally compiling modules/gpio now that the parts of it
dependent on FDT support are conditionally compiled only on FDT platforms.