]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

7 years agoFree hardware queue resource after port is stopped in the mlx4en(4)
hselasky [Thu, 1 Jun 2017 10:39:00 +0000 (10:39 +0000)]
Free hardware queue resource after port is stopped in the mlx4en(4)
driver. Else if the port is up the resource might still be busy and
the MTT free will fail.

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

7 years agoBuild kdebug_secreplay() function only when IPSEC_DEBUG is defined.
ae [Thu, 1 Jun 2017 10:04:12 +0000 (10:04 +0000)]
Build kdebug_secreplay() function only when IPSEC_DEBUG is defined.

This should fix the build on sparc.

Reported by: emaste
X-MFC with: r319118

7 years agoTranslate the ERESTARTSYS error code into ERESTART in the LinuxKPI
hselasky [Thu, 1 Jun 2017 09:53:55 +0000 (09:53 +0000)]
Translate the ERESTARTSYS error code into ERESTART in the LinuxKPI
ioctl(), read() and write() system call handlers. This error code is
internal to the kernel and should not be seen by user-space programs
according to Linux.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd generic kqueue() and kevent() support to the LinuxKPI character
hselasky [Thu, 1 Jun 2017 09:34:51 +0000 (09:34 +0000)]
Add generic kqueue() and kevent() support to the LinuxKPI character
devices. The implementation allows read and write filters to be
created and piggybacks on the poll() file operation to determine when
a filter should trigger. The piggyback mechanism is simply to check
for the EWOULDBLOCK or EAGAIN return code from read(), write() or
ioctl() system calls and then update the kqueue() polling state bits.
The implementation is similar to the one found in the cuse(3) module.
Refer to sys/fs/cuse/*.[ch] for more details.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoipfw.8: Note that the ipfw_nat kernel module must be loaded or that the
manu [Thu, 1 Jun 2017 09:14:49 +0000 (09:14 +0000)]
ipfw.8: Note that the ipfw_nat kernel module must be loaded or that the
IPFIREWALL_NAT options must be in the kernel config in order to use in-kernel
nat.

MFC after: 3 days

7 years ago * limit size of buffers to RPC_MAXDATASIZE
delphij [Thu, 1 Jun 2017 06:12:25 +0000 (06:12 +0000)]
 * limit size of buffers to RPC_MAXDATASIZE
 * don't leak memory
 * be more picky about bad parameters

From:

https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt
https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt

via NetBSD.

Reviewed by: emaste, cem (earlier version)
Differential Revision: https://reviews.freebsd.org/D10922
MFC after: 3 days

7 years agoWelcome back bapt@ to portmgr
rene [Thu, 1 Jun 2017 02:31:14 +0000 (02:31 +0000)]
Welcome back bapt@ to portmgr

7 years agoMerge ACPICA 20170531.
jkim [Thu, 1 Jun 2017 00:01:19 +0000 (00:01 +0000)]
Merge ACPICA 20170531.

7 years agoImport ACPICA 20170531.
jkim [Wed, 31 May 2017 22:40:24 +0000 (22:40 +0000)]
Import ACPICA 20170531.

7 years agoparse.c parse_string
stevek [Wed, 31 May 2017 21:31:15 +0000 (21:31 +0000)]
parse.c parse_string
When parse_semi fails, free s before returning

parse.c parse_numeric_aggregate
The memory assigned to bufp is complicated, it can either be from the input
parameter buf or allocated locally. Introduce a new variable lbufp to track
when it is assigned locally and to free it when appropriate.

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: jhb
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9899

7 years agoAdd MD_VERIFY option to enable O_VERIFY in open for vnode type.
stevek [Wed, 31 May 2017 21:18:11 +0000 (21:18 +0000)]
Add MD_VERIFY option to enable O_VERIFY in open for vnode type.
Add -o [no]verify option to mdconfig (and document in man page.)
Implement GEOM attribute MNT::verified to ask md if the backing vnode is
  verified.
Check for MNT::verified in cd9660 mount to flag the mount as MNT_VERIFIED if
  the underlying device has been verified.

Reviewed by: rwatson
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D2902

7 years agoMinor code optimisation.
hselasky [Wed, 31 May 2017 21:05:24 +0000 (21:05 +0000)]
Minor code optimisation.
Avoid locking the global CUSE lock when the polling flags are zero.

MFC after: 1 week

7 years agoMFV: r319352
jkim [Wed, 31 May 2017 19:37:23 +0000 (19:37 +0000)]
MFV: r319352

Merge byacc 20170430.

7 years agoFix typo in Driver Type A/C/D capability checks in sdhci.
ivadasz [Wed, 31 May 2017 19:20:27 +0000 (19:20 +0000)]
Fix typo in Driver Type A/C/D capability checks in sdhci.

Use the SDHCI_CAN_DRIVE_TYPE_A/_C/_D masks to check for Driver Type support,
instead of using the SDHCI_CTRL2_DRIVER_TYPE_A/_C/_D values which are meant
for setting the Driver Type in the HOST_CONTROL2 register.

Approved by: adrian (mentor), jmcneill
Differential Revision: https://reviews.freebsd.org/D10999

7 years ago[ar71xx] rename AR724X_BASE -> std.AR724X
adrian [Wed, 31 May 2017 16:32:33 +0000 (16:32 +0000)]
[ar71xx] rename AR724X_BASE -> std.AR724X

7 years agomakefs: free buf in case of error
emaste [Wed, 31 May 2017 16:28:29 +0000 (16:28 +0000)]
makefs: free buf in case of error

CID: 270190
Submitted by: Siva Mahadevan <smahadevan@freebsdfoundation.org>
Reported by: Coverity
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11011

7 years agoImplement print_hex_dump(), print_hex_dump_bytes() and
hselasky [Wed, 31 May 2017 16:24:02 +0000 (16:24 +0000)]
Implement print_hex_dump(), print_hex_dump_bytes() and
printk_ratelimited() in the LinuxKPI.

While at it fix the inclusion guard of printk.h to be similar to the
rest of the LinuxKPI header files.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoProperly implement idr_preload() and idr_preload_end() in the
hselasky [Wed, 31 May 2017 16:08:30 +0000 (16:08 +0000)]
Properly implement idr_preload() and idr_preload_end() in the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix integer overflow detection in dd
asomers [Wed, 31 May 2017 16:07:32 +0000 (16:07 +0000)]
Fix integer overflow detection in dd

dd(1) tried to detect whether the seek offset would overflow, but it failed
to account for the case where the provided argument was negative and the
file was a regular file (negative seeks are allowed for character devices).
I fixed it, and added a regression test.

Reported by: Coverity
CID: 1368659
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agoImplement in_atomic() function in the LinuxKPI.
hselasky [Wed, 31 May 2017 15:05:44 +0000 (15:05 +0000)]
Implement in_atomic() function in the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix integer overflow in "camcontrol format"
asomers [Wed, 31 May 2017 14:59:03 +0000 (14:59 +0000)]
Fix integer overflow in "camcontrol format"

Reported by: Coverity
CID: 1011426
MFC after: 1 week
Sponsored by: Spectra Logic Corp

7 years agoFix uninitialized variable in bootparamd.c
asomers [Wed, 31 May 2017 14:53:50 +0000 (14:53 +0000)]
Fix uninitialized variable in bootparamd.c

Restore line that was accidentally deleted in change 318790

Reported by: Coverity
CID: 1375855
MFC after: 1 week
X-MFC-With: 318790
Sponsored by: Spectra Logic Corp

7 years agoProperly set the .d_name field in the cdevsw structure for the
hselasky [Wed, 31 May 2017 13:11:06 +0000 (13:11 +0000)]
Properly set the .d_name field in the cdevsw structure for the
LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMake sure the VMAP's "vm_file" field is referenced in a Linux
hselasky [Wed, 31 May 2017 13:07:05 +0000 (13:07 +0000)]
Make sure the VMAP's "vm_file" field is referenced in a Linux
compatible way by the linux_dev_mmap_single() function in the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRemove the VMA handle from its list before calling the LinuxKPI VMA
hselasky [Wed, 31 May 2017 13:05:54 +0000 (13:05 +0000)]
Remove the VMA handle from its list before calling the LinuxKPI VMA
close operation to prevent other threads from reusing the VM object
handle pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoDon't acquire a reference on the VM-space when allocating the LinuxKPI
hselasky [Wed, 31 May 2017 13:01:27 +0000 (13:01 +0000)]
Don't acquire a reference on the VM-space when allocating the LinuxKPI
task structure to avoid deadlock when tearing down the VM object
during a process exit.

Found by: markj @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix a reference count leak in the LinuxKPI due to calling VM open when
hselasky [Wed, 31 May 2017 12:08:25 +0000 (12:08 +0000)]
Fix a reference count leak in the LinuxKPI due to calling VM open when
it shouldn't be called.

Background:
The Linux VM open operation is called when a new VMA is
created on top of the current VMA. This is done through either mremap
flow or split_vma, usually due to mlock, madvise, munmap and so
on. This is currently not supported by the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFixes for refcounting "struct linux_file" in the LinuxKPI.
hselasky [Wed, 31 May 2017 12:02:59 +0000 (12:02 +0000)]
Fixes for refcounting "struct linux_file" in the LinuxKPI.

- Allow "struct linux_file" to be refcounted when its "_file" member
  is NULL by using its "f_count" field. The reference counts are
  transferred to the file structure when the file descriptor is
  installed.

- Add missing vdrop() calls for error cases during open().

- Set the "_file" member of "struct linux_file" during open. This
allows use of refcounting through get_file() and fput() with LinuxKPI
character devices.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMake sure the thread's priority is restored for all three cases inside
hselasky [Wed, 31 May 2017 10:01:15 +0000 (10:01 +0000)]
Make sure the thread's priority is restored for all three cases inside
linux_synchronize_rcu_cb() in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUpdate the usr.bin/mkimg golden test output files after ^/head@r319125
ngie [Wed, 31 May 2017 08:01:12 +0000 (08:01 +0000)]
Update the usr.bin/mkimg golden test output files after ^/head@r319125

^/head@r319125 changed the location of the backup pmbr, requiring the
output files to be regenerated, since they're binary disk dumps.

The output files were regenerated with "make rebase"--fixed in
^/head@r319294.

MFC with: r319125, r319294
PR: 219673
Sponsored by: Dell EMC Isilon

7 years agoFix "make rebase" after ^/head@r315776
ngie [Wed, 31 May 2017 07:49:49 +0000 (07:49 +0000)]
Fix "make rebase" after ^/head@r315776

"make rebase" can be used for rebasing the output files from mkimg
after making a change to mkimg. This will come in handy soon, per
bug 219673.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoFormalize the dependent/dependency relationship for <foo>.gz.uu vs <foo>
ngie [Wed, 31 May 2017 07:42:14 +0000 (07:42 +0000)]
Formalize the dependent/dependency relationship for <foo>.gz.uu vs <foo>

This helps ensure that the output files are regenerated if the input files
change, after the output files have been created.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years ago- Add a simple example to uname(1) manual page to show how the hardware
danfe [Wed, 31 May 2017 03:44:31 +0000 (03:44 +0000)]
- Add a simple example to uname(1) manual page to show how the hardware
  platform (returned by -m) can be different from the machine's processor
  architecture (-p)
- Document that make(1) sets universal MACHINE and MACHINE_ARCH variables
  based on these values

Reviewed by: imp, manpages (bjk)
Approved by: bjk, imp (implied)
Differential Revision: https://reviews.freebsd.org/D10489

7 years agoRemove NORESOLVE (-R) option from poollist() (ippool -l). It is not
cy [Wed, 31 May 2017 03:11:25 +0000 (03:11 +0000)]
Remove NORESOLVE (-R) option from poollist() (ippool -l). It is not
used in poollist().

7 years agoFix bug in r318997: remove the line which overrides vn_fsid()
kib [Tue, 30 May 2017 21:20:54 +0000 (21:20 +0000)]
Fix bug in r318997: remove the line which overrides vn_fsid()
calculation.

Noted by: jhb
Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation

7 years agoRegenerate src.conf(5)
ngie [Tue, 30 May 2017 18:06:19 +0000 (18:06 +0000)]
Regenerate src.conf(5)

This contains a number of content changes due to src.opts.mk changes.

Sponsored by: Dell EMC Isilon

7 years agoUse .Xr to reference libblacklist(3), blacklistctl(8), and blacklistd(8)
ngie [Tue, 30 May 2017 18:03:34 +0000 (18:03 +0000)]
Use .Xr to reference libblacklist(3), blacklistctl(8), and blacklistd(8)

MFC after: now
Sponsored by: Dell EMC Isilon