]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoReplace dummy implementation of RCU in the LinuxKPI with one based on
Hans Petter Selasky [Tue, 21 Feb 2017 18:04:21 +0000 (18:04 +0000)]
Replace dummy implementation of RCU in the LinuxKPI with one based on
the in-kernel concurrency kit's ck_epoch API. Factor RCU hlist_xxx()
functions into own rculist.h header file.

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

7 years agoadd UPDATING entry for r314048, re-work of .zfs code
Andriy Gapon [Tue, 21 Feb 2017 17:54:38 +0000 (17:54 +0000)]
add UPDATING entry for r314048, re-work of .zfs code

7 years agoreimplement zfsctl (.zfs) support
Andriy Gapon [Tue, 21 Feb 2017 17:47:08 +0000 (17:47 +0000)]
reimplement zfsctl (.zfs) support

The current code is written on top of GFS, a library with the generic
support for writing filesystems, which was ported from illumos.
Because of significant differences between illumos VFS and FreeBSD
VFS models, both the GFS and zfsctl code were heavily modified to
work on FreeBSD.  Nonetheless, they still contain quite a few ugly
hacks and bugs.

This is a reimplementation of the zfsctl code where the VFS-specific
bits are written from scratch and only the code that interacts with
the rest of ZFS is reused.

Some highlights.

We use two types of nodes, static and on-demand. The static nodes
are used for permanent directories like .zfs, .zfs/snapshot, etc. The
on-demand nodes are used for ephemeral directories that act as snapshot
mount points.
Initially only static nodes are created. Their vnodes are instantiated
when they are looked up. The on-demand nodes and vnodes are instantiated
as needed and the nodes are destroyed as soon as the corresponding
vnodes are reclaimed.
We also try very hard to ensure that uncovered snapshot vnodes do not
linger.  They are supposed to become inactive as soon as they are
uncovered and we try to recycle them immediately.
When a filesystem is unmounted all snapshots under .zfs are unmounted
first, then all vnodes are flushed and finally the static .zfs nodes
are destroyed.

There are some changes outside of zfsctl code too.
z_ctldir is never used directly (as it is an opaque pointer),
zfsctl_root() has to be used instead.  The function returns a locked
vnode now, so it accepts a lock flags parameter.  The function can
also fail now, e.g. during force unmounting, whereas previously it
was infallible.
zfsctl_root_lookup() is retired, instead of it VOP_LOOKUP() on the .zfs
vnode (obtained with zfsctl_root) is used.

Some ideas are picked from an independent work by will.

Reviewed by: asomers, smh
MFC after: 1 month
Relnotes: maybe
Differential Revision: https://reviews.freebsd.org/D7421

7 years agoRename BERI_TEMPLATE to std.BERI to be more like other configs.
Brooks Davis [Tue, 21 Feb 2017 17:34:27 +0000 (17:34 +0000)]
Rename BERI_TEMPLATE to std.BERI to be more like other configs.

Sponsored by: DARPA, AFRL

7 years agoGet rid of foo_sys() in linuxulator code. It was commented out, and it
Edward Tomasz Napierala [Tue, 21 Feb 2017 15:57:01 +0000 (15:57 +0000)]
Get rid of foo_sys() in linuxulator code.  It was commented out, and it
would be useless anyway - there is no point in pretending to have block
devices; our "block" devices are in fact character ones, and can only
be accessed as such.

Discussed with: dchagin
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoRemove duplicate INOT allocation.
Alexander Motin [Tue, 21 Feb 2017 14:31:58 +0000 (14:31 +0000)]
Remove duplicate INOT allocation.

For some reason isp_handle_platform_notify_fc() allocated INOT just
before calling isp_handle_platform_target_tmf(), which also allocates
INOT.  It seems to be a braino introduced in r196008.

MFC after: 2 weeks

7 years agoStreamline the LinuxKPI spinlock wrappers.
Hans Petter Selasky [Tue, 21 Feb 2017 14:22:14 +0000 (14:22 +0000)]
Streamline the LinuxKPI spinlock wrappers.

1) Add better spinlock debug names when WITNESS_ALL is defined.

2) Make sure that the calling thread gets bound to the current CPU
while a spinlock is locked. Some Linux kernel code depends on that the
CPU ID doesn't change while a spinlock is locked.

3) Add support for using LinuxKPI spinlocks during a panic().

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd support for LinuxKPI tasklets.
Hans Petter Selasky [Tue, 21 Feb 2017 13:23:53 +0000 (13:23 +0000)]
Add support for LinuxKPI tasklets.

Tasklets are implemented using a taskqueue and a small statemachine on
top. The additional statemachine is required to ensure all LinuxKPI
tasklets get serialized. FreeBSD taskqueues do not guarantee
serialisation of its tasks, except when there is only one worker
thread configured.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMake the LinuxKPI task struct persistent accross system calls.
Hans Petter Selasky [Tue, 21 Feb 2017 12:43:02 +0000 (12:43 +0000)]
Make the LinuxKPI task struct persistent accross system calls.

A set of helper functions have been added to manage the life of the
LinuxKPI task struct. When an external system call or task is invoked,
a check is made to create the task struct by demand. A thread
destructor callback is registered to free the task struct when a
thread exits to avoid memory leaks.

This change lays the ground for emulating the Linux kernel more
closely which is a dependency by the code using the LinuxKPI APIs.

Add new dedicated td_lkpi_task field has been added to struct thread
instead of abusing td_retval[1].

Fix some header file inclusions to make LINT kernel build properly
after this change.

Bump the __FreeBSD_version to force a rebuild of all kernel modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix style(9)
Renato Botelho [Tue, 21 Feb 2017 12:37:59 +0000 (12:37 +0000)]
Fix style(9)

Reviewed by: ngie, tuexen, vangyzen, allanjude
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9588

7 years agoRemove ancient __FreeBSD_version checks.
Alexander Motin [Tue, 21 Feb 2017 12:29:07 +0000 (12:29 +0000)]
Remove ancient __FreeBSD_version checks.

MFC after: 2 weeks

7 years agojedec_ts: fix slave address check
Andriy Gapon [Tue, 21 Feb 2017 12:24:31 +0000 (12:24 +0000)]
jedec_ts: fix slave address check

The mask should cover all bits that can not vary.

MFC after: 3 days

7 years agoEnable bsdinstall hardening options by default.
Bartek Rutkowski [Tue, 21 Feb 2017 09:37:33 +0000 (09:37 +0000)]
Enable bsdinstall hardening options by default.

As discussed previously, in order to introduce new OS hardening
defaults, we've added them to bsdinstall in 'off by default' mode.
It has been there for a while, so the next step is to change them
to 'on by defaul' mode, so that in future we could simply enable
them in base OS.

Reviewed by: brd
Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D9641

7 years agomca: change type of last_intr to time_t for consinstency
Andriy Gapon [Tue, 21 Feb 2017 09:33:21 +0000 (09:33 +0000)]
mca: change type of last_intr to time_t for consinstency

time_uptime is time_t

MFC after: 1 day
X-MFC with: r313752

7 years agoDo not blindly free completed ATIOs/INOTs on invalidation.
Alexander Motin [Tue, 21 Feb 2017 06:10:11 +0000 (06:10 +0000)]
Do not blindly free completed ATIOs/INOTs on invalidation.

When LUN is disabled, SIM starts returning queued ATIOs/INOTs.  But at the
same time there can be some ATIOs/INOTs still carrying real new requests.
If we free those, SIM may leak some resources, forever expecting for any
response from us.  So try to be careful, separating ATIOs/INOTs carrying
requests which still must be processed, from ATIOs/INOTs completed with
errors which can be freed.

MFC after: 2 weeks

7 years agoCorrect the return value for pmap_change_attr()
Justin Hibbits [Tue, 21 Feb 2017 05:08:07 +0000 (05:08 +0000)]
Correct the return value for pmap_change_attr()

pmap_change_attr() returns an error code, not a paddr.  This function is
currently unused for powerpc.

MFC after: 2 weeks

7 years agoMake it more clear that -k sends SIGKILL, not the -s signal.
Bryan Drewery [Tue, 21 Feb 2017 01:11:18 +0000 (01:11 +0000)]
Make it more clear that -k sends SIGKILL, not the -s signal.

MFC after: 1 week

7 years agoCapsicumize traceroute.
Mariusz Zaborski [Mon, 20 Feb 2017 23:48:50 +0000 (23:48 +0000)]
Capsicumize traceroute.

PR:  193973
Submitted by:  Mikhail <mp39590@gmail.com>
Reviewed by:  pjd, bapt, emaste, AllanJude
Differential Revision: https://reviews.freebsd.org/D9303

7 years agoConsolidate statements to initialize files.
John Baldwin [Mon, 20 Feb 2017 20:37:25 +0000 (20:37 +0000)]
Consolidate statements to initialize files.

Previously, the first lines of various generated files from system call
tables were generated in two sections.  Some of the initialization was
done in BEGIN, and the rest was done when the first line was encountered.
The main reason for this split before r313564 was that most of the
initialization done in the second section depended on the $FreeBSD$ tag
extracted from the system call table.  Now that the $FreeBSD$ tag is no
longer used, consolidate all of the file initialization in the BEGIN
section.

This change was tested by confirming that the content of generated files
did not change.

7 years agomtx: fix spin mutexes interaction with failed fcmpset
Mateusz Guzik [Mon, 20 Feb 2017 19:08:36 +0000 (19:08 +0000)]
mtx: fix spin mutexes interaction with failed fcmpset

While doing so move recursion support down to the fallback routine.

7 years agoAdd /proc/self/mounts to linprocfs; some linux binaries need it.
Edward Tomasz Napierala [Mon, 20 Feb 2017 17:33:25 +0000 (17:33 +0000)]
Add /proc/self/mounts to linprocfs; some linux binaries need it.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoSimplify devfs_fsync() by removing it. This might also be a minor
Edward Tomasz Napierala [Mon, 20 Feb 2017 16:18:33 +0000 (16:18 +0000)]
Simplify devfs_fsync() by removing it. This might also be a minor
optimization, as vn_isdisk() needs to lock a global mutex.

Reviewed by: imp
Tested by: pho
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9628

7 years agoReimplement linux_arch_prctl() as a wrapper around sysarch(2).
Edward Tomasz Napierala [Mon, 20 Feb 2017 16:13:40 +0000 (16:13 +0000)]
Reimplement linux_arch_prctl() as a wrapper around sysarch(2).
This also adds support for LINUX_ARCH_SET_GS.

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

7 years agoDefer ptracestop() signals that cannot be delivered immediately
Eric Badger [Mon, 20 Feb 2017 15:53:16 +0000 (15:53 +0000)]
Defer ptracestop() signals that cannot be delivered immediately

When a thread is stopped in ptracestop(), the ptrace(2) user may request
a signal be delivered upon resumption of the thread. Heretofore, those signals
were discarded unless ptracestop()'s caller was issignal(). Fix this by
modifying ptracestop() to queue up signals requested by the ptrace user that
will be delivered when possible. Take special care when the signal is SIGKILL
(usually generated from a PT_KILL request); no new stop events should be
triggered after a PT_KILL.

Add a number of tests for the new functionality. Several tests were authored
by jhb.

PR: 212607
Reviewed by: kib
Approved by: kib (mentor)
MFC after: 2 weeks
Sponsored by: Dell EMC
In collaboration with: jhb
Differential Revision: https://reviews.freebsd.org/D9260

7 years agoetherswitch: Fix RT305x vlan group operation
Stanislav Galabov [Mon, 20 Feb 2017 08:10:41 +0000 (08:10 +0000)]
etherswitch: Fix RT305x vlan group operation

Fix an issue which prevents proper operation (addition/removal of members)
of RT305x vlan groups.

Tested by: yamori813@yahoo.co.jp

Submitted by: yamori813@yahoo.co.jp (initial version)
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D9607

7 years ago[wlanstats] We actually /do/ support per-STA stats!
Adrian Chadd [Mon, 20 Feb 2017 08:04:06 +0000 (08:04 +0000)]
[wlanstats] We actually /do/ support per-STA stats!

7 years ago[net80211] validate VHT IEs.
Adrian Chadd [Mon, 20 Feb 2017 04:04:59 +0000 (04:04 +0000)]
[net80211] validate VHT IEs.

7 years ago[net80211] teach the probe response routine to add VHT IEs as appropriate.
Adrian Chadd [Mon, 20 Feb 2017 04:02:50 +0000 (04:02 +0000)]
[net80211] teach the probe response routine to add VHT IEs as appropriate.

7 years ago[net80211] fix up VHT IE comparison typo
Adrian Chadd [Mon, 20 Feb 2017 04:02:29 +0000 (04:02 +0000)]
[net80211] fix up VHT IE comparison typo

Whilst here, add a comment that I need to validate VHT IEs.

7 years ago[net80211] fix NULL pointer dereference in VHT operation in hostap mode.
Adrian Chadd [Mon, 20 Feb 2017 03:45:41 +0000 (03:45 +0000)]
[net80211] fix NULL pointer dereference in VHT operation in hostap mode.

The vht IEs are NULL at this point, so we shouldn't upgrade a node to VHT.
I'll fix the upgrade after this!

Tested:

* ath10k, hostap mode

7 years agosys/dev: Replace zero with NULL for pointers.
Pedro F. Giffuni [Mon, 20 Feb 2017 03:43:12 +0000 (03:43 +0000)]
sys/dev: Replace zero with NULL for pointers.

Makes things easier to read, plus architectures may set NULL to something
different than zero.

Found with: devel/coccinelle
MFC after: 3 weeks

7 years ago[ifconfig] fix a memory leak!
Adrian Chadd [Mon, 20 Feb 2017 03:12:46 +0000 (03:12 +0000)]
[ifconfig] fix a memory leak!

Submitted by: Tom Rix <trix@juniper.net>
Differential Revision: https://reviews.freebsd.org/D9675

7 years ago[ifconfig] fix a memory leak.
Adrian Chadd [Mon, 20 Feb 2017 03:10:56 +0000 (03:10 +0000)]
[ifconfig] fix a memory leak.

Submitted by: Tom Rix <trix@juniper.net>
Differential Revision: https://reviews.freebsd.org/D9654

7 years ago[net80211] RX parameter shuffle in net80211 in preparation for 4x4 NICs and 160MHz...
Adrian Chadd [Mon, 20 Feb 2017 02:08:08 +0000 (02:08 +0000)]
[net80211] RX parameter shuffle in net80211 in preparation for 4x4 NICs and 160MHz channels.

* Migrate the rx_params stuff out from ieee80211_freebsd.h where it doesn't belong -
  this isn't freebsd specific anymore.

* Don't use a hard-coded number of chains in the ioctl header; now we can shuffle
  MAX_CHAINS around so it can be used in the right spot.

* Extend the signal/noisefloor levels in the mimo stats struct to userland to include
  the signal and noisefloor levels for each 20MHz slice of a 160MHz channel.

* Bump the number of EVM pilots in preparation for 4x4 and 160MHz channels.

Tested:

* ath(4), STA mode
* iwn(4), STA mode
* local ath10k port, STA mode

TODO:

* 11ax chips will come with 5GHz 8x8 hardware for lots of MU-MIMO - I'll re-bump it
  at that point.

Note:

* This breaks the driver and ifconfig ABI; please recompile  the kernel,
  ifconfig and wpa_supplicant/hostapd.

7 years agoRemove lib/libpam tests after they were removed from the source tree in r313975
Enji Cooper [Mon, 20 Feb 2017 01:45:12 +0000 (01:45 +0000)]
Remove lib/libpam tests after they were removed from the source tree in r313975

X-MFC with: r313975
Sponsored by: Dell EMC Isilon

7 years agoUpgrade to OpenPAM Radula.
Dag-Erling Smørgrav [Mon, 20 Feb 2017 00:56:46 +0000 (00:56 +0000)]
Upgrade to OpenPAM Radula.

7 years agoAdd a file descriptor in struct url for netrc
Baptiste Daroussin [Mon, 20 Feb 2017 00:14:31 +0000 (00:14 +0000)]
Add a file descriptor in struct url for netrc

When using libfetch in an application that drops privileges when fetching
like pkg(8) then user complain because the application does not read anymore
${HOME}/.netrc. Now a caller can prepare a fd to the said file and manually
assign it to the structure.

It is also a first step to allow to capsicumize libfetch applications

Reviewed by: allanjude, des
Approved by: des
Differential Revision: https://reviews.freebsd.org/D9678

7 years agoA forced commit to note other portion of the Makefile change accidentally
Enji Cooper [Sun, 19 Feb 2017 22:00:11 +0000 (22:00 +0000)]
A forced commit to note other portion of the Makefile change accidentally
committed in r313972

The code committed in r313962 implicitly relies on python 2.x to generate
testvect.h . There are a handful of issues with this approach:

- python is not an explicit build dependency for FreeBSD
- python 2.x is deprecated and will be removed sometime in the future
  (potentially before 11.x's EOL), and the script does not function with
  python 3.5 (it uses deprecated idioms and incompatible function calls).
- python(1) (by default) lives in /usr/local/bin (${LOCALBASE}/bin) and
  gentestvect.py is a dependency of testvect.h (prior to r313972) which
  means that if the mtime of the generator script was newer than the
  mtime of the test vector, it could cause a spurious build failure in
  build time or at install time.

A better solution using C/C++ should be devised.

Discussed with: allanjude
MFC after: 2 weeks
X-MFC with: r313962, r313972
Sponsored by: Dell EMC Isilon

7 years agoUnbreak the build when "make obj" is executed beforehand
Enji Cooper [Sun, 19 Feb 2017 21:19:44 +0000 (21:19 +0000)]
Unbreak the build when "make obj" is executed beforehand

Using relative paths imply working directory (in this case .OBJDIR), whereas the
sources live in the .CURDIR-relative path.

MFC after: 2 weeks
X-MFC with: r313962
Pointyhat to: allanjude
Sponsored by: Dell EMC Isilon

7 years agoVendor import of OpenPAM Radula.
Dag-Erling Smørgrav [Sun, 19 Feb 2017 21:00:46 +0000 (21:00 +0000)]
Vendor import of OpenPAM Radula.

7 years agoApply noexec mount option for mmap(PROT_EXEC).
Konstantin Belousov [Sun, 19 Feb 2017 20:51:04 +0000 (20:51 +0000)]
Apply noexec mount option for mmap(PROT_EXEC).

Right now the noexec mount option disallows image activators to try
execve the files on the mount point.  Also, after r127187, noexec
also limits max_prot map entries permissions for mappings of files
from such mounts, but not the actual mapping permissions.

As result, the API behaviour is inconsistent.  The files from noexec
mount can be mapped with PROT_EXEC, but if mprotect(2) drops execution
permission, it cannot be re-enabled later.  Make this consistent
logically and aligned with behaviour of other systems, by disallowing
PROT_EXEC for mmap(2).

Note that this change only ensures aligned results from mmap(2) and
mprotect(2), it does not prevent actual code execution from files
coming from noexec mount.  Such files can always be read into
anonymous executable memory and executed from there.

Reported by: shamaz.mazum@gmail.com
PR: 217062
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoMFamd64 r313933: microoptimize pmap_protect_pte1().
Konstantin Belousov [Sun, 19 Feb 2017 20:40:07 +0000 (20:40 +0000)]
MFamd64 r313933: microoptimize pmap_protect_pte1().

Noted by: alc
Tested by: mmel
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoOnly notify blacklistd for successful logins in auth.c
Kurt Lidl [Sun, 19 Feb 2017 20:35:39 +0000 (20:35 +0000)]
Only notify blacklistd for successful logins in auth.c

Reported by: Rick Adams
Reviewed by: des
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoAdd a driver for the RouterBoard RB800 User LED
Justin Hibbits [Sun, 19 Feb 2017 19:56:12 +0000 (19:56 +0000)]
Add a driver for the RouterBoard RB800 User LED

This may work on other RouterBoard PPC platforms, but I don't have any to test
with.

7 years agoDocument r313854 (kern.cam.ctl.iscsi.maxtags).
Alexander Motin [Sun, 19 Feb 2017 19:46:47 +0000 (19:46 +0000)]
Document r313854 (kern.cam.ctl.iscsi.maxtags).

MFC after: 12 days

7 years agoimprove PBKDF2 performance
Allan Jude [Sun, 19 Feb 2017 19:30:31 +0000 (19:30 +0000)]
improve PBKDF2 performance

The PBKDF2 in sys/geom/eli/pkcs5v2.c is around half the speed it could be

GELI's PBKDF2 uses a simple benchmark to determine a number of iterations
that will takes approximately 2 seconds. The security provided is actually
half what is expected, because an attacker could use the optimized
algorithm to brute force the key in half the expected time.

With this change, all newly generated GELI keys will be approximately 2x
as strong. Previously generated keys will talk half as long to calculate,
resulting in faster mounting of encrypted volumes. Users may choose to
rekey, to generate a new key with the larger default number of iterations
using the geli(8) setkey command.

Security of existing data is not compromised, as ~1 second per brute force
attempt is still a very high threshold.

PR: 202365
Original Research: https://jbp.io/2015/08/11/pbkdf2-performance-matters/
Submitted by: Joe Pixton <jpixton@gmail.com> (Original Version), jmg (Later Version)
Reviewed by: ed, pjd, delphij
Approved by: secteam, pjd (maintainer)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8236

7 years agoUpdate pci_vendors to 2017.02.15
Baptiste Daroussin [Sun, 19 Feb 2017 18:16:47 +0000 (18:16 +0000)]
Update pci_vendors to 2017.02.15

MFC after: 3 days

7 years agoIn pmap_enter(), set the PG_MANAGED flag on the new PTE in one place,
Alan Cox [Sun, 19 Feb 2017 18:00:57 +0000 (18:00 +0000)]
In pmap_enter(), set the PG_MANAGED flag on the new PTE in one place,
rather two places, and do so before the pmap lock is acquired.

Submitted by: Yufeng Zhou <yz70@rice.edu>
Reviewed by: kib
MFC after: 1 week

7 years agoAdd USB Mass Storage CTL frontend. This makes it possible
Edward Tomasz Napierala [Sun, 19 Feb 2017 17:47:43 +0000 (17:47 +0000)]
Add USB Mass Storage CTL frontend.  This makes it possible
for USB OTG-capable hardware to implement device side of USB
Mass Storage, ie pretend it's a flash drive.  It's configured
in the same way as other CTL frontends, using ctladm(8)
or ctld(8).  Differently from usfs(4), all the configuration
can be done without rebuilding the kernel.

Testing and review is welcome.  Right now I'm still moving,
and I don't have access to my test environment, so I'm somewhat
reluctant to making larger changes to this code; on the other
hand I don't want to let it sit on Phab until my testing setup
is back, because I want to get it into 11.1-RELEASE.

Reviewed by: emaste (cursory), wblock (man page)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8787

7 years agoImport mandoc 1.4.1rc2
Baptiste Daroussin [Sun, 19 Feb 2017 17:46:37 +0000 (17:46 +0000)]
Import mandoc 1.4.1rc2

7 years agoImport mandoc 1.4.1rc2
Baptiste Daroussin [Sun, 19 Feb 2017 17:41:20 +0000 (17:41 +0000)]
Import mandoc 1.4.1rc2

7 years agobsdgrep: document ignored option -u
Ed Maste [Sun, 19 Feb 2017 17:40:24 +0000 (17:40 +0000)]
bsdgrep: document ignored option -u

MSDOS and Windows GNU grep uses -u to mean "print byte offsets as if
running on an UNIX system." The option has no effect on systems that
do not use CRLF line endings.

PR: 171200
Submitted by: deeptech71@gmail.com, Anders Jensen-Waud
MFC after: 1 month

7 years agoRemove obsolete comment after prior rev.
Warner Losh [Sun, 19 Feb 2017 17:38:17 +0000 (17:38 +0000)]
Remove obsolete comment after prior rev.

7 years agoImport libucl 20170219
Baptiste Daroussin [Sun, 19 Feb 2017 17:37:16 +0000 (17:37 +0000)]
Import libucl 20170219

MFC after: 3 days

7 years agoImport libucl snapshot 20170219
Baptiste Daroussin [Sun, 19 Feb 2017 17:31:53 +0000 (17:31 +0000)]
Import libucl snapshot 20170219

7 years agoRemove dead mentions of CAM target mode APIs from drivers.
Alexander Motin [Sun, 19 Feb 2017 17:27:58 +0000 (17:27 +0000)]
Remove dead mentions of CAM target mode APIs from drivers.

This makes grepping kernel for target mode implementation much easier.

7 years agobsdgrep: fix EOF handling with --mmap
Ed Maste [Sun, 19 Feb 2017 17:23:27 +0000 (17:23 +0000)]
bsdgrep: fix EOF handling with --mmap

Rework part of the loop in grep_fgetln to return the rest of the line
and ensure that we still advance the buffer by the length of the rest
of the line.

PR: 165471
Submitted by: Kyle Evans <kevans91@ksu.edu>
MFC after: 1 month

7 years agoThere are some Linux binaries that expect the system to obey the "addr"
Edward Tomasz Napierala [Sun, 19 Feb 2017 17:17:06 +0000 (17:17 +0000)]
There are some Linux binaries that expect the system to obey the "addr"
parameter to mmap(2), even if MAP_FIXED is not explicitly specified.
Android ART is one example.  Implement bug compatibility for this case
in linuxulator.

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

7 years agoMake savecore(8) output nicer by specifying the maximum field width
Edward Tomasz Napierala [Sun, 19 Feb 2017 16:59:00 +0000 (16:59 +0000)]
Make savecore(8) output nicer by specifying the maximum field width
instead of minimum one (precision instead of width).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoRemove broken remnants of obsolete INOT API.
Alexander Motin [Sun, 19 Feb 2017 16:40:03 +0000 (16:40 +0000)]
Remove broken remnants of obsolete INOT API.

MFC after: 2 weeks

7 years agolocks: make trylock routines check for 'unowned' value
Mateusz Guzik [Sun, 19 Feb 2017 16:28:46 +0000 (16:28 +0000)]
locks: make trylock routines check for 'unowned' value

Since fcmpset can fail without lock contention e.g. on arm, it was possible
to get spurious failures when the caller was expecting the primitive to succeed.

Reported by: mmel

7 years agoMake mdconfig(8) not segfault when the kernel returns garbage data.
Edward Tomasz Napierala [Sun, 19 Feb 2017 16:08:58 +0000 (16:08 +0000)]
Make mdconfig(8) not segfault when the kernel returns garbage data.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoMake sure the thread constructor and destructor eventhandlers are
Hans Petter Selasky [Sun, 19 Feb 2017 13:15:33 +0000 (13:15 +0000)]
Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.

This patch adds a thread construction and destruction call for the
first thread in a procedure.

Tested: dtrace, linux emulation
Reviewed by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement rt_tgsigqueueinfo system call used by glibc for pthread_sigqueue(3).
Dmitry Chagin [Sun, 19 Feb 2017 07:38:11 +0000 (07:38 +0000)]
Implement rt_tgsigqueueinfo system call used by glibc for pthread_sigqueue(3).

MFC after: 2 week

7 years agoMFamd64 r313933: microoptimize pmap_protect_pde().
Konstantin Belousov [Sun, 19 Feb 2017 06:14:33 +0000 (06:14 +0000)]
MFamd64 r313933: microoptimize pmap_protect_pde().

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

7 years agoCapsicum-ize lam(1)
Allan Jude [Sun, 19 Feb 2017 06:02:41 +0000 (06:02 +0000)]
Capsicum-ize lam(1)

lam(1) is used in portsnap(8), so lock it down

Reviewed by: emaste, cem, jonathan
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D8076

7 years agoMissed addition to r313936.
Alexander Motin [Sun, 19 Feb 2017 05:29:06 +0000 (05:29 +0000)]
Missed addition to r313936.

CTIO waitq present only in ISP_TARGET_MODE.

MFC after: 2 weeks

7 years agoMove CTIO waitq from per-LUN to per-channel.
Alexander Motin [Sun, 19 Feb 2017 05:07:02 +0000 (05:07 +0000)]
Move CTIO waitq from per-LUN to per-channel.

All resources lack of which may put CTIO into the queue are either
per-channel or potentially per-queue, but none of them are per-LUN.

This is a first step to fix live LUN disabling.  Before this change
any CTIOs held in a queue in time of disabling were just leaked.

MFC after: 2 weeks

7 years agoRestore PBA setup for igb(4) class devices.
Sean Bruno [Sun, 19 Feb 2017 05:06:29 +0000 (05:06 +0000)]
Restore PBA setup for igb(4) class devices.

Do no write to PBA register on igb(4) devices unless we need
to make adjustments for the 82575 and jumbo frames.

Remove redundant LPE/~LPE assignments.

Move e1000_lv_jumbo_workaround_ich8lan() invokcation into a block
so that its not executed in the igb case.

Move em(4) class assignments of RCTL values to its own code block.

Adjust a few direct accesses of ifp->mtu to use accessor functions.

PR: 216734
Submitted by: Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>

7 years agoFix regression in r313898 on i386.
Konstantin Belousov [Sun, 19 Feb 2017 03:57:41 +0000 (03:57 +0000)]
Fix regression in r313898 on i386.

Use large enough type for calculation of mtrr physmask.  Typical
cpu_maxphyaddr is 36 or larger.

Reported and tested by: sbruno
Sponsored by: The FreeBSD Foundation
MFC after: 13 days

7 years agoMicrooptimize amd64/pmap.c pmap_protect_pde().
Konstantin Belousov [Sun, 19 Feb 2017 03:33:20 +0000 (03:33 +0000)]
Microoptimize amd64/pmap.c pmap_protect_pde().

For the loop that dirties vm_pages in case superpage was written to,
check the complete condition before the loop.

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

7 years agoBring back r313037, with fixes for mips:
Jason A. Harmening [Sun, 19 Feb 2017 02:03:09 +0000 (02:03 +0000)]
Bring back r313037, with fixes for mips:

Implement get_pcpu() for amd64/sparc64/mips/powerpc, and use it to
replace pcpu_find(curcpu) in MI code.

Reviewed by: andreast, kan, lidl
Tested by: lidl(mips, sparc64), andreast(powerpc)
Differential Revision: https://reviews.freebsd.org/D9587

7 years agolocks: clean up trylock primitives
Mateusz Guzik [Sat, 18 Feb 2017 22:06:03 +0000 (22:06 +0000)]
locks: clean up trylock primitives

In particular thius reduces accesses of the lock itself.

7 years agoInclude ${LOCALBASE}/bin in $PATH when running "make checkworld"
Enji Cooper [Sat, 18 Feb 2017 21:47:32 +0000 (21:47 +0000)]
Include ${LOCALBASE}/bin in $PATH when running "make checkworld"

Some of the tests in devel/atf // devel/kyua rely on the tools being in $PATH,
which means that the tests fail when run via "make checkworld" because $PATH
is restricted to exclude directory elements like "${LOCALBASE}/bin".

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoQuote path to doxygen/kyua in test(1) -x check
Enji Cooper [Sat, 18 Feb 2017 21:41:50 +0000 (21:41 +0000)]
Quote path to doxygen/kyua in test(1) -x check

This is a basic stopgap against ${LOCALBASE} containing spaces in it

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAdd new catrigl.c (r313761) APIs to include/complex.h
Mahdi Mokhtari [Sat, 18 Feb 2017 21:08:09 +0000 (21:08 +0000)]
Add new catrigl.c (r313761) APIs to include/complex.h

Reviewed by: bde, emaste
Approved by: bde, emaste (src committers)
Differential Revision: https://reviews.freebsd.org/D9615

7 years agoFor translated packets do not adjust UDP checksum if it is zero.
Andrey V. Elsukov [Sat, 18 Feb 2017 19:53:37 +0000 (19:53 +0000)]
For translated packets do not adjust UDP checksum if it is zero.

In case when decrypted and decapsulated packet is an UDP datagram,
check that its checksum is not zero before doing incremental checksum
adjustment.

Reported by: Eugene Grosbein
Tested by: Eugene Grosbein

7 years agoFix the last case when kldload(8) wasn't printing the name of the module
Gleb Smirnoff [Sat, 18 Feb 2017 18:57:29 +0000 (18:57 +0000)]
Fix the last case when kldload(8) wasn't printing the name of the module
that failed to load.

7 years agoAdd dtb files for Boundary Devices Nitrogen 6 family boards. FreeBSD runs
Ian Lepore [Sat, 18 Feb 2017 18:31:42 +0000 (18:31 +0000)]
Add dtb files for Boundary Devices Nitrogen 6 family boards.  FreeBSD runs
on a nitrogen6x quad 2gb, and is expected to run on all the imx6 boards in
the nitrogen6 family.

7 years agoAdd definitions for the IEEE-1588 registers.
Ian Lepore [Sat, 18 Feb 2017 18:27:28 +0000 (18:27 +0000)]
Add definitions for the IEEE-1588 registers.

7 years agoChange the naming of imx{5,6} gpio pins to exactly match the names used in
Ian Lepore [Sat, 18 Feb 2017 18:24:03 +0000 (18:24 +0000)]
Change the naming of imx{5,6} gpio pins to exactly match the names used in
the chip reference manuals: GPIOn_IOnn.

7 years agoMake fsck(8) default to "ufs", like eg mount(8) does.
Edward Tomasz Napierala [Sat, 18 Feb 2017 11:43:13 +0000 (11:43 +0000)]
Make fsck(8) default to "ufs", like eg mount(8) does.

Approved by: imp
Discussed with: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9621

7 years agoStyle(9), some XXX comments fix. No functional changes.
Dmitry Chagin [Sat, 18 Feb 2017 10:01:17 +0000 (10:01 +0000)]
Style(9), some XXX comments fix. No functional changes.

MFC after: 1 week

7 years agoInitialize cap_rights before use.
Dmitry Chagin [Sat, 18 Feb 2017 09:39:20 +0000 (09:39 +0000)]
Initialize cap_rights before use.

MFC after: 1 week

7 years agoFinich r313684.
Dmitry Chagin [Sat, 18 Feb 2017 07:21:50 +0000 (07:21 +0000)]
Finich r313684.

Convert linux_recv(), linux_send() and linux_accept() system call arguments
to the register_t type too.

PR: 217161
MFC after: 3 days
xMFC with: r313284,r313285,r313684

7 years agoSpell VMXNET3_LEGACY_TX correctly.
Luiz Otavio O Souza [Sat, 18 Feb 2017 06:18:14 +0000 (06:18 +0000)]
Spell VMXNET3_LEGACY_TX correctly.

Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoChange XCOPY memory allocations.
Alexander Motin [Sat, 18 Feb 2017 06:03:16 +0000 (06:03 +0000)]
Change XCOPY memory allocations.

Before this change XCOPY code could allocate memory in chunks up to 16-32MB
(VMware does XCOPY in 4MB chunks by default), that could be difficult for
VM subsystem to do due to KVA fragmentation, that sometimes created huge
allocation delays, blocking any I/O for respective LU for that time.

This change limits allocations down to TPC_MAX_IO_SIZE, which is 1MB now.
1MB is also not a cookie, but ZFS also can do that for large blocks, so
it should be less dramatic.  As drawback this increases CPU overhead, but
it still look acceptable comparing to time consumed by ZFS read/write.

MFC after: 1 week

7 years agoFix panic with unlocked vnode to vrecycle().
Bryan Drewery [Sat, 18 Feb 2017 05:07:53 +0000 (05:07 +0000)]
Fix panic with unlocked vnode to vrecycle().

MFC after: 2 weeks

7 years agomtx: plug the 'opts' argument when not used
Mateusz Guzik [Sat, 18 Feb 2017 01:52:10 +0000 (01:52 +0000)]
mtx: plug the 'opts' argument when not used

7 years agoxdev: Fix after libc++ update in r300873.
Bryan Drewery [Sat, 18 Feb 2017 00:08:13 +0000 (00:08 +0000)]
xdev: Fix after libc++ update in r300873.

The xdev build needed the same fixes as libcompat and external toolchain
support needed for handling of --sysroot, -L, -B, etc.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoiwi, ral, zyd: fix possible use-after-free.
Andriy Voskoboinyk [Fri, 17 Feb 2017 23:20:22 +0000 (23:20 +0000)]
iwi, ral, zyd: fix possible use-after-free.

MFC after: 5 days

7 years agoxdev: Build yacc which is needed for recent libpcap updates.
Bryan Drewery [Fri, 17 Feb 2017 22:51:34 +0000 (22:51 +0000)]
xdev: Build yacc which is needed for recent libpcap updates.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoMETA_MODE+xdev: Don't rebuild build-tools during normal build.
Bryan Drewery [Fri, 17 Feb 2017 22:51:21 +0000 (22:51 +0000)]
META_MODE+xdev: Don't rebuild build-tools during normal build.

See r297997 for more information.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoRely on CPUID feature only to enable attaching. MTRR are architectural
Konstantin Belousov [Fri, 17 Feb 2017 22:50:41 +0000 (22:50 +0000)]
Rely on CPUID feature only to enable attaching. MTRR are architectural
and there is no reason to check cpu family or vendor.

Noted by:   royger
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D9657

7 years agosmp_rendezvous() works for UP case as well, reduce duplicated
Konstantin Belousov [Fri, 17 Feb 2017 22:49:52 +0000 (22:49 +0000)]
smp_rendezvous() works for UP case as well, reduce duplicated
code.  Also fix cast and remove unneeded XXX in comment.

Noted and reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D9657

7 years agosx: fix mips builld after r313855
Mateusz Guzik [Fri, 17 Feb 2017 22:09:55 +0000 (22:09 +0000)]
sx: fix mips builld after r313855

The namespace in this file really needs cleaning up. In the meantime
let inline primitives be defined as long as LOCK_DEBUG is not enabled.

Reported by: kib

7 years agoPush max_frame_len back into iflib so that jumbo frame sizes work.
Sean Bruno [Fri, 17 Feb 2017 21:30:16 +0000 (21:30 +0000)]
Push max_frame_len back into iflib so that jumbo frame sizes work.

Reported by: pho

7 years agoEnable capsicum on MALTA kernels.
Brooks Davis [Fri, 17 Feb 2017 21:25:24 +0000 (21:25 +0000)]
Enable capsicum on MALTA kernels.

This adds less that 10K to the kernel and should probably be done in the
other std.* configs.

7 years agoMerge i386 and amd64 mtrr drivers.
Konstantin Belousov [Fri, 17 Feb 2017 21:08:32 +0000 (21:08 +0000)]
Merge i386 and amd64 mtrr drivers.

Reviewed by: royger, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D9648

7 years agoext2fs: Remove unused assignment.
Pedro F. Giffuni [Fri, 17 Feb 2017 20:56:43 +0000 (20:56 +0000)]
ext2fs: Remove unused assignment.

Value is re-assigned a few lines later without being read.

Found by: Clang static analyzer
MFC after: 1 week