]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoDo not check divider length if we have a div table.
Emmanuel Vadot [Thu, 23 Feb 2017 05:33:20 +0000 (05:33 +0000)]
Do not check divider length if we have a div table.

Reviewed by: mmel

7 years agoActually fix buildworlds other than i386/amd64/sparc64 after r313992
Eric Badger [Thu, 23 Feb 2017 04:26:17 +0000 (04:26 +0000)]
Actually fix buildworlds other than i386/amd64/sparc64 after r313992

Disable offending test for platforms without a userspace visible
breakpoint().

Reported by: rpokala
Approved by: vangyzen (mentor)

7 years agomakefs: eliminate global cd9660 structure
Ed Maste [Thu, 23 Feb 2017 02:28:08 +0000 (02:28 +0000)]
makefs: eliminate global cd9660 structure

For diff reduction with NetBSD

NetBSD file versions:
cd9660.c 1.39
cd9660.h 1.19
cd9660/cd9660_debug.c 1.12
cd9660/cd9660_eltorito.c 1.20
cd9660/cd9660_write.c 1.16
cd9660/iso9660_rrip.c 1.12
cd9660/iso9660_rrip.h 1.6

Reviewed by: ngie
Obtained from: NetBSD
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9627

7 years agoFix a panic during boot caused by inadequate locking of some vt(4) driver
Jonathan T. Looney [Thu, 23 Feb 2017 01:18:47 +0000 (01:18 +0000)]
Fix a panic during boot caused by inadequate locking of some vt(4) driver
data structures.

vt_change_font() calls vtbuf_grow() to change some vt driver data
structures. It uses TF_MUTE to prevent the console from trying to use those
data structures while it changes them.

During the early stage of the boot process, the vt driver's tc_done routine
uses those data structures; however, it is currently called outside the
TF_MUTE check.

Move the tc_done routine inside the locked TF_MUTE check.

PR: 217282
Reviewed by: ed, ray
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9709

7 years agoFully handle the special encoding of GOT[1] on mips64.
John Baldwin [Thu, 23 Feb 2017 00:02:49 +0000 (00:02 +0000)]
Fully handle the special encoding of GOT[1] on mips64.

The MIPS ABI does not require the second GOT entry to be reserved for use
by the runtime linker as on other architectures.  Instead, static linkers
use a special value in the second GOT entry to indicate if the entry is
reserved.  This value is supposed to consist of an address with the MSB
set and the rest of the bits all zero which is an invalid user address.

However, the old binutils currently in the tree uses the 32-bit mask value
(2^31) on 64-bit MIPS instead of 2^63.  This was fixed in upstream
binutils in 2008 to use 2^63 on 64-bit MIPS.

The first part of this change changes the runtime check in init_pltgot()
to check for both values (2^31 and 2^63) when deciding whether to store
the current object pointer in GOT[1] which fixes dynamic N64 binaries
compiled with modern binutils.

However, the initial version of this fix exposed another related bug in
that _rtld_relocate_nonplt_self() was only checking for the new value
(2^63) in GOT[1] and incorrectly treated GOT[1] as a local GOT entry
(and did not relocate the final local GOT entry).  To handle this, fix
all of the places that check for GOT[1]'s status to use the same macro
that checks for both values on N64.

Reviewed by: kan, imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D9708

7 years agoUse LDFLAGS with CC instead of _LDFLAGS.
John Baldwin [Wed, 22 Feb 2017 23:58:54 +0000 (23:58 +0000)]
Use LDFLAGS with CC instead of _LDFLAGS.

This is a followup to r311458.  _LDFLAGS is for use with LD, whereas
LDFLAGS is for use with CC.

7 years agoRemove tests/sys/netinet/fibs_tests's dependency on net/socat
Alan Somers [Wed, 22 Feb 2017 23:57:22 +0000 (23:57 +0000)]
Remove tests/sys/netinet/fibs_tests's dependency on net/socat

Instead of bridging two tap interfaces with socat, just use an epair pair.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agoloader: update symlink support in zfs reader
Toomas Soome [Wed, 22 Feb 2017 22:00:50 +0000 (22:00 +0000)]
loader: update symlink support in zfs reader

As the current zfs file system is providing symlink via system attributes, need
to update the code accordingly.

Note, as the zfsboot code does not free the memory at this time, the
object list will put some stress on the boot2 heap, eventually we should
address the issue.

Reviewed by: allanjude, smh
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9706

7 years agoImprove ipfw rule creation for blacklist-helper script
Kurt Lidl [Wed, 22 Feb 2017 21:50:37 +0000 (21:50 +0000)]
Improve ipfw rule creation for blacklist-helper script

When blocking an address, the blacklist-helper script
needs to do the following things for the ipfw packet
filter:

 - create a table to hold the addresses to be blocked,
   so lookups can be done quickly, and place the address
   to be blocked in that table
 - create rule that does the lookup in the table and
   blocks the packet

The ipfw system allows multiple rules to be inserted for
a given rule number.  There only needs to be one rule
to do the lookup per port.  Modify the script to probe
for the existence of the rule before attempting to create
it, so only one rule is inserted, rather than one rule per
blocked address.

PR: 214980
Reported by: azhegalov (at) gmail.com
Reviewed by: emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9681

7 years agoRemove more stray EISA refernces: ahb was removed. Remove the cross
Warner Losh [Wed, 22 Feb 2017 20:47:25 +0000 (20:47 +0000)]
Remove more stray EISA refernces: ahb was removed. Remove the cross
reference and replace, where appropiate, with ahd.4.

7 years agoConvert magic values into macros in the LinuxKPI scatterlist
Hans Petter Selasky [Wed, 22 Feb 2017 20:24:09 +0000 (20:24 +0000)]
Convert magic values into macros in the LinuxKPI scatterlist
implementation.

Suggested by: cem @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoOptimise unmapped LinuxKPI page allocations.
Hans Petter Selasky [Wed, 22 Feb 2017 19:39:54 +0000 (19:39 +0000)]
Optimise unmapped LinuxKPI page allocations.

When allocating unmapped pages, take advantage of the direct map on
AMD64 to get the virtual address corresponding to a page. Else all
pages allocated must be mapped because sometimes the virtual address
of a page is requested.

Move all page allocation and deallocation code into an own C-file.

Add support for GFP_DMA32, GFP_KERNEL, GFP_ATOMIC and __GFP_ZERO
allocation flags.

Make a clear separation between mapped and unmapped allocations.

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

7 years agoImprove LinuxKPI scatter list support.
Hans Petter Selasky [Wed, 22 Feb 2017 19:31:02 +0000 (19:31 +0000)]
Improve LinuxKPI scatter list support.

The i915kms driver in Linux 4.9 reimplement parts of the scatter list
functions with regards to performance. In other words there is not so
much room for changing structure layouts and functionality if the
i915kms should be built AS-IS. This patch aligns the scatter list
support to what is expected by the i915kms driver. Remove some
comments not needed while at it.

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

7 years agoSurround any unmangled C++ names in libcxxrt's version map with 'extern
Dimitry Andric [Wed, 22 Feb 2017 18:44:57 +0000 (18:44 +0000)]
Surround any unmangled C++ names in libcxxrt's version map with 'extern
"C++"', otherwise ld refuses to make the symbols global in the final
library.  This causes the __int128-related symbols to go missing when
the library is stripped during installation.

Helpful hints: emaste
MFC after: 2 weeks
X-MFC-With: r314061

7 years agodon't use C99 static array indices with older GCC versions
Andriy Gapon [Wed, 22 Feb 2017 17:20:18 +0000 (17:20 +0000)]
don't use C99 static array indices with older GCC versions

For example, the FreeBSD GCC (4.2.1) has a spotty support for that
feature.  If the static keyword is used with an unnamed array parameter
in a function declaration, then the compilation fails with:
error: static or type qualifiers in abstract declarator

The feature does work if the parameter is named.
So, the restriction introduced in this commit can be removed when all
affected function prototypes have the workaround.

MFC after: 1 week
Sponsored by: Panzura

7 years agofix a typo in __STDC_VERSION__ in __min_size requirements
Andriy Gapon [Wed, 22 Feb 2017 17:13:00 +0000 (17:13 +0000)]
fix a typo in __STDC_VERSION__ in __min_size requirements

MFC after: 1 week
Sponsored by: Panzura

7 years agoBetter fix for r314098
Baptiste Daroussin [Wed, 22 Feb 2017 16:37:45 +0000 (16:37 +0000)]
Better fix for r314098

The actual issue was the fact that if - was used then some restriction were
already set to stdin when we were applying caph_limit_stdio which was failing
due to the fact the fd was the fd was already restricted to lower rights.

Restricting stdio before actually opening the files prevent trying to raise the
right and fixes the issue.

And this allows to keep failing the program if restriction failed

Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D9723

7 years agolam(1): Failing to restrict stdin/stdout/stderr should not be fatal
Allan Jude [Wed, 22 Feb 2017 15:30:57 +0000 (15:30 +0000)]
lam(1): Failing to restrict stdin/stdout/stderr should not be fatal

When fed from a pipe, lam(1) would sometimes fail:
lam: unable to limit stdio: Capabilities insufficient

fixed regression in portsnap(8) introduced in r313938

This broke portsnap(8), the app that the capsicumization of lam(1) was
meant to secure.

# portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Tue Feb 21 16:05:39 MSK 2017 to Tue Feb 21 16:59:30 MSK 2017.
Fetching 5 metadata patches.lam: unable to limit stdio: Capabilities insufficient
 done.
Applying metadata patches... done.
Fetching 5 metadata files... lam: unable to limit stdio: Capabilities insufficient
/usr/sbin/portsnap: cannot open 8c94d2c3f8fcea20eb1fd82021566c99c63a010e6b3702ee11e7a491795bcfb8.gz: No such file or directory
metadata is corrupt.

Reported by: Vladimir Zakharov <zakharov.vv@gmail.com>, Ben Woods <woodsb02@gmail.com>

7 years ago- Allow different slicers for different flash types to be registered
Marius Strobl [Wed, 22 Feb 2017 10:21:39 +0000 (10:21 +0000)]
- Allow different slicers for different flash types to be registered
  with geom_flashmap(4) and teach it about MMC for slicing enhanced
  user data area partitions. The FDT slicer still is the default for
  CFI, NAND and SPI flash on FDT-enabled platforms.
- In addition to a device_t, also pass the name of the GEOM provider
  in question to the slicers as a single device may provide more than
  provider.
- Build a geom_flashmap.ko.
- Use MODULE_VERSION() so other modules can depend on geom_flashmap(4).
- Remove redundant/superfluous GEOM routines that either do nothing
  or provide/just call default GEOM (slice) functionality.
- Trim/adjust includes

Submitted by: jhibbits (RouterBoard bits)
Reviewed by: jhibbits

7 years agoxen/timer: mark the Xen PV timer as not safe for suspension
Roger Pau Monné [Wed, 22 Feb 2017 09:22:17 +0000 (09:22 +0000)]
xen/timer: mark the Xen PV timer as not safe for suspension

Note that the timer itself fully supports suspension, but due to the lack of
ordering during the resume process FreeBSD cannot guarantee that the timer is
resumed before any device attempts to use it.

Submitted by: Liuyingdong <liuyingdong@huawei.com>
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D9639

7 years agoSlightly polish isp_dump_atpd().
Alexander Motin [Wed, 22 Feb 2017 07:12:20 +0000 (07:12 +0000)]
Slightly polish isp_dump_atpd().

MFC after: 2 weeks

7 years agoMore fixes for regression in r313898 on i386.
Konstantin Belousov [Wed, 22 Feb 2017 07:07:05 +0000 (07:07 +0000)]
More fixes for regression in r313898 on i386.
Use long long constants where needed.

Reported and tested by: kargl
Sponsored by: The FreeBSD Foundation
MFC after: 10 days

7 years agoFix multiple problems around LUN disable under load.
Alexander Motin [Wed, 22 Feb 2017 06:43:49 +0000 (06:43 +0000)]
Fix multiple problems around LUN disable under load.

 - Move private data about ATIOs/INOTs from per-LUN to per-channel data.
This allows active commands to continue operation after LUN destruction.
This also simplifies lookup of the data by tag in some situations.
 - Unify three restart_queue processing implementations.
 - Complete all ATIOs from restart_queue on LUN disable.
 - Delete ATIO private data when command completed or aborted, not depending
on the ATIO being requeued, that was ugly hack and could never happen.  CAM
should always call ether XPT_CONT_TARGET_IO with status or XPT_ABORT.
 - Implement XPT_ABORT for queued ATIOs/INOTs to allow CAM do graceful
shutdown, not depending on LUN disable, as it is done in ahd(4)/targ(4).
 - Unify isp_endcmd() arguments to make it more usable in generic code.
 - Remove never really used LUN state reference counter.

MFC after: 2 weeks

7 years ago[iwm] Move iwm_dma_contig_alloc/_free functions to if_iwm_util.c.
Adrian Chadd [Wed, 22 Feb 2017 05:11:24 +0000 (05:11 +0000)]
[iwm] Move iwm_dma_contig_alloc/_free functions to if_iwm_util.c.

Obtained from: dragonflybsd.git 83a1185edeede081051a6c00417d4c5a8f5988eb

7 years ago[iwm] Switch 7265D and 3165 devices to 7265D firmware.
Adrian Chadd [Wed, 22 Feb 2017 04:53:33 +0000 (04:53 +0000)]
[iwm] Switch 7265D and 3165 devices to 7265D firmware.

Obtained from: dragonflybsd.git 0cb0a810cb4e04b30937cb4260e779f717a86492

7 years agoadd 7265D firmware mention in the iwmfw manpage.
Adrian Chadd [Wed, 22 Feb 2017 04:51:37 +0000 (04:51 +0000)]
add 7265D firmware mention in the iwmfw manpage.

7 years ago[iwmfw] add 7265D firmware.
Adrian Chadd [Wed, 22 Feb 2017 04:50:52 +0000 (04:50 +0000)]
[iwmfw] add 7265D firmware.

7 years agoadd 7265D firmware.
Adrian Chadd [Wed, 22 Feb 2017 04:44:08 +0000 (04:44 +0000)]
add 7265D firmware.

7 years agoAdd 7265D firmware.
Adrian Chadd [Wed, 22 Feb 2017 04:42:02 +0000 (04:42 +0000)]
Add 7265D firmware.

7 years ago[iwm] Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c
Adrian Chadd [Wed, 22 Feb 2017 04:35:53 +0000 (04:35 +0000)]
[iwm] Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c

* This is more similar to how code/definitions are distributed in
  Linux's iwlwifi.

* This should make recognizing new chipset variants, and adding additional
  flags from the Linux iwlwifi code easier, without blowing up if_iwm.c

Obtained from: dragonflybsd.git 27d11320e707d2c41424efc1983762f6799941d6

7 years agoFix world build for archs where __builtin_debugtrap() does not work.
Eric Badger [Wed, 22 Feb 2017 04:35:07 +0000 (04:35 +0000)]
Fix world build for archs where __builtin_debugtrap() does not work.

The offending code was introduced in r313992.

Reported by: rpokala
Approved by: kib (mentor)

7 years ago[iwm] Simplify device id matching code a bit.
Adrian Chadd [Wed, 22 Feb 2017 04:28:10 +0000 (04:28 +0000)]
[iwm] Simplify device id matching code a bit.

* Just add the struct iwm_cfg pointers to the iwm_devices array, to get
  rid of the large switch clause.

Obtained from: dragonflybsd.git 35f0e6c86c1654323d6b19f7a077f4ab8ac85868

7 years ago[iwm] Remove OpenBSD-specific comment. Beautify pci cfg space accesses.
Adrian Chadd [Wed, 22 Feb 2017 04:27:07 +0000 (04:27 +0000)]
[iwm] Remove OpenBSD-specific comment. Beautify pci cfg space accesses.

Obtained from: dragonflybsd.git 710fdd011c30a1bd9f53b87c843fb8907c4a6cfd

7 years agoRevert to this driver's historic behavior: assume an sd card is writable
Ian Lepore [Wed, 22 Feb 2017 03:49:46 +0000 (03:49 +0000)]
Revert to this driver's historic behavior: assume an sd card is writable
if the fdt data doesn't provide a gpio pin for reading the write protect
switch and also doesn't contain a "wp-disable" property.

In r311735 the long-bitrotted code in this driver for using the non-
standard fdt "mmchs-wp-gpio-pin" property was replaced with new common
support code for handling write-protect and card-detect gpio pins.  The
old code never found a property with that name, and the logic was to
assume that no gpio pin meant that the card was not write protected.

The new common code behaves differently.  If there is no fdt data saying
what to do about sensing write protect, the value in the standard SDHCI
PRESENT_STATE register is used.  On this hardware, if there is no signal
for write protect muxed into the sd controller then that bit in the
register indicates write protect.

The real problem here is the fdt data, which should contain "wp-disable"
properties for eMMC and micro-sd slots where write protect is not even
an option in the hardware, but we are not in control of that data, it
comes from linux.  So we have to make the same flawed assumption in our
driver that the corresponding linux driver has: no info means no protect.

Reported by: several users on the arm@ list
Pointy hat: me, for not testing enough before committing r311735

7 years ago[iwm] Fix typo in commit a7697ea01c11fd493aec52260a02f31df680eb91.
Adrian Chadd [Wed, 22 Feb 2017 02:51:30 +0000 (02:51 +0000)]
[iwm] Fix typo in commit a7697ea01c11fd493aec52260a02f31df680eb91.

* The sc->sc_uc.uc_error_event_table value is now at sc->error_event_table,
  and not sc->umac_error_event_table.

Obtained from: dragonflybsd.git 612855b1a8c321ec9ba34f63edf913e7ecff8363

7 years ago[iwm] Get rid of unneeded IWM_FWDMASEGSZ and IWM_FWMAXSIZE constants
Adrian Chadd [Wed, 22 Feb 2017 02:49:57 +0000 (02:49 +0000)]
[iwm] Get rid of unneeded IWM_FWDMASEGSZ and IWM_FWMAXSIZE constants

* We only need IWM_FH_MEM_TB_MAX_LENGTH bytes for the fw_dma memory.

Obtained from: dragonflybsd.git f414b8da30816705e32573cc58097cacac34f161

7 years agosys: Replace zero with NULL for pointers.
Pedro F. Giffuni [Wed, 22 Feb 2017 02:35:59 +0000 (02:35 +0000)]
sys: Replace zero with NULL for pointers.

Found with: devel/coccinelle
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D9694

7 years ago[iwm] With the previous commits, this DELAY no longer seems to be needed.
Adrian Chadd [Wed, 22 Feb 2017 02:24:42 +0000 (02:24 +0000)]
[iwm] With the previous commits, this DELAY no longer seems to be needed.

Obtained from: dragonflybsd.git 516272d3d02c821ace16a91cfdeb28540ac74ecc

7 years ago[iwm] Sync IWM_MVM_ALIVE waiting and start_fw handling with iwlwifi.
Adrian Chadd [Wed, 22 Feb 2017 02:23:14 +0000 (02:23 +0000)]
[iwm] Sync IWM_MVM_ALIVE waiting and start_fw handling with iwlwifi.

* Use the notification wait API, like it's done in the Linux iwlwifi code,
  to wait for the IWM_MVM_ALIVE notification.

* This also should fix some firmware load interrupt issues, and errors
  in the nic lock using.

Tested:

* (adrian) Intel 7260, STA mode

Obtained from: dragonflybsd.git a7697ea01c11fd493aec52260a02f31df680eb91

7 years ago[iwm] Synchronize firmware loading code with Linux iwlwifi.
Adrian Chadd [Wed, 22 Feb 2017 02:18:04 +0000 (02:18 +0000)]
[iwm] Synchronize firmware loading code with Linux iwlwifi.

* While there, rename some functions to match the names and functionality
  of the similarly named functions in Linux iwlwifi.

Obtained from: dragonflybsd.git e98ee77a816bfd8b4912047b93dfb2c560788f24

7 years agoRemove a variable that has been unused since r311735 (it should have been
Ian Lepore [Wed, 22 Feb 2017 01:07:04 +0000 (01:07 +0000)]
Remove a variable that has been unused since r311735 (it should have been
removed as part of those changes).

7 years agoadd bus_dmamap_unload in ql_free_dmabuf()
David C Somayajulu [Tue, 21 Feb 2017 23:32:27 +0000 (23:32 +0000)]
add bus_dmamap_unload in ql_free_dmabuf()

MFC after:5 days

7 years agoAdd __int128-related symbols to libcxxrt's version map. Put these into
Dimitry Andric [Tue, 21 Feb 2017 21:48:45 +0000 (21:48 +0000)]
Add __int128-related symbols to libcxxrt's version map.  Put these into
the same CXXABI verions as recent libstdc++.

Note that __int128 types are only available on arches where long long is
128 bit wide.

Noticed by: harti
MFC after: 2 weeks

7 years agoFix typos in bootverbose printfs... display the write-protect pin info,
Ian Lepore [Tue, 21 Feb 2017 21:21:58 +0000 (21:21 +0000)]
Fix typos in bootverbose printfs... display the write-protect pin info,
not the card-detect pin info.

7 years agozfs: move zio_taskq_basedc under SYSDC
Andriy Gapon [Tue, 21 Feb 2017 21:11:58 +0000 (21:11 +0000)]
zfs: move zio_taskq_basedc under SYSDC

That knob is useless without SDC (or alike) scheduling class support.
That is, it's unused on FreeBSD.

MFC after: 4 days

7 years agozfs: lower priority of zio_write_issue threads by four
Andriy Gapon [Tue, 21 Feb 2017 21:09:21 +0000 (21:09 +0000)]
zfs: lower priority of zio_write_issue threads by four

The difference of one was insignificant because zio_write_issue threads
ended up on the same run queues as other zio threads.
See sys/priority.h and sys/runq.h for more details.

Add a comment describing FreeBSD priority considerations and restore
the illumos variant of the code for comparison.

Obtained from: Panzura
MFC after: 2 weeks
Sponsored by: Panzura

7 years agoddb show pte: use pmap of kdb_thread
Mark Johnston [Tue, 21 Feb 2017 21:06:12 +0000 (21:06 +0000)]
ddb show pte: use pmap of kdb_thread

show pte from the pmap of the process of the current DDB thread, instead
of necessarily the PCPU pmap.

Submitted by: Ryan Libby <rlibby@gmail.com>
Reviewed by: kib
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D9645

7 years agoImprove pjdfstest run instructions
Alan Somers [Tue, 21 Feb 2017 21:01:01 +0000 (21:01 +0000)]
Improve pjdfstest run instructions

In the Kyua era, it's no longer necessary to set PJDFSTEST_TEST_PATH.  Just
use TMPDIR instead.

Reviewed by: ngie
MFC after: 3 weeks
Relnotes: yes
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9340

7 years agoMake several improvements and corrections in the kenv(2) man page
Eric van Gyzen [Tue, 21 Feb 2017 19:51:41 +0000 (19:51 +0000)]
Make several improvements and corrections in the kenv(2) man page

MFC after: 3 days
Sponsored by: Dell EMC

7 years agoExclude -flto when building *genassym.o
Ed Maste [Tue, 21 Feb 2017 18:59:17 +0000 (18:59 +0000)]
Exclude -flto when building *genassym.o

The build process generates *assym.h using nm from *genassym.o (which is
in turn created from *genassym.c).

When compiling with link-time optimization (LTO) using -flto, .o files
are LLVM bitcode, not ELF objects. This is not usable by genassym.sh,
so remove -flto from those ${CC} invocations.

Submitted by: George Rimar
Reviewed by: dim
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9659

7 years agoMake the code match the comments: If we have ANY buf's that failed
Warner Losh [Tue, 21 Feb 2017 18:56:06 +0000 (18:56 +0000)]
Make the code match the comments: If we have ANY buf's that failed
then return EAGAIN. The current code just returns that if the LAST buf
failed.

Reviewed by: kib@, trasz@
Differential Revision: https://reviews.freebsd.org/D9677

7 years agoDocument what the different flags mean for locking.
Warner Losh [Tue, 21 Feb 2017 18:49:51 +0000 (18:49 +0000)]
Document what the different flags mean for locking.

7 years agoDocument why cat is a bootstrap tool.
Warner Losh [Tue, 21 Feb 2017 18:49:30 +0000 (18:49 +0000)]
Document why cat is a bootstrap tool.

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