]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoAdd kern_cpuset_getaffinity() and kern_cpuset_getaffinity(),
trasz [Sun, 5 Feb 2017 13:24:54 +0000 (13:24 +0000)]
Add kern_cpuset_getaffinity() and kern_cpuset_getaffinity(),
and use it in compats instead of their sys_*() counterparts.

Reviewed by: kib, jhb, dchagin
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9383

7 years agosx: move lockstat handling out of inline primitives
mjg [Sun, 5 Feb 2017 09:54:16 +0000 (09:54 +0000)]
sx: move lockstat handling out of inline primitives

See r313275 for details.

7 years agomtx: fixup r313278, the assignemnt was supposed to go inside the loop
mjg [Sun, 5 Feb 2017 09:53:13 +0000 (09:53 +0000)]
mtx: fixup r313278, the assignemnt was supposed to go inside the loop

7 years agomtx: fix up _mtx_obtain_lock_fetch usage in thread lock
mjg [Sun, 5 Feb 2017 09:35:17 +0000 (09:35 +0000)]
mtx: fix up _mtx_obtain_lock_fetch usage in thread lock

Since _mtx_obtain_lock_fetch no longer sets the argument to MTX_UNOWNED,
callers have to do it on their own.

7 years agoRestore r312404:
delphij [Sun, 5 Feb 2017 08:51:41 +0000 (08:51 +0000)]
Restore r312404:

Use S_ISREG instead of manual & (also it's better to compare the
result from & and the pattern instead of just assuming it's one bit
value).

Pointed out by Tianjie Mao <tjmao tjmao com>.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4827

7 years agoUse kldload -n when loading if_deqna
ngie [Sun, 5 Feb 2017 08:24:37 +0000 (08:24 +0000)]
Use kldload -n when loading if_deqna

This fixes if_deqna from being loaded by accident twice if it's already loaded
in the kernel.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agomtx: move lockstat handling out of inline primitives
mjg [Sun, 5 Feb 2017 08:04:11 +0000 (08:04 +0000)]
mtx: move lockstat handling out of inline primitives

Lockstat requires checking if it is enabled and if so, calling a 6 argument
function. Further, determining whether to call it on unlock requires
pre-reading the lock value.

This is problematic in at least 3 ways:
- more branches in the hot path than necessary
- additional cacheline ping pong under contention
- bigger code

Instead, check first if lockstat handling is necessary and if so, just fall
back to regular locking routines. For this purpose a new macro is introduced
(LOCKSTAT_PROFILE_ENABLED).

LOCK_PROFILING uninlines all primitives. Fold in the current inline lock
variant into the _mtx_lock_flags to retain the support. With this change
the inline variants are not used when LOCK_PROFILING is defined and thus
can ignore its existence.

This results in:
   text    data     bss     dec     hex filename
22259667 1303208 4994976 28557851 1b3c21b kernel.orig
21797315 1303208 4994976 28095499 1acb40b kernel.patched

i.e. about 3% reduction in text size.

A remaining action is to remove spurious arguments for internal kernel
consumers.

7 years agosx: add witness support missed in r313272
mjg [Sun, 5 Feb 2017 06:51:45 +0000 (06:51 +0000)]
sx: add witness support missed in r313272

7 years agostyle(9) cleanup
ngie [Sun, 5 Feb 2017 05:36:51 +0000 (05:36 +0000)]
style(9) cleanup

- Delete trailing whitespace
- Fix alignment/variable sorting
- Delete single-line enclosing braces

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agosx: uninline slock/sunlock
mjg [Sun, 5 Feb 2017 05:20:29 +0000 (05:20 +0000)]
sx: uninline slock/sunlock

Shared locking routines explicitly read the value and test it. If the
change attempt fails, they fall back to a regular function which would
retry in a loop.

The problem is that with many concurrent readers the risk of failure is pretty
high and even the value returned by fcmpset is very likely going to be stale
by the time the loop in the fallback routine is reached.

Uninline said primitives. It gives a throughput increase when doing concurrent
slocks/sunlocks with 80 hardware threads from ~50 mln/s to ~56 mln/s.

Interestingly, rwlock primitives are already not inlined.

7 years agosx: switch to fcmpset
mjg [Sun, 5 Feb 2017 04:54:20 +0000 (04:54 +0000)]
sx: switch to fcmpset

Discussed with: jhb
Tested by: pho (previous version)

7 years agorwlock: switch to fcmpset
mjg [Sun, 5 Feb 2017 04:53:13 +0000 (04:53 +0000)]
rwlock: switch to fcmpset

Discussed with: jhb
Tested by: pho

7 years agomtx: switch to fcmpset
mjg [Sun, 5 Feb 2017 03:26:34 +0000 (03:26 +0000)]
mtx: switch to fcmpset

The found value is passed to locking routines in order to reduce cacheline
accesses.

mtx_unlock grows an explicit check for regular unlock. On ll/sc architectures
the routine can fail even if the lock could have been handled by the inline
primitive.

Discussed with: jhb
Tested by: pho (previous version)

7 years agovfs: use atomic_fcmpset in vfs_refcount_*
mjg [Sun, 5 Feb 2017 03:23:16 +0000 (03:23 +0000)]
vfs: use atomic_fcmpset in vfs_refcount_*

7 years agoEnsure that the DOF string length is divisible by 2.
markj [Sun, 5 Feb 2017 02:47:34 +0000 (02:47 +0000)]
Ensure that the DOF string length is divisible by 2.

It is an ASCII encoding of a hexadecimal representation of the DOF file
used to enable anonymous tracing, so its length should always be even.

MFC after: 1 week

7 years agoSearch for _DTRACE_VERSION in sys/sdt.h rather than unistd.h.
markj [Sun, 5 Feb 2017 02:45:35 +0000 (02:45 +0000)]
Search for _DTRACE_VERSION in sys/sdt.h rather than unistd.h.

MFC after: 1 week

7 years agoAvoid using Sun compiler-specific flags.
markj [Sun, 5 Feb 2017 02:44:48 +0000 (02:44 +0000)]
Avoid using Sun compiler-specific flags.

MFC after: 1 week

7 years agoFix a double free of libelf data buffers in the USDT link code.
markj [Sun, 5 Feb 2017 02:44:08 +0000 (02:44 +0000)]
Fix a double free of libelf data buffers in the USDT link code.

libdtrace needs to append to the input object files' string and symbol
tables. Currently it does so by allocating a larger buffer, copying the
existing sections into them, and swapping pointers in the libelf data
descriptors. However, it also frees those buffers when its processing is
complete, which leads to a double free since the elftoolchain libelf
owns them and also frees them in elf_end(3). Instead, free the buffers
originally allocated by libelf.

MFC after: 2 weeks

7 years agoUse PC-relative relocations for USDT probe sites on i386 and amd64.
markj [Sun, 5 Feb 2017 02:39:12 +0000 (02:39 +0000)]
Use PC-relative relocations for USDT probe sites on i386 and amd64.

When recording probe site addresses in the output DOF file, dtrace -G
needs to emit relocations for the .SUNW_dof section in order to obtain
the addresses of functions containing probe sites. DTrace expects the
addresses to be relative to the base address of the final ELF file,
and the amd64 USDT implementation was relying on some unspecified and
incorrect behaviour in the base system GNU ld to achieve this.

This change reimplements the probe site relocation handling to allow
USDT to be used with lld and newer GNU binutils. Specifically, it
makes use of R_X86_64_PC64/R_386_PC32 relocations to obtain the
probe site address relative to the DOF file address, and adds and uses a
new DOF relocation type which computes the final probe site address using
these relative offsets.

Reported by and discussed with: Rafael EspĂ­ndola
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9374

7 years agoMake witness_warn() always print to the console.
markj [Sun, 5 Feb 2017 02:27:04 +0000 (02:27 +0000)]
Make witness_warn() always print to the console.

witness_warn() either breaks into the debugger or panics the system, so its
output should go to the console regardless of the witness(4) output channel
configuration.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agofd: switch fget_unlocked to atomic_fcmpset
mjg [Sun, 5 Feb 2017 01:40:27 +0000 (01:40 +0000)]
fd: switch fget_unlocked to atomic_fcmpset

7 years agoUse ssize_t instead of uint32_t to prevent warnings about a comparison
imp [Sun, 5 Feb 2017 01:20:39 +0000 (01:20 +0000)]
Use ssize_t instead of uint32_t to prevent warnings about a comparison
with different signs. Due to the promotion rules, this would only
happen on 32-bit platforms.

7 years agoAdd the ability to dump log pages directly in binary to stdout.
imp [Sun, 5 Feb 2017 00:55:07 +0000 (00:55 +0000)]
Add the ability to dump log pages directly in binary to stdout.
Update man page to include this flag, and an example of dumping a
vendor-specific page while I'm here.

7 years agoAdd some descriptions to the man page for the supported log pages as
imp [Sun, 5 Feb 2017 00:45:02 +0000 (00:45 +0000)]
Add some descriptions to the man page for the supported log pages as
well as the new wdc commands. Make wdc be an alias for hgst when
specifying the vendor to use to interpret the page.

7 years agoImplement atomic_fcmpset_*() for RISC-V.
br [Sun, 5 Feb 2017 00:32:12 +0000 (00:32 +0000)]
Implement atomic_fcmpset_*() for RISC-V.

Requested by: mjg
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9447

7 years ago[net80211] fix quiet_duration parameter to match what is provided in the manpage.
adrian [Sat, 4 Feb 2017 20:57:12 +0000 (20:57 +0000)]
[net80211] fix quiet_duration parameter to match what is provided in the manpage.

7 years agoFix off by one error that truncated the serial number for filenames.
imp [Sat, 4 Feb 2017 20:43:54 +0000 (20:43 +0000)]
Fix off by one error that truncated the serial number for filenames.

7 years agoFix a typo in usage string for unimplemented command.
imp [Sat, 4 Feb 2017 20:43:45 +0000 (20:43 +0000)]
Fix a typo in usage string for unimplemented command.

7 years agoFix some more overly long lines, whitespace and other bugs according to
marius [Sat, 4 Feb 2017 19:35:38 +0000 (19:35 +0000)]
Fix some more overly long lines, whitespace and other bugs according to
style(9) as well as spelling in comments.

7 years agoStyle, use tab after #define.
kib [Sat, 4 Feb 2017 19:16:19 +0000 (19:16 +0000)]
Style, use tab after #define.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoDelete duplicate break.
sbruno [Sat, 4 Feb 2017 18:25:09 +0000 (18:25 +0000)]
Delete duplicate break.

7 years agoFix bugs found by Coverity in decryptcore(8) and savecore(8):
def [Sat, 4 Feb 2017 14:10:16 +0000 (14:10 +0000)]
Fix bugs found by Coverity in decryptcore(8) and savecore(8):
- Perform final decryption and write decrypted data in case of non-block aligned
input data;
- Use strlcpy(3) instead of strncpy(3) to verify if paths aren't too long;
- Check errno after calling unlink(2) instead of calling stat(2) in order to
verify if a decrypted core was created by a child process;
- Free dumpkey.

Reported by: Coverity, cem, pfg
Suggested by: cem
CID: 1366936136694213669511366952
Approved by: pjd (mentor)

7 years agoDefine the vm_ooffset_t and vm_pindex_t types as machine-independend.
kib [Sat, 4 Feb 2017 12:26:38 +0000 (12:26 +0000)]
Define the vm_ooffset_t and vm_pindex_t types as machine-independend.

The types are for the byte offset and page index in vm object.  They
are similar to off_t, which is defined as 64bit MI integer.  Using MI
definitions will allow to provide consistent MD values of vm
object-related maximum sizes.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRevert r313037
jah [Sat, 4 Feb 2017 06:24:49 +0000 (06:24 +0000)]
Revert r313037

The switch to get_pcpu() in MI code seems to cause hangs on MIPS.
Back out until we can get a better idea of what's happening there.

Reported by: kan, lidl

7 years agoSwitch hastctl and hastd to libmd instead of openssl for sha256
allanjude [Sat, 4 Feb 2017 06:12:48 +0000 (06:12 +0000)]
Switch hastctl and hastd to libmd instead of openssl for sha256

Reviewed by: bapt, brnrd, pjd
Approved by: pjd (maintainer)
Sponsored by: ScaleEngine Inc., FOSDEM DevSummit
Differential Revision: https://reviews.freebsd.org/D9423

7 years agoImplement 5 wdc-specific nvme control options for their HGST drives:
imp [Sat, 4 Feb 2017 05:53:00 +0000 (05:53 +0000)]
Implement 5 wdc-specific nvme control options for their HGST drives:
wdc cap-diag Capture diagnostic data from drive
wdc drive-log Capture drive history data from drive
wdc get-crash-dump Retrieve firmware crash dump from drive

7 years agoMove the usage and command name lookup into functions.
imp [Sat, 4 Feb 2017 05:52:53 +0000 (05:52 +0000)]
Move the usage and command name lookup into functions.

7 years agoBack off using CPUTYPE for the moment. There's still some issues with
imp [Sat, 4 Feb 2017 05:52:51 +0000 (05:52 +0000)]
Back off using CPUTYPE for the moment. There's still some issues with
that.

7 years agoPut the arguments to aligned_alloc in the right order.
imp [Sat, 4 Feb 2017 05:52:50 +0000 (05:52 +0000)]
Put the arguments to aligned_alloc in the right order.

7 years agoOver the years, the code and comments in vm_page_startup() have diverged in
alc [Sat, 4 Feb 2017 05:23:10 +0000 (05:23 +0000)]
Over the years, the code and comments in vm_page_startup() have diverged in
one respect.  When determining how many page structures to allocate,
contrary to what the comments say, the code does not account for the
overhead of a page structure per page of physical memory.  This revision
changes the code to match the comments.

Reviewed by: kib, markj
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D9081

7 years agoCheck that primary GPT header is valid before wiping partitioning.
ae [Sat, 4 Feb 2017 05:09:47 +0000 (05:09 +0000)]
Check that primary GPT header is valid before wiping partitioning.

This allows safely destroy corrupted GPT when primary header was
rewritten by some data, that do not want to destroy.

MFC after: 1 week

7 years agoRemove LOCAL_LIB_DIRS warning added in r275839.
bdrewery [Sat, 4 Feb 2017 02:15:49 +0000 (02:15 +0000)]
Remove LOCAL_LIB_DIRS warning added in r275839.

The case for which this was added, r274807, causes this warning to
always show.  LOCAL_DIRS=foo LOCAL_LIB_DIRS=foo/lib.  The only case in
which r274807 is a problem is if foo/Makefile does not contain
SUBDIR+=lib, which is a normal convention.  LOCAL_LIB_DIRS is a special
hack only to get a library into the _generic_libs list for the
'make libraries' bootstrapping phase.  The old behavior changed in
r274807 was only in head during the 10.0 cycle, so the warning was
only ever needed until release anyhow.

Reported by: ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoFix typo in variable name (_REDUNDENT_LIB_DIRS -> _REDUNDANT_LIB_DIRS)
ngie [Sat, 4 Feb 2017 01:21:48 +0000 (01:21 +0000)]
Fix typo in variable name (_REDUNDENT_LIB_DIRS -> _REDUNDANT_LIB_DIRS)

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoFix grammar in getpeereid(3)
vangyzen [Sat, 4 Feb 2017 00:37:25 +0000 (00:37 +0000)]
Fix grammar in getpeereid(3)

7 years agoPCIe HotPlug: remove tests for DL active link capability
vangyzen [Sat, 4 Feb 2017 00:34:00 +0000 (00:34 +0000)]
PCIe HotPlug: remove tests for DL active link capability

As of r313097, the HotPlug code requires the link to support
reporting of the data-link status.  Remove tests for this capability
from code that can now assume its presence.

Suggested by: jhb
Reviewed by: jhb
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9431

7 years agoFiles which implement the new random number system code for DTrace
gnn [Fri, 3 Feb 2017 22:40:13 +0000 (22:40 +0000)]
Files which implement the new random number system code for DTrace

Submitted by: Graeme Jenkinson
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoReplace the implementation of DTrace's RAND subroutine for generating
gnn [Fri, 3 Feb 2017 22:26:19 +0000 (22:26 +0000)]
Replace the implementation of DTrace's RAND subroutine for generating
low-quality random numbers with a modern implementation (xoroshiro128+)
that is capable of generating better quality randomness without compromising performance.

Submitted by: Graeme Jenkinson
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9051

7 years agoClean up documentation of AF_UNIX control messages.
jilles [Fri, 3 Feb 2017 20:33:23 +0000 (20:33 +0000)]
Clean up documentation of AF_UNIX control messages.

Document AF_UNIX control messages in unix(4) only, not split between unix(4)
and recv(2).

Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could
be from a setuid or setgid program (with the explicit SCM_CREDS and
LOCAL_PEERCRED, the credentials are read at such a time that it can be
assumed that the process intends for them to be used in this context).

Reviewed by: wblock
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9298

7 years agoRe-enable an accidentally-disabled temp directory creation test.
wblock [Fri, 3 Feb 2017 20:17:54 +0000 (20:17 +0000)]
Re-enable an accidentally-disabled temp directory creation test.

Reported by: bjk
Sponsored by: iXsystems

7 years agoDecromulate an extra "if".
wblock [Fri, 3 Feb 2017 19:21:28 +0000 (19:21 +0000)]
Decromulate an extra "if".

Reported by: rpokala
Sponsored by: iXsystems

7 years agoClarify some option descriptions, add a line of text to makeman to
wblock [Fri, 3 Feb 2017 19:09:46 +0000 (19:09 +0000)]
Clarify some option descriptions, add a line of text to makeman to
add the slightest hint of a shade of a clue of what it does.

Sponsored by: iXsystems

7 years agoFix VIMAGE-related bugs in TFO. The autokey callout vnet context was
pkelsey [Fri, 3 Feb 2017 17:02:57 +0000 (17:02 +0000)]
Fix VIMAGE-related bugs in TFO.  The autokey callout vnet context was
not being initialized, and the per-vnet fastopen context was only
being initialized for the default vnet.

PR: 216613
Reported by: Alex Deiter <alex dot deiter at gmail dot com>
MFC after: 1 week

7 years agoloader: libefi/env.c warnings in arm build
tsoome [Fri, 3 Feb 2017 16:39:10 +0000 (16:39 +0000)]
loader: libefi/env.c warnings in arm build

The arm build has revealed some of the warnings, the fix for CHAR16
warning is to switch the warning off for env.c (same as for efinet.c).

For error code we need to use macro.

Reported by: gjb
Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D9422

7 years agonative-xtools: Add missing readelf.
bdrewery [Fri, 3 Feb 2017 16:27:23 +0000 (16:27 +0000)]
native-xtools: Add missing readelf.

The switch to elftoolchain's readelf in r280859 caused native-xtools
to no longer build readelf.  This fixes poudriere builds not using
a native readelf when expected.

Reported by: strejda on freenode
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoReplace Cyrillic characters with Latin (normal) ones.
wblock [Fri, 3 Feb 2017 16:21:30 +0000 (16:21 +0000)]
Replace Cyrillic characters with Latin (normal) ones.

PR: 216534
Submitted by: eborisch+FreeBSD@gmail.com
MFC after: 1 week
Sponsored by: iXsystems

7 years agoresolvconf: restore RESTARTCMD=, CMD1=, CMD2= and sed pattern as before.
pfg [Fri, 3 Feb 2017 16:08:58 +0000 (16:08 +0000)]
resolvconf: restore RESTARTCMD=, CMD1=, CMD2= and sed pattern as before.

r312992 removed RESTARTCMD_WITH_ARG for @RESTARTCMD something@ but
reverted the sed to be '@RESTARTCMD \(.*\)@' and RESTARTCMD= to be
the value of RESTARTCMD_WITH_ARG.

Submitted by: Guy Yur
x_MFC with: r312992

7 years agoFor i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSE
kib [Fri, 3 Feb 2017 12:51:40 +0000 (12:51 +0000)]
For i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSE
and device npx.

This means that FPU is always initialized and handled when available,
and SSE+ register file and exception are handled when available.  This
makes the kernel FPU code much easier to maintain by the cost of
slight bloat for CPUs older than 25 years.

CPU_DISABLE_CMPXCHG outlived its usefulness, see the removed comment
explaining the original purpose.

Suggested by and discussed with: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

7 years agoFix the comment showing the meaning of the first argument to sigprocmask.
andrew [Fri, 3 Feb 2017 11:51:06 +0000 (11:51 +0000)]
Fix the comment showing the meaning of the first argument to sigprocmask.

Sponsored by: ABT Systems Ltd

7 years agoRemove an old use of _ARM_ARCH_6, we are moving to using the standard
andrew [Fri, 3 Feb 2017 11:47:57 +0000 (11:47 +0000)]
Remove an old use of _ARM_ARCH_6, we are moving to using the standard
__ARM_ARCH >= 6 spelling.

Sponsored by: ABT Systems Ltd

7 years agoOnly define atomic_fcmpset_long in the kernel. We may include
andrew [Fri, 3 Feb 2017 10:04:17 +0000 (10:04 +0000)]
Only define atomic_fcmpset_long in the kernel. We may include
machine/atomic.h in userspace, however atomic_fcmpset_32 is unimplemented
there.

Sponsored by: ABT Systems Ltd

7 years ago[net80211] don't update quiet time counter values every probe request.
adrian [Fri, 3 Feb 2017 06:04:06 +0000 (06:04 +0000)]
[net80211] don't update quiet time counter values every probe request.

The quiet time counter update is happening each time the IE is added,
which also means it happens for each quiet time IE addition to the probe
response.

Only update the countdown if we request ie (ie, beacon updates.)

7 years ago[ath_hal] [ar9300] link in the CAC enable/diable methods and expose it via the HAL.
adrian [Fri, 3 Feb 2017 05:15:35 +0000 (05:15 +0000)]
[ath_hal] [ar9300] link in the CAC enable/diable methods and expose it via the HAL.

7 years ago[ath_hal] prepare for CAC quiet time.
adrian [Fri, 3 Feb 2017 05:15:08 +0000 (05:15 +0000)]
[ath_hal] prepare for CAC quiet time.

To support DFS, the NIC needs to be very quiet during this time.
No transmissions including ACKs are allowed.

This is just the initial HAL glue.

7 years ago[ath_hal] [ar9300] initial radar decode for AR9380 and later chips.
adrian [Fri, 3 Feb 2017 03:57:06 +0000 (03:57 +0000)]
[ath_hal] [ar9300] initial radar decode for AR9380 and later chips.

7 years agoSync the x86 dis_tables.c with upstream.
markj [Fri, 3 Feb 2017 03:22:47 +0000 (03:22 +0000)]
Sync the x86 dis_tables.c with upstream.

This corresponds to the following illumos issues:

  5755 want support for Intel FMA instrs
  5756 want support for Intel BMI1 instrs
  5757 want support for Intel BMI2 instrs
  5758 want support for Intel AVX2 instrs
  7204 Want broadwell rdseed and adx support
  7208 Want stac/clac disasm support
  7733 Need SHA Instruction dis support
  7756 dis can't handle x86 SSE 3 instructions
  7757 want avx2 disasm tests
  7758 want SSE 4.1 disasm tests

MFC after: 2 weeks

7 years agoEnsure that the passthrough request will fit in MAXPHYS bytes after it
imp [Thu, 2 Feb 2017 23:04:06 +0000 (23:04 +0000)]
Ensure that the passthrough request will fit in MAXPHYS bytes after it
has been rounded to full pages. This avoids a panic in
vm_fault_quick_hold_pages due to this off-by-one error passing one
page too many into vmapbuf.

7 years agoUse aligned buffer for the firmware data. Otherwise, when loading a
imp [Thu, 2 Feb 2017 23:04:00 +0000 (23:04 +0000)]
Use aligned buffer for the firmware data. Otherwise, when loading a
MAXPHYS bytes of data, the I/O would require MAXPHYS + PAGE_SIZE worth
of pages to do the I/O and we'd hit an assertion in
vm_fault_quick_hold_pages unless MAXPHYS was larger than 1M +
PAGE_SIZE.

7 years agoUse ANSI definitions for some i386 functions.
kib [Thu, 2 Feb 2017 22:02:10 +0000 (22:02 +0000)]
Use ANSI definitions for some i386 functions.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoTry to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)
danfe [Thu, 2 Feb 2017 20:30:50 +0000 (20:30 +0000)]
Try to fix the old "he capability is stupid" bug in gettytab(5)/getty(8)

There is one capability explicitly documented in gettytab(5) as stupid: he.
And it is indeed.  It was meant to facilitate system hostname modification,
but is hardly usable in practice because it allows very limited editing
(e.g., it depends on a particular hostname length, making it non-generic).

Replace it with simple implementation that treats ``he'' as POSIX extended
regular expression which is matched against the hostname.  If there are no
parenthesized subexpressions in the pattern, entire matched string is used
as the final hostname.  Otherwise, use the first matched subexpression.
If the pattern does not match, the original hostname is not modified.

Using regex(3) gives more freedom, does not complicate the code very much,
and makes a lot more sense, in turn making ``he'' less stupid and actually
useful (e.g., it is now possible to obtain node or domain names from the
original hostname string, without knowing it in advance).

Reviewed by: jilles, manpages (wblock)
Approved by: jilles (implied)
Differential Revision: https://reviews.freebsd.org/D9244

7 years agoUpdate byacc regression tests to match 20170201.
jkim [Thu, 2 Feb 2017 20:01:54 +0000 (20:01 +0000)]
Update byacc regression tests to match 20170201.

7 years agoMFV: r313101
jkim [Thu, 2 Feb 2017 20:00:01 +0000 (20:00 +0000)]
MFV: r313101

Update byacc to 20170201.

7 years agoReduce diff to upstream using HAVE_CAPSICUM instead of __FreeBSD__. It'll also
glebius [Thu, 2 Feb 2017 19:56:41 +0000 (19:56 +0000)]
Reduce diff to upstream using HAVE_CAPSICUM instead of __FreeBSD__. It'll also
make it easier to upstream HAVE_CASPER patch.

7 years agoImport byacc 20170201.
jkim [Thu, 2 Feb 2017 19:22:26 +0000 (19:22 +0000)]
Import byacc 20170201.

7 years agoIfdef out the unused vm_rr_selectdomain().
trasz [Thu, 2 Feb 2017 17:44:55 +0000 (17:44 +0000)]
Ifdef out the unused vm_rr_selectdomain().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoFix compilation for mips64 platforms
lidl [Thu, 2 Feb 2017 17:43:00 +0000 (17:43 +0000)]
Fix compilation for mips64 platforms

The hwpmc_mips24k / hwpmc_mips74k modules are only for mips 32-bit hosts.
Reviewed by: adrian

7 years agoRequire Data Layer Active reporting for native PCI-e HotPlug.
jhb [Thu, 2 Feb 2017 17:29:15 +0000 (17:29 +0000)]
Require Data Layer Active reporting for native PCI-e HotPlug.

Some PCI-e bridges report that they support HotPlug in the slot
capabilities but do not report support for Data Layer Active events
in the link capabilities register.  These bridges do not work correctly
when HotPlug is used.  Further, while the description of HotPlug in
the spec does not mention that DL active events are required, the
description of the link capabilities register says that DL active is
required for HotPlug.  Thanks to Dave Baukus for finding that language
in the spec.

PR: 211699
Submitted by: Dave Baukus <daveb@spectralogic.com>
Reviewed by: vangyzen
MFC after: 3 days

7 years ago[ath_hal] [ar9300] initial radar detection glue.
adrian [Thu, 2 Feb 2017 09:19:57 +0000 (09:19 +0000)]
[ath_hal] [ar9300] initial radar detection glue.

* flesh out a "get default DFS parameters" routine
* remove the stub that returns NULL
* fix up the enable DFS method to do what FreeBSD does - specifically, allow pe_enabled
  to be set/cleared.

This allows the radar pulse reporting code to function, but it doesn't yet
do anything useful.

7 years agoRemake support for SMP kernel on UP cpu:
mmel [Thu, 2 Feb 2017 06:14:44 +0000 (06:14 +0000)]
Remake support for SMP kernel on UP cpu:
 - Use new option SMP_ON_UP instead of (mis)using specific CPU type.
   By this, any SMP kernel can be compiled with SMP_ON_UP support.
 - Enable runtime detection of CPU multiprocessor extensions only
   if SMP_ON_UP option is used. In other cases (pure SMP or UP),
   statically compile only required variant.
 - Don't leak multiprocessor instructions to UP kernel.
 - Correctly handle data cache write back to point of unification.
   DCCMVAU is supported on all armv7 cpus.
 - For SMP_ON_UP kernels, detect proper TTB flags on runtime.

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

7 years agoRemove remaining ifdefs from CESA header
wma [Thu, 2 Feb 2017 06:07:39 +0000 (06:07 +0000)]
Remove remaining ifdefs from CESA header

Commit r312743 ("Use SoC ID - based detection in CESA") resulted
in build failing for Marvell armv5 platforms, which don't support
the newer version of CESA controller. This patch provides a fix by
removing ifdefs around bitfields' definitions, so that they are
known to all platforms.

Submitted by:          Marcin Wojtas <mw@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield

7 years ago[ath_hal] [ar9300] initial hacks to make spectral scan working on AR9380 and later...
adrian [Thu, 2 Feb 2017 05:29:22 +0000 (05:29 +0000)]
[ath_hal] [ar9300] initial hacks to make spectral scan working on AR9380 and later NICs.

* add debugging
* disable the manual noise floor calibration and tracking done by the HAL;
  this interferes with the normal calibration path and will lock up the RX
  side
* don't program short report / priority if they're provided as NOVAL.

7 years ago[ath] ensure the NIC is woken up before changing the spectral scan parameters.
adrian [Thu, 2 Feb 2017 05:27:48 +0000 (05:27 +0000)]
[ath] ensure the NIC is woken up before changing the spectral scan parameters.

7 years ago[ath_hal] add debugging level for spectral scan.
adrian [Thu, 2 Feb 2017 05:27:27 +0000 (05:27 +0000)]
[ath_hal] add debugging level for spectral scan.

7 years ago[ath] add spectral scan priority.
adrian [Thu, 2 Feb 2017 05:27:06 +0000 (05:27 +0000)]
[ath] add spectral scan priority.

7 years ago[athspectral] add a knob to expose the spectral scan priority.
adrian [Thu, 2 Feb 2017 05:26:39 +0000 (05:26 +0000)]
[athspectral] add a knob to expose the spectral scan priority.

This is required for AR9380 and later chips.. please leave it at 0 for now.

7 years agoFix build with WITHOUT_INET6.
glebius [Thu, 2 Feb 2017 04:53:33 +0000 (04:53 +0000)]
Fix build with WITHOUT_INET6.

Submitted by: Alex Deiter <alex.deiter gmail.com>

7 years agoRemove dangling DE425 EISA card references in the de driver. They
imp [Thu, 2 Feb 2017 04:50:20 +0000 (04:50 +0000)]
Remove dangling DE425 EISA card references in the de driver. They
aren't used, and this doesn't change the supported hardware.

7 years agoReplace for/retry loops with "wait_for_ggate_device" calls and check
ngie [Thu, 2 Feb 2017 03:54:43 +0000 (03:54 +0000)]
Replace for/retry loops with "wait_for_ggate_device" calls and check
results of commands

As noted in r313008, the underlying issue was that geom_gate device
creation wasn't created at ggatel command completion, but some short
time after. ggatec(8) employs similar logic when creating geom_gate(4)
devices.

Switch from retry loops (after the ggatec/dd write calls) to
wait_for_ggate_device function calls after calling ggatec(8) instead
to detect the presence of the /dev/ggate* device, as this function is
sufficient for determining whether or not the character device is ready
for testing

While here, use atf_check consistently with all dd calls to ensure that
data output is as expected.

MFC after: 1 week
Reviewed by: asomers
Differential Revision: D9409
Sponsored by: Dell EMC Isilon

7 years agoi386: fixup fcmpset
mjg [Thu, 2 Feb 2017 01:33:08 +0000 (01:33 +0000)]
i386: fixup fcmpset

An incorrect output specifier was used which worked with clang by accident,
but breaks with the in-tree gcc version.

While here plug a whitespace nit.

Reported by: bde

7 years agoMFV r313071:
mm [Thu, 2 Feb 2017 00:50:46 +0000 (00:50 +0000)]
MFV r313071:
Sync libarchive with vendor

Vendor changes (relevant to FreeBSD):
- support extracting NFSv4 ACLs from Solaris tar archives
- bugfixes and optimizations in the ACL code
- multiple fixes in the test suite
- typo and other small bugfixes

Security fixes:
- cab reader: endless loop when parsing MSZIP signature (OSS-Fuzz 335)
- LHA reader: heap-buffer-overflow in lha_read_file_header_1()
  (CVE-2017-5601)
- LZ4 reader: null-pointer dereference in lz4_filter_read_legacy_stream()
  (OSS-Fuzz 453)
- mtree reader: heap-buffer-overflow in detect_form() (OSS-Fuzz 421, 443)
- WARC reader: heap-buffer-overflow in xstrpisotime() (OSS-Fuzz 382, 458)

Memory leak fixes:
- ACL support: free memory allocated by acl_get_qualifier()
- disk writer: missing free in create_filesystem_object()
- file reader: fd leak (Coverity 1016755)
- gnutar writer: fix free in archive_write_gnutar_header()
  (Coverity 101675)
- iso 9660 reader: missing free in parse_file_info()
  (partial Coverity 1016754)
- program reader: missing free in __archive_read_program()
- program writer: missing free in __archive_write_program_free()
- xar reader: missing free in xar_cleanup()
- xar reader: missing frees in expat_xmlattr_setup()
  (Coverity 1229979-1229981)
- xar writer: missing free in file_free()
- zip reader: missing free in zip_read_local_file_header()

MFC after: 1 week
X-MFC with: 310866, 310868, 310870, 311899

7 years agoUpdate vendor/libarchive to git d77b577b2d5aa259fca06313c4940e1e61ab1e0e
mm [Thu, 2 Feb 2017 00:20:18 +0000 (00:20 +0000)]
Update vendor/libarchive to git d77b577b2d5aa259fca06313c4940e1e61ab1e0e

Vendor changes (relevant to FreeBSD):
- bugfixes, improvemens and optimizations in ACL code
- NFSv4 ACLs can now be extracted from Solaris tar archives

Security fixes:
- cab reader: endless loop when parsing MSZIP signature (OSS-Fuzz 335)
- LHA reader: heap-buffer-overflow in lha_read_file_header_1() (CVE-2017-5601)
- LZ4 reader: null-pointer dereference in lz4_filter_read_legacy_stream()
  (OSS-Fuzz 453)
- mtree reader: heap-buffer-overflow in detect_form() (OSS-Fuzz 421, 443)
- WARC reader: heap-buffer-overflow in xstrpisotime() (OSS-Fuzz 382, 458)

Memory leak fixes:
- ACL support: free memory allocated by acl_get_qualifier()
- disk writer: missing free in create_filesystem_object()
- file reader: fd leak (Coverity 1016755)
- gnutar writer: fix free in archive_write_gnutar_header() (Coverity 1016752)
- iso 9660 reader: missing free in parse_file_info() (part. Coverity 1016754)
- program reader: missing free in __archive_read_program()
- program writer: missing free in __archive_write_program_free()
- xar reader: missing free in xar_cleanup()
- xar reader: missing frees in expat_xmlattr_setup() (Coverity 1229979-1229981)
- xar writer: missing free in file_free()
- zip reader: missing free in zip_read_locazip_read_local_file_header()

7 years agoAllow 999.local to run scripts in any language
asomers [Wed, 1 Feb 2017 23:22:54 +0000 (23:22 +0000)]
Allow 999.local to run scripts in any language

If one of the scripts listed in (daily|weekly|monthly)_local is executable,
999.local should simply execute it. Only if the script isn't executable
should 999.local assume it needs /bin/sh.

Reviewed by: brian
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years ago[am335x] Fallback to standard video interface bindings when using Linux dts
gonzo [Wed, 1 Feb 2017 22:03:59 +0000 (22:03 +0000)]
[am335x] Fallback to standard video interface bindings when using Linux dts

Historically AM335x LCDC driver used non-standard "hdmi" property to
refer to HDMI framer. There is no such thing in upstream DTS, so to
handle both cases fallback to bindings described in
bindings/media/video-interfaces.txt in Linux documentation.

We still make some assumptions that are not universally true: we
assume that if remote endpoint is available it's going to be HDMI
framer. Which is true for AM335x-based devices currently supported
but may be not true for some custom hardware.

MFC after: 1 week

7 years agoPull in r293536 from upstream compiler-rt trunk:
dim [Wed, 1 Feb 2017 20:41:09 +0000 (20:41 +0000)]
Pull in r293536 from upstream compiler-rt trunk:

  Recommit: Stop intercepting some malloc-related functions on FreeBSD
  and macOS

  Summary:
  In https://bugs.freebsd.org/215125 I was notified that some configure
  scripts attempt to test for the Linux-specific `mallinfo` and
  `mallopt` functions by compiling and linking small programs which
  references the functions, and observing whether that results in
  errors.

  FreeBSD and macOS do not have the `mallinfo` and `mallopt` functions,
  so normally these tests would fail, but when sanitizers are enabled,
  they incorrectly succeed, because the sanitizers define interceptors
  for these functions.  This also applies to some other malloc-related
  functions, such as `memalign`, `pvalloc` and `cfree`.

  Fix this by not intercepting `mallinfo`, `mallopt`, `memalign`,
  `pvalloc` and `cfree` for FreeBSD and macOS, in all sanitizers.

  Also delete the non-functional `cfree` wrapper for Windows, to fix the
  test cases on that platform.

  Reviewers: emaste, kcc, rnk

  Subscribers: timurrrr, eugenis, hans, joerg, llvm-commits, kubamracek

  Differential Revision: https://reviews.llvm.org/D27654

This prevents autoconf scripts from incorrectly detecting that functions
like mallinfo, mallopt, memalign, pvalloc and cfree are supported.

PR: 215125, 215455
MFC after: 1 week

7 years agoUpdate tcpdump to 4.9.0.
glebius [Wed, 1 Feb 2017 20:26:42 +0000 (20:26 +0000)]
Update tcpdump to 4.9.0.

It fixes many buffer overflow in different protocol parsers, but none of
them are critical, even in absense of Capsicum.

Security: CVE-2016-7922, CVE-2016-7923, CVE-2016-7924, CVE-2016-7925
Security: CVE-2016-7926, CVE-2016-7927, CVE-2016-7928, CVE-2016-7929
Security: CVE-2016-7930, CVE-2016-7931, CVE-2016-7932, CVE-2016-7933
Security: CVE-2016-7934, CVE-2016-7935, CVE-2016-7936, CVE-2016-7937
Security: CVE-2016-7938, CVE-2016-7939, CVE-2016-7940, CVE-2016-7973
Security: CVE-2016-7974, CVE-2016-7975, CVE-2016-7983, CVE-2016-7984
Security: CVE-2016-7985, CVE-2016-7986, CVE-2016-7992, CVE-2016-7993
Security: CVE-2016-8574, CVE-2016-8575, CVE-2017-5202, CVE-2017-5203
Security: CVE-2017-5204, CVE-2017-5205, CVE-2017-5341, CVE-2017-5342
Security: CVE-2017-5482, CVE-2017-5483, CVE-2017-5484, CVE-2017-5485
Security: CVE-2017-5486

7 years agoloader: disk/part api needs to use uint64_t offsets
tsoome [Wed, 1 Feb 2017 20:10:56 +0000 (20:10 +0000)]
loader: disk/part api needs to use uint64_t offsets

The disk_* and part_* api is using 64bit values for media size and
offsets. However, the current api is using off_t type, which is signed
64-bit int.

In this context the signed media size does not make any sense, and
the offsets are used to mark absolute, not relative locations.

Also, the data from GPT partition table and some other sources is
already using uint64_t data type, so using signed off_t can cause sign
issues.

Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D8710

7 years agoAdd an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes.
gnn [Wed, 1 Feb 2017 19:33:00 +0000 (19:33 +0000)]
Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9401

7 years agoAdd some comments with examples on how to build Vagrant images.
brd [Wed, 1 Feb 2017 16:15:23 +0000 (16:15 +0000)]
Add some comments with examples on how to build Vagrant images.

Approved by: re (gjb)

7 years agoMerge filt_soread and filt_solisten and decide what to do when checking
harti [Wed, 1 Feb 2017 13:12:07 +0000 (13:12 +0000)]
Merge filt_soread and filt_solisten and decide what to do when checking
for EVFILT_READ at the point of the check not when the event is registers.
This fixes a problem with asio when accepting a connection.

Reviewed by: kib@, Scott Mitchell

7 years agoloader.efi environment related cleanups
tsoome [Wed, 1 Feb 2017 08:46:59 +0000 (08:46 +0000)]
loader.efi environment related cleanups

Since we have dedicated libefi/env.c file for variable support, the following
changes are done:

Simple cstyle changes in env.c
Moved efi variable related commands from loader/main.c to libefi/env.c
Did create function to set "efi-version" environment variable in env.c.

This function does serve two purposes: for first a  small clean up of the
loader main(), and for second, it does replace the otherwise unused
efi_variable_support hack.
A bit of cleanup of ficl backend functions. The TEST_MAIN has no meaning,
and removed few memory leaks.

The forth code is updated to use "efi-version" variable, instead of ficl
environment check.

Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D9165

7 years agoBump GCC FBSD_CC_VER for r312899 (-march=octeon+ support)
emaste [Wed, 1 Feb 2017 05:24:17 +0000 (05:24 +0000)]
Bump GCC FBSD_CC_VER for r312899 (-march=octeon+ support)

Reported by: lidl
MFC after: 1 month
MFC with: r312899
Sponsored by: The FreeBSD Foundation