]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoRemove unused tlb_write_random().
trasz [Mon, 5 Jun 2017 11:04:22 +0000 (11:04 +0000)]
Remove unused tlb_write_random().

Sponsored by: DARPA, AFRL

7 years agoRemove extraneous parentheses.
trasz [Mon, 5 Jun 2017 10:59:47 +0000 (10:59 +0000)]
Remove extraneous parentheses.

Sponsored by: DARPA, AFRL

7 years agoDecode arguments to dup, dup2, getdirentries, pread, and pwrite.
jhb [Mon, 5 Jun 2017 05:25:50 +0000 (05:25 +0000)]
Decode arguments to dup, dup2, getdirentries, pread, and pwrite.

- dup and dup2 print fd arguments in decimal.
- pread and pwrite are similar to read and write with the addition of the
  file offset.
- getdirentries displays the output entries as a string for now and also
  prints the value returned in *basep.  Eventually the buffer for
  getdirentries should perhaps be decoded as an array of dirent
  structures.

PR: 214885
Submitted by: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>

7 years agoMETA_MODE: Force a host tool rebuild for ino64 in r318736.
bdrewery [Mon, 5 Jun 2017 05:17:42 +0000 (05:17 +0000)]
META_MODE: Force a host tool rebuild for ino64 in r318736.

Sponsored by: Dell EMC Isilon

7 years agoMETA_MODE: Add framework to force rebuilding for major ABI changes.
bdrewery [Mon, 5 Jun 2017 05:17:39 +0000 (05:17 +0000)]
META_MODE: Add framework to force rebuilding for major ABI changes.

Normally META_MODE ignores host files for "meta mode" decisions on whether a
file should be rebuilt or not.  This is because a simple installworld can
update timestamps and cause the next build to rebuild all host tools, when the
previous ones may not have any changes in the source tree.  These tools are
normally still ABI compatible.  They are only rebuilt if NO_META_IGNORE_HOST is
set from the workaround/hack in r301467.

One of the major problems with this is when a host tool has objects spread
across many revisions that have mixed-ABI.  For example, if struct stat were to
change on the host, some objects for a tool may have different ideas of that
struct's definition.  If just 1 source file were modified and rebuilt and
linked into the tool, then that toll will have mixed-ABI objects and crash.
This exact thing happened with the ino64 commit in r301467 followed by a
trivial update to libbfd in r318750.  The resulting binary would crash in
buildworld.

Sponsored by: Dell EMC Isilon

7 years agoMETA_MODE: Allow not ignoring host headers with NO_META_IGNORE_HOST_HEADERS.
bdrewery [Mon, 5 Jun 2017 05:17:36 +0000 (05:17 +0000)]
META_MODE: Allow not ignoring host headers with NO_META_IGNORE_HOST_HEADERS.

See r301467 for more details on NO_META_IGNORE_HOST.  Usually the full
list of host ignores should have no real impact on the host tools.  The
headers however may reliably define what the ABI is for the host.  It
may be useful to allow using the headers for the build but still not
caring about things like /bin/sh, /lib/libedit.so, etc.

Sponsored by: Dell EMC Isilon

7 years agosh: Make sure to process SIGINT if SETINTON re-enables processing.
jilles [Sun, 4 Jun 2017 21:58:02 +0000 (21:58 +0000)]
sh: Make sure to process SIGINT if SETINTON re-enables processing.

If INTON re-enables interrupts, it processes any interrupt that occurred
while interrupts were disabled. Make SETINTON do the same.

7 years agotests/sys/aio: Add missing mode to open() calls with O_CREAT.
jilles [Sun, 4 Jun 2017 21:39:37 +0000 (21:39 +0000)]
tests/sys/aio: Add missing mode to open() calls with O_CREAT.

7 years ago[iwm] Remove support for fw older than -17 and -22
adrian [Sun, 4 Jun 2017 21:28:52 +0000 (21:28 +0000)]
[iwm] Remove support for fw older than -17 and -22

* iwm(4) didn't use any of these definitions yet, anyway.

Obtained from: dragonflybsd.git f95003b8f1f7382c8396a6d408e3072632afdd3d

7 years ago[iwmfw] bump built firmware now to version 22 for 7265D and 8000C.
adrian [Sun, 4 Jun 2017 21:28:03 +0000 (21:28 +0000)]
[iwmfw] bump built firmware now to version 22 for 7265D and 8000C.

7 years ago[iwmfw] 8000C ver 22 firmware.
adrian [Sun, 4 Jun 2017 21:27:39 +0000 (21:27 +0000)]
[iwmfw] 8000C ver 22 firmware.

7 years ago[iwmfw] add 7265D-22 firmware
adrian [Sun, 4 Jun 2017 21:26:31 +0000 (21:26 +0000)]
[iwmfw] add 7265D-22 firmware

7 years ago[ath_hal] add USB reset PLL work around for AR9331/AR9344 (Hornet/Wasp.)
adrian [Sun, 4 Jun 2017 21:21:44 +0000 (21:21 +0000)]
[ath_hal] add USB reset PLL work around for AR9331/AR9344 (Hornet/Wasp.)

It turns out that this is useful on hornet and wasp SoCs but it isn't
enabled in ye olde HAL /unless/ you were using a version from one of the
business units building USB targetted devices.  It eventually got fixed
for all of them as people started wanting to use the USB ports on their
SoCs (eg for flash storage, bluetooth, 4G/LTE widgets, etc.)

This is actually a fix from ath9k but I'm merging it with the available-but-
disabled code in the QCA reference HAL.

Tested:

* AR9331 SoC

7 years ago[iwm] Ignore IWM_DEBUG_LOG_MSG notifications.
adrian [Sun, 4 Jun 2017 21:14:23 +0000 (21:14 +0000)]
[iwm] Ignore IWM_DEBUG_LOG_MSG notifications.

* Firmware versions 21 and 22 generate some IWM_DEBUG_LOG_MSG notifications,
  which seem to be harmless. Avoid spamming the system log with
  "frame ... UNHANDLED (this should not happen)" messages.

Obtained from: dragonflybsd.git dda889ac57d8e5b46bb1b1ecf53c17a18481c7c8

7 years ago[iwm] Set command code for PHY_DB as well.
adrian [Sun, 4 Jun 2017 21:13:13 +0000 (21:13 +0000)]
[iwm] Set command code for PHY_DB as well.

Obtained from: dragonflybsd.git 58318c956a74382d1286ccabaf767012fdcfe1a2

7 years ago[iwm] Set correct state in smart-fifo configuration.
adrian [Sun, 4 Jun 2017 21:12:11 +0000 (21:12 +0000)]
[iwm] Set correct state in smart-fifo configuration.

Obtained from: dragonflybsd.git 666737f64b4f6dd42ffd9f0ace9fc46ccc1ebaab

7 years ago[iwm] Remove dead code from iwm_pcie_load_cpu_sections().
adrian [Sun, 4 Jun 2017 21:11:28 +0000 (21:11 +0000)]
[iwm] Remove dead code from iwm_pcie_load_cpu_sections().

* If device family is 8000 then iwm_pcie_load_cpu_sections()
  won't be called at all (iwm_pcie_load_cpu_sections_8000() is
  called in that case) so this piece of code never gets called.

Obtained from: dragonflybsd.git 3e9aaef308100a4d630feffc131e3aca2ae12f8a

7 years ago[iwm] Check for lar_disable tunable, and lar_enabled flag from NVM.
adrian [Sun, 4 Jun 2017 21:10:14 +0000 (21:10 +0000)]
[iwm] Check for lar_disable tunable, and lar_enabled flag from NVM.

* LAR can be disabled with the hw.iwm.lar.disable tunable now.

* On Family 8000 devices we need to check the lar_enabled flag from
  nvm_data in addition to the TLV_CAPA_LAR_SUPPORT flag from the firmware.

* Add a separate IWM_DEBUG_LAR debugging flag.

Obtained from: dragonflybsd.git 0593e39cb295aa996ecf789ed4990c3b255f1770

7 years ago[iwm] Move Smart Fifo handling into if_iwm_sf.c, sync with Linux iwlwifi.
adrian [Sun, 4 Jun 2017 21:05:58 +0000 (21:05 +0000)]
[iwm] Move Smart Fifo handling into if_iwm_sf.c, sync with Linux iwlwifi.

* This change also fixes a possible issue in the existing smart-fifo code,
  which set the IWM_SF_CFG_DUMMY_NOTIF_OFF bit on AC8260 chipsets, although
  that's only used in iwlwifi for Family 8000 chipsets connected via SDIO
  interface.

Obtained from: Dragonflybsd.git cb650b01526b0aeef3c4307d926e7f1428997d50

7 years agoAllow defining nofork builtins from builtins.def and move always-safe ones there.
bdrewery [Sun, 4 Jun 2017 21:02:48 +0000 (21:02 +0000)]
Allow defining nofork builtins from builtins.def and move always-safe ones there.

The generated code remains the same.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D11042

7 years agosh: Fix INTOFF leak when a redirection on a compound command fails.
jilles [Sun, 4 Jun 2017 20:52:55 +0000 (20:52 +0000)]
sh: Fix INTOFF leak when a redirection on a compound command fails.

Reported by: bdrewery

7 years agoOn success, getrandom() Linux system call returns the number of bytes that
dchagin [Sun, 4 Jun 2017 18:35:30 +0000 (18:35 +0000)]
On success, getrandom() Linux system call returns the number of bytes that
were copied to the buffer supplied by the user.

PR:           219464
Submitted by: Maciej Pasternacki
Reported by:  Maciej Pasternacki
MFC after:    1 week

7 years agoRevert r319053 due to lack of sence. As pointed out by kib@ opt_global.h
dchagin [Sun, 4 Jun 2017 18:24:41 +0000 (18:24 +0000)]
Revert r319053 due to lack of sence. As pointed out by kib@ opt_global.h
contains such fundamental settings as e.g. SMP option and fake
opt_global.h almost never match real configured kernels.

Reported by: kib@

7 years agoStart to rename files with common or generic names to be SoC specific. The
andrew [Sun, 4 Jun 2017 09:11:14 +0000 (09:11 +0000)]
Start to rename files with common or generic names to be SoC specific. The
build system doesn't handle two files with the same name.

7 years agoDelete obsolete paragraph; primes(6) is now able to list primes for the
cperciva [Sun, 4 Jun 2017 02:45:18 +0000 (02:45 +0000)]
Delete obsolete paragraph; primes(6) is now able to list primes for the
full range up to 2^64 - 1.

MFC after: 1 week

7 years agoUsing results from
cperciva [Sun, 4 Jun 2017 02:36:37 +0000 (02:36 +0000)]
Using results from
    J. Sorenson and J. Webster, Strong pseudoprimes to twelve prime
    bases, Math. Comp. 86(304):985-1003, 2017.
teach primes(6) to enumerate primes up to 2^64 - 1.  Until Sorenson
and Webster's paper, we did not know how many strong speudoprime tests
were required when testing alleged primes between 3825123056546413051
and 2^64 - 1.

Reported by: Luiz Henrique de Figueiredo
Relnotes: primes(6) now enumerates primes beyond 3825123056546413050,
up to a new limit of 2^64 - 1.
MFC After: 1 week

7 years agonative-xtools: Connect makewhatis.
bdrewery [Sat, 3 Jun 2017 23:13:46 +0000 (23:13 +0000)]
native-xtools: Connect makewhatis.

This speeds up some port staging, namely perl.

7 years agoext2fs(4): Fix a null dererence and clean an unclear switch
cem [Sat, 3 Jun 2017 22:39:50 +0000 (22:39 +0000)]
ext2fs(4): Fix a null dererence and clean an unclear switch

Coverity warned that the switch statement fell through.  While this was
intentional, the pattern wasn't especially clear.  I just changed it to a
conventional if pattern.

Reported by: Coverity
CIDs: 1375851 (false positive), 1375853
Sponsored by: Dell EMC Isilon

7 years agoext2fs(4): Fix a number of broken flag checks
cem [Sat, 3 Jun 2017 22:30:30 +0000 (22:30 +0000)]
ext2fs(4): Fix a number of broken flag checks

Introduced in r319071.

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

7 years agoFix the ICMP6 handling for TCP.
tuexen [Sat, 3 Jun 2017 21:53:58 +0000 (21:53 +0000)]
Fix the ICMP6 handling for TCP.

The ICMP6 packets might not be contained in a single mbuf. So don't
assume this. Keep the IPv4 and IPv6 code in sync and make explicit
that the syncache code only need the TCP sequence number, not the
complete TCP header.

MFC after: 3 days
Sponsored by: Netflix, Inc.

7 years agoPort the Vybrid code to PLATFORM to help move it into GENERIC.
andrew [Sat, 3 Jun 2017 20:14:46 +0000 (20:14 +0000)]
Port the Vybrid code to PLATFORM to help move it into GENERIC.

7 years agoPort the Samsung ARM code to use PLATFORM and PLATFORM_SMP. This will help
andrew [Sat, 3 Jun 2017 20:02:12 +0000 (20:02 +0000)]
Port the Samsung ARM code to use PLATFORM and PLATFORM_SMP. This will help
move it into the GENERIC kernel config.

7 years agoPort the Xilinx code to use PLATFORM and PLATFORM_SMP. This will help move
andrew [Sat, 3 Jun 2017 19:11:32 +0000 (19:11 +0000)]
Port the Xilinx code to use PLATFORM and PLATFORM_SMP. This will help move
it to be part of the armv6 GENERIC kernel.

7 years agoFix bin/dd/dd2_tests:seek_overflow on UFS and TMPFS
asomers [Sat, 3 Jun 2017 18:29:18 +0000 (18:29 +0000)]
Fix bin/dd/dd2_tests:seek_overflow on UFS and TMPFS

Split the postive and negative parts into separate test cases.  The positive
test case can only run on ZFS, because only ZFS supports files that large.

PR: 219757
Reported by: ngie
MFC after: 18 days
X-MFC-with: 319339

7 years agoRemove TODO for sub testcases added for bug 212160
ngie [Sat, 3 Jun 2017 18:20:23 +0000 (18:20 +0000)]
Remove TODO for sub testcases added for bug 212160

On closer inspection, the past failures no longer occur on ^/head.

PR: 212160
Sponsored by: Dell EMC Isilon

7 years agoFix the testplan after ^/head@r318960
ngie [Sat, 3 Jun 2017 18:12:00 +0000 (18:12 +0000)]
Fix the testplan after ^/head@r318960

The number of executed testcases is 128, not 126.

MFC after: 18 days
MFC with: r318960
Sponsored by: Dell EMC Isilon

7 years agoDon't execute the TODO cases in a subshell
ngie [Sat, 3 Jun 2017 18:10:04 +0000 (18:10 +0000)]
Don't execute the TODO cases in a subshell

This messes up the testcase counter, as seen in bug 219756.

PR: 212160, 219756
Sponsored by: Dell EMC Isilon

7 years agoMark :seek_overflow as an expected failure
ngie [Sat, 3 Jun 2017 17:59:10 +0000 (17:59 +0000)]
Mark :seek_overflow as an expected failure

MFC after: 18 days
MFC with: r319339
PR: 219757
Sponsored by: Dell EMC Isilon

7 years agoStylistic tweaks
ngie [Sat, 3 Jun 2017 17:56:31 +0000 (17:56 +0000)]
Stylistic tweaks

Move opening braces of functions from the last column to column 0.

MFC after: 18 days
MFC with: r319339
Sponsored by: Dell EMC Isilon

7 years agoEliminate duplication of the pmap and pv list unlock operations in
alc [Sat, 3 Jun 2017 17:24:13 +0000 (17:24 +0000)]
Eliminate duplication of the pmap and pv list unlock operations in
pmap_enter() by implementing a single return path.  Otherwise, the
duplication will only increase with the upcoming support for psind == 1.

Reviewed by: kib (some time ago)

7 years agoStop making cpu_initclocks weak when using event timers. A weak symbol
andrew [Sat, 3 Jun 2017 16:24:17 +0000 (16:24 +0000)]
Stop making cpu_initclocks weak when using event timers. A weak symbol
could be overridden in the SoC specific code, but this would break GENERIC
as it is likely to be incorrect.

Remove the versatile implementation of cpu_initclocks as it's unneeded.

7 years agoThe data type returned by vmoff() is too narrow in its range. This could
alc [Sat, 3 Jun 2017 16:19:33 +0000 (16:19 +0000)]
The data type returned by vmoff() is too narrow in its range.  This could
break the transmission of files longer than 4 GB on 32-bit architectures.

Reviewed by: glebius, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10019

7 years agoMitigate several problems with the softdep_request_cleanup() on busy
kib [Sat, 3 Jun 2017 16:18:50 +0000 (16:18 +0000)]
Mitigate several problems with the softdep_request_cleanup() on busy
host.

Problems start appearing when there are several threads all doing
operations on a UFS volume and the SU workqueue needs a cleanup.  It is
possible that each thread calling softdep_request_cleanup() owns the
lock for some dirty vnode (e.g. all of them are executing mkdir(2),
mknod(2), creat(2) etc) and all vnodes which must be flushed are locked
by corresponding thread. Then, we get all the threads simultaneously
entering softdep_request_cleanup().

There are two problems:
- Several threads execute MNT_VNODE_FOREACH_ALL() loops in parallel.  Due
  to the locking, they quickly start executing 'in phase' with the speed
  of the slowest thread.
- Since each thread already owns the lock for a dirty vnode, other threads
  non-blocking attempt to lock the vnode owned by other thread fail,
  and loops executing without making the progress.
Retry logic does not allow the situation to recover.  The result is
a livelock.

Fix these problems by making the following changes:
- Allow only one thread to enter MNT_VNODE_FOREACH_ALL() loop per mp.
  A new flag FLUSH_RC_ACTIVE guards the loop.
- If there were failed locking attempts during the loop, abort retry
  even if there are still work items on the mp work list.  An
  assumption is that the items will be cleaned when other thread
  either fsyncs its vnode, or unlock and allow yet another thread to
  make the progress.

It is possible now that some calls would get undeserved ENOSPC from
ffs_alloc(), because the cleanup is not aggressive enough. But I do
not see how can we reliably clean up workitems if calling
softdep_request_cleanup() while still owning the vnode lock. I thought
about scheme where ffs_alloc() returns ERESTART and saves the retry
counter somewhere in struct thread, to return to the top level, unlock
the vnode and retry.  But IMO the very rare (and unproven) spurious
ENOSPC is not worth the complications.

Reported and tested by: pho
Style and comments by: mckusick
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoAdd MULTIDELAY support to the mpcore timer driver. This is needed when
andrew [Sat, 3 Jun 2017 15:56:54 +0000 (15:56 +0000)]
Add MULTIDELAY support to the mpcore timer driver. This is needed when
using this with GENERIC.

While here remove the weak symbol, it doesn't seem to be needed anymore.

7 years agoAdd MULTIDELAY support to the sp804 driver.
andrew [Sat, 3 Jun 2017 15:48:03 +0000 (15:48 +0000)]
Add MULTIDELAY support to the sp804 driver.

7 years agoAdd MULTIDELAY to the Beaglebone kenrel config to help moving it to GENERIC.
andrew [Sat, 3 Jun 2017 15:40:34 +0000 (15:40 +0000)]
Add MULTIDELAY to the Beaglebone kenrel config to help moving it to GENERIC.

7 years agoEnable MULTIDELAY in the i.MX5 kernel configs. This will help adding them
andrew [Sat, 3 Jun 2017 15:39:23 +0000 (15:39 +0000)]
Enable MULTIDELAY in the i.MX5 kernel configs. This will help adding them
to GENERIC.

7 years agoRemove RT1310 from universe as it fails to build.
andrew [Sat, 3 Jun 2017 14:45:46 +0000 (14:45 +0000)]
Remove RT1310 from universe as it fails to build.

7 years agomakefs: rename variable for NetBSD diff reduction
emaste [Sat, 3 Jun 2017 14:28:19 +0000 (14:28 +0000)]
makefs: rename variable for NetBSD diff reduction

7 years agoDecode the 'who' argument passed to getrusage().
jhb [Sat, 3 Jun 2017 14:22:15 +0000 (14:22 +0000)]
Decode the 'who' argument passed to getrusage().

Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant
passed as the first argument to getrusage().  Use this function in both
kdump and truss to decode the first argument to getrusage().

PR: 215448
Submitted by: Anton Yuzhaninov <citrin+pr@citrin.ru>
MFC after: 1 month

7 years agoClean possible td_su reference on the struct mount being unmounted as
kib [Sat, 3 Jun 2017 14:15:14 +0000 (14:15 +0000)]
Clean possible td_su reference on the struct mount being unmounted as
the last step of ffs_unmount().

It is possible that the mount point is recorded for cleanup in AST
context while softdep flush is executed during unmount.  The workitems
are flushed by other means for the unmount, but the stray reference to
struct mount blocks destruction of mount.  Check for the situation and
manually call vfs_rel() before returning from ffs_unmount().

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

7 years agoEnsure that cached struct thread does not keep spurious td_su
kib [Sat, 3 Jun 2017 14:12:17 +0000 (14:12 +0000)]
Ensure that cached struct thread does not keep spurious td_su
reference on an UFS mount point.

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

7 years agoAdd a cross-reference to sysdecode_socket_protocol(3).
jhb [Sat, 3 Jun 2017 14:10:09 +0000 (14:10 +0000)]
Add a cross-reference to sysdecode_socket_protocol(3).

7 years agotsan: set noexec stack on aarch64
emaste [Sat, 3 Jun 2017 13:13:57 +0000 (13:13 +0000)]
tsan: set noexec stack on aarch64

This may be refined upstream.

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

7 years agoMake it an error to build armv6 without INTRNG enabled. Most kernel configs
andrew [Sat, 3 Jun 2017 10:40:45 +0000 (10:40 +0000)]
Make it an error to build armv6 without INTRNG enabled. Most kernel configs
have been updated for this, with the exception of the two marked as
NO_UNIVERSE in r319514.

7 years agoMark the non-INTRNG armv6 configs with NO_UNIVERSE to prepare for INTRNG
andrew [Sat, 3 Jun 2017 10:38:41 +0000 (10:38 +0000)]
Mark the non-INTRNG armv6 configs with NO_UNIVERSE to prepare for INTRNG
being always enabled on armv6.

7 years agolinux vdso: pass -fPIC to the assembler, not linker
emaste [Sat, 3 Jun 2017 03:40:11 +0000 (03:40 +0000)]
linux vdso: pass -fPIC to the assembler, not linker

-fPIC has no effect on linking although it seems to be ignored by
GNU ld.bfd.  However, it causes ld.lld to terminate with an invalid
argument error.

This is equivalent to r296057 but for the kernel (not modules) case.

MFC after: 2 months
Sponsored by: The FreeBSD Foundation

7 years agoxz: set noexec stack flag on FreeBSD
emaste [Sat, 3 Jun 2017 02:42:49 +0000 (02:42 +0000)]
xz: set noexec stack flag on FreeBSD

Will also be proposed upstream.

Reviewed by: delphij
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11033

7 years agoDecode the argument passed to cap_getmode().
jhb [Fri, 2 Jun 2017 22:35:18 +0000 (22:35 +0000)]
Decode the argument passed to cap_getmode().

The returned integer value is output.

7 years agoFix a memory leak with last
stevek [Fri, 2 Jun 2017 20:25:25 +0000 (20:25 +0000)]
Fix a memory leak with last
free memory allocated to 'buf'

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: ed
Approved by: sjg (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9850

7 years agomsdosfs: use mem{cpy,move,set} instead of bcopy,bzero
emaste [Fri, 2 Jun 2017 18:39:53 +0000 (18:39 +0000)]
msdosfs: use mem{cpy,move,set} instead of bcopy,bzero

This somewhat simplifies use of msdosfs code in userland (for makefs),
reduces diffs with NetBSD and is standard C as of C89.

Reviewed by: imp
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11014

7 years agocxgbe(4): Update the statistics for compound tx work requests once per
np [Fri, 2 Jun 2017 17:57:27 +0000 (17:57 +0000)]
cxgbe(4): Update the statistics for compound tx work requests once per
work request, not once per frame.

MFC after: 1 week
Sponsored by: Chelsio Communications

7 years agoRename accept filter getopt/setopt functions, so that they are prefixed
glebius [Fri, 2 Jun 2017 17:49:21 +0000 (17:49 +0000)]
Rename accept filter getopt/setopt functions, so that they are prefixed
with module name and match other functions in the module.  There is no
functional change.

7 years agoStyle: unwrap lines that doesn't have a good reason to be wrapped.
glebius [Fri, 2 Jun 2017 17:43:47 +0000 (17:43 +0000)]
Style: unwrap lines that doesn't have a good reason to be wrapped.

7 years agoRemove write only flag UNP_HAVEPCCACHED.
glebius [Fri, 2 Jun 2017 17:39:05 +0000 (17:39 +0000)]
Remove write only flag UNP_HAVEPCCACHED.

7 years agoFor UNIX sockets make vnode point not to the socket, but to the UNIX PCB,
glebius [Fri, 2 Jun 2017 17:31:25 +0000 (17:31 +0000)]
For UNIX sockets make vnode point not to the socket, but to the UNIX PCB,
since the latter is the thing that links together VFS and sockets.

While here, make the union in the struct vnode anonymous.

7 years agoImprove kqueue() support in the LinuxKPI. Some applications using the
hselasky [Fri, 2 Jun 2017 16:52:18 +0000 (16:52 +0000)]
Improve kqueue() support in the LinuxKPI. Some applications using the
kqueue() does not set non-blocking I/O mode for event driven read of
file descriptors. This means the LinuxKPI internal kqueue read and
write event flags must be updated before the next read and/or write
system call. Else the read and/or write system call may block. This
can happen when there is no more data to read following a previous
read event. Then the application also gets blocked from processing
other events. This situation can also be solved by the applications
setting and using non-blocking I/O mode.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd support for setting the non-blocking I/O flag for LinuxKPI
hselasky [Fri, 2 Jun 2017 16:30:40 +0000 (16:30 +0000)]
Add support for setting the non-blocking I/O flag for LinuxKPI
character devices. In Linux the FIONBIO IOCTL is handled by the kernel
and not the drivers. Also need return success for the FIOASYNC ioctl
due to existing logic in kern_fcntl() even though it is not supported
currently.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoConsistently use lowercase hex numbers in ascii(7).
trasz [Fri, 2 Jun 2017 15:32:11 +0000 (15:32 +0000)]
Consistently use lowercase hex numbers in ascii(7).

MFC after: 2 weeks

7 years agostyle(9) fixes, remove unnecessary headers, remove duplicate #defines and
loos [Fri, 2 Jun 2017 15:12:32 +0000 (15:12 +0000)]
style(9) fixes, remove unnecessary headers, remove duplicate #defines and
in some cases, shuffle the code around to simplify locking.

No functional changes.

Sponsored by: Rubicon Communications, LLC (Netgate)

7 years ago- Don't bother flushing the data cache for pages we're about to unmap, there's
cognet [Fri, 2 Jun 2017 14:17:14 +0000 (14:17 +0000)]
- Don't bother flushing the data cache for pages we're about to unmap, there's
no need to.
- Remove pmap_is_current(), pmap_[pte|l3]_valid_cacheable as there were only
used to know if we had to write back pages.
- In pmap_remove_pages(), don't bother invalidating each page in the TLB,
we're about to flush the whole TLB anyway.

This makes make world 8-9% faster on my hardware.

Reviewed by: andrew

7 years agoFix device lookup of for the stdout-path chosen property.
andrew [Fri, 2 Jun 2017 14:01:17 +0000 (14:01 +0000)]
Fix device lookup of for the stdout-path chosen property.

The stdout-path chosen property may include the serial connection details,
e.g. the baud rate. When passing the device to OF_finddevice we need to
strip off this information as it will cause the lookup to fail.

Reviewed by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D6846

7 years agoDecode the arguments passed to __cap_rights_get() and cap_rights_limit().
jhb [Fri, 2 Jun 2017 13:33:50 +0000 (13:33 +0000)]
Decode the arguments passed to __cap_rights_get() and cap_rights_limit().

Submitted by: tobik

7 years agoSkip setting the MTU in the netfront driver (xn# devices) if the new MTU
cperciva [Fri, 2 Jun 2017 07:03:31 +0000 (07:03 +0000)]
Skip setting the MTU in the netfront driver (xn# devices) if the new MTU
is the same as the old MTU.  In particular, on Amazon EC2 "T2" instances
without this change, the network interface is reinitialized every 30
minutes due to the MTU being (re)set when a new DHCP lease is obtained,
causing packets to be dropped, along with annoying syslog messages about
the link state changing.

As a side note, the behaviour this commit fixes was responsible for
exposing the locking problems fixed via r318523 and r318631.

Maintainers of other network interface drivers may wish to consider making
the corresponding change; the handling of SIOCSIFMTU does not seem to
exhibit a great deal of consistency between drivers.

MFC after: 1 week

7 years agoRemove stale cap_rights_get(2) manpage.
jhb [Fri, 2 Jun 2017 03:53:34 +0000 (03:53 +0000)]
Remove stale cap_rights_get(2) manpage.

The documentation moved to section 3 several years ago, but
'man cap_rights_get' pulls up cap_rights_limit(2) (which is
MLINKed to cap_rights_get.2) instead of cap_rights_get(3).

MFC after: 1 week

7 years agoAdd -H as an alias for --speed-large-file to match GNU diff.
jhb [Fri, 2 Jun 2017 03:25:59 +0000 (03:25 +0000)]
Add -H as an alias for --speed-large-file to match GNU diff.

This is undocumented to match GNU diff where -H is also undocumented.
Some existing software (such as kompare) uses this option by default.

Reviewed by: emaste, rpokala
Differential Revision: https://reviews.freebsd.org/D11022

7 years agoBump manpage date.
araujo [Fri, 2 Jun 2017 02:37:17 +0000 (02:37 +0000)]
Bump manpage date.

7 years agoAdd VNC Authentication support based on RFC6143 section 7.2.2.
araujo [Fri, 2 Jun 2017 02:35:16 +0000 (02:35 +0000)]
Add VNC Authentication support based on RFC6143 section 7.2.2.

Submitted by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Reworked by: myself
Reviewed by: grehan, rgrimes and jilles
MFC after: 1 week.
Relnotes: Yes.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10818

7 years agonative-xtools: Connect lld.
bdrewery [Fri, 2 Jun 2017 00:57:59 +0000 (00:57 +0000)]
native-xtools: Connect lld.

This will ensure that aarch64 gets a working native /usr/bin/ld rather
than requiring the aarch64-binutils hack in Poudriere, or emulating
the aarch64 lld.

PR: 217189
Reported by: swills, jbeich

7 years agoMETA_MODE: Move ignoring of /usr/local/etc/libmap.d to proper place.
bdrewery [Thu, 1 Jun 2017 23:04:44 +0000 (23:04 +0000)]
META_MODE: Move ignoring of /usr/local/etc/libmap.d to proper place.

This was added in r318194 but local.meta.sys.mk is only used for
DIRDEPS_BUILD.

7 years agocrashinfo: add "batch" mode and use it during boot
vangyzen [Thu, 1 Jun 2017 21:23:04 +0000 (21:23 +0000)]
crashinfo: add "batch" mode and use it during boot

In batch mode, most messages go into the core.txt.N file instead of stdout.

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

7 years agortwn: drop obsolete (since r319460) code.
avos [Thu, 1 Jun 2017 21:20:44 +0000 (21:20 +0000)]
rtwn: drop obsolete (since r319460) code.

Tested with RTL8188EU, STA mode.

7 years agoFix some new errors and a warning in cryptotest.
jhb [Thu, 1 Jun 2017 21:07:32 +0000 (21:07 +0000)]
Fix some new errors and a warning in cryptotest.

- Use a new 'char *key' to allocate storage for keys and assign the
  pointer to the session2_op 'const char *' members after the key is
  initialized.
- Mark the 'find' variable used in crfind() static so that crfind()
  doesn't return a pointer to stack garbage.

Reported by: olivier (1)
MFC after: 2 weeks
Sponsored by: Chelsio Communications

7 years agogetenv(9): rename to "kern_getenv", etc.
vangyzen [Thu, 1 Jun 2017 21:07:25 +0000 (21:07 +0000)]
getenv(9): rename to "kern_getenv", etc.

Update the documentation to catch up with r273174, which renamed
      getenv -> kern_getenv
      setenv -> kern_setenv
    unsetenv -> kern_unsetenv

Leave the old links in place to support finger memory.

MFC after: 3 days
Sponsored by: Dell EMC

7 years agoFor arm targets, place ABI at the end of the target triple
dim [Thu, 1 Jun 2017 21:05:56 +0000 (21:05 +0000)]
For arm targets, place ABI at the end of the target triple

For some reason, we have been inserting the ABI specification into the
middle of the target triple, when building LLVM, like so:

    armv6-gnueabi-freebsd12.0

This is the wrong way around.  LLVM even auto-canonicalizes it to:

    armv6--freebsd12.0-gnueabi

Let's do this the right way in llvm.build.mk instead.  While here,
define a proper VENDOR macro which can be overridden easily.

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10846

7 years agonet80211: initialize i_seq for A-MPDU frames.
avos [Thu, 1 Jun 2017 20:46:43 +0000 (20:46 +0000)]
net80211: initialize i_seq for A-MPDU frames.

Fragment number field (part of i_seq) is used for AAD calculation;
as a result, without this patch every driver without h/w crypto support
need to clear it before ieee80211_crypto_encap().

Also fixes rtwn(4) A-MPDU Tx with dev.rtwn.%d.hwcrypto tunable
set to 0 (h/w crypto is disabled).

Tested with:
 * Intel 6205, STA mode.
 * RTL8188EU, STA mode.

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

7 years agoRevert r319457.
bdrewery [Thu, 1 Jun 2017 20:29:48 +0000 (20:29 +0000)]
Revert r319457.

META_MODE users actually do not need to do anything special assuming
they have COMPAT_FREEBSD11 enabled.  The host tools in WORLDTMP will
continue to work just fine.

7 years agoAdd a few missed files to ObsoleteFiles.inc.
dim [Thu, 1 Jun 2017 20:11:26 +0000 (20:11 +0000)]
Add a few missed files to ObsoleteFiles.inc.

7 years agoMETA_MODE users should build with -DNO_META_IGNORE_HOST once after ino64 upgrade.
bdrewery [Thu, 1 Jun 2017 20:03:20 +0000 (20:03 +0000)]
META_MODE users should build with -DNO_META_IGNORE_HOST once after ino64 upgrade.

See r301467 for more details.

7 years agotests/sys/opencrypto/runtests: apply minor polish to test script
ngie [Thu, 1 Jun 2017 19:58:40 +0000 (19:58 +0000)]
tests/sys/opencrypto/runtests: apply minor polish to test script

- Refactor kld loading/unloading logic:
-- Use a loop instead of an unrolled one.
-- Check for the module being loaded before trying to load it, to reduce
   noise when loading modules that are already loaded.
-- Don't mute stderr from kldload -- it could be potentially useful to
   the tester.
-- In the event that the test script was terminated early, it would leave
   the modules still attached to the system (which is undesirable).
   Always unload the modules at test end with EXIT/SIGINT/SIGTERM so the
   system is returned to its former operating state as best possible.
   Unload the modules in reverse order, in part for consistency and/or
   dependency reasons.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix up `TEST_METADATA`
ngie [Thu, 1 Jun 2017 19:46:48 +0000 (19:46 +0000)]
Fix up `TEST_METADATA`

- `TEST_METADATA.foo` should be `TEST_METADATA.run_tests`: this will unbreak
  trying to run the tests on a system without python installed in $PATH.
- The tests require root because they load aesni(4) and/or cryptodev(4) if
  not already loaded.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoHonor the requested crid when running a test.
jhb [Thu, 1 Jun 2017 19:27:38 +0000 (19:27 +0000)]
Honor the requested crid when running a test.

Otherwise, the kernel is free to choose an aribtrary crypto device
rather than the requested device subverting tests that force the use
of a specific device.

MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D10762

7 years agoFix memory leak in edithost
stevek [Thu, 1 Jun 2017 19:21:30 +0000 (19:21 +0000)]
Fix memory leak in edithost

The problem is that when the parameter 'pat' is null, the function locally
allocates a NULL string but never frees it.

Instead of tracking the local alloc, it is noted that the while(*pat) never
enters when there is a local alloc.
So instead of doing the local alloc, check that 'pat' is null before the
while(*pat) loop.

Found using clang's static analyzer - scan-build

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: markm
Approved by: sjg (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9689

7 years agoAs old prophecy says, some day UMA_DEBUG printfs shall be made CTRs.
glebius [Thu, 1 Jun 2017 18:36:52 +0000 (18:36 +0000)]
As old prophecy says, some day UMA_DEBUG printfs shall be made CTRs.

7 years agoSimplify boot pages management in UMA.
glebius [Thu, 1 Jun 2017 18:26:57 +0000 (18:26 +0000)]
Simplify boot pages management in UMA.

It is simply a contigous virtual memory pointer and number of pages.
There is no need to build a linked list here.  Just increment pointer
and decrement counter.  The only functional difference to old allocator
is that before we gave pages from topmost and down to lowest, and now
we give them in normal ascending order.

While here remove padalign from a mutex that is unused at runtime.

Reviewed by: alc

7 years agoMake sure the selrecord() function is only called from within system
hselasky [Thu, 1 Jun 2017 16:49:48 +0000 (16:49 +0000)]
Make sure the selrecord() function is only called from within system
polling contexts in the LinuxKPI.

After the kqueue() support was added to the LinuxKPI in r319409 the
Linux poll file operation will be used outside the system file polling
callback function, which can cause a NULL-pointer panic inside
selrecord() because curthread->td_sel is set to NULL. This patch moves
the selrecord() call away from poll_wait() and to the system file poll
callback function in the LinuxKPI, which essentially wraps the Linux
one. This is similar to what the cuse(3) module is currently doing.
Refer to sys/fs/cuse/*.[ch] for more details.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoWhen sysctlbyname fails, free buf before returning.
stevek [Thu, 1 Jun 2017 16:44:39 +0000 (16:44 +0000)]
When sysctlbyname fails, free buf before returning.

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: jhb
Approved by: sjg (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9867

7 years agoImprove comments to describe what the code does.
tuexen [Thu, 1 Jun 2017 15:11:18 +0000 (15:11 +0000)]
Improve comments to describe what the code does.

Reported by: jtl
Sponsored by: Netflix, Inc.

7 years agoUse proper capitalization with .Dd.
trasz [Thu, 1 Jun 2017 15:03:43 +0000 (15:03 +0000)]
Use proper capitalization with .Dd.

Submitted by: oshogbo
MFC after: 2 weeks

7 years agoAllow communication between functions on the same host when using the
hselasky [Thu, 1 Jun 2017 10:44:48 +0000 (10:44 +0000)]
Allow communication between functions on the same host when using the
mlx4en(4) driver in SRIOV mode.

Place a copy of the destination MAC address in the send WQE only under
SRIOV/eSwitch configuration or when the device is in selftest. This
allows communication between functions on the same host.

PR: 216493
MFC after: 3 days
Sponsored by: Mellanox Technologies