]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFC r317606:
kib [Sun, 7 May 2017 07:51:36 +0000 (07:51 +0000)]
MFC r317606:
Style.

7 years agoMFC r317346:
pfg [Sun, 7 May 2017 01:31:42 +0000 (01:31 +0000)]
MFC r317346:
regex: unsign and constify some variables.

Taking some hints from the regex variant in nvi(1) and higher-level
compiler warnings, update some types in our regex(3) implementation.

Joint work with: Kyle Evans

7 years agoMFC r317036:
pfg [Sun, 7 May 2017 01:28:52 +0000 (01:28 +0000)]
MFC r317036:
libjail: make allocation in jailparam_all() somewhat more robust.

Unsign some variables involved in allocation as they will never be
negative anyways. Provide some bounds checking through reallocarray(3).

This is all very unlikely to have any visible effect.

Reviewed by: jamie

7 years agoMFC r317340: Report NTB link speed to console and interface.
mav [Sun, 7 May 2017 00:26:57 +0000 (00:26 +0000)]
MFC r317340: Report NTB link speed to console and interface.

7 years agoMFC r317751:
dim [Sat, 6 May 2017 11:18:36 +0000 (11:18 +0000)]
MFC r317751:

Pull in r301983 from upstream llvm trunk (by Tim Northover):

  ARM: avoid handing a deleted node back to TableGen during ISel.

  When we replaced the multiplicand the destination node might already
  exist. When that happens the original gets CSEd and deleted. However,
  it's actually used as the offset so nonsense is produced.

  Should fix PR32726.

This fixes an assertion failure when building building www/firefox 53.0
for arm.

Reported by: Bob Prohaska
PR: 218782

7 years agoMFC r317458:
dim [Sat, 6 May 2017 11:13:33 +0000 (11:13 +0000)]
MFC r317458:

Pull in r294458 from upstream llvm trunk (by Sanne Wouda):

  [Assembler] Enable nicer diagnostics for inline assembly.

  Fixed test.

  Summary:
  Enables source location in diagnostic messages from the backend.
  This is after parsing, during finalization.  This requires the
  SourceMgr, the inline assembly string buffer, and DiagInfo to still
  be alive after EmitInlineAsm returns.

  This patch creates a single SourceMgr for inline assembly inside the
  AsmPrinter.  MCContext gets a pointer to this SourceMgr.  Using one
  SourceMgr per call to EmitInlineAsm would make it difficult for
  MCContext to figure out in which SourceMgr the SMLoc is located,
  while a single SourceMgr can figure it out if it has multiple
  buffers.

  The Str argument to EmitInlineAsm is copied into a buffer and owned
  by the inline asm SourceMgr.  This ensures that DiagHandlers won't
  print garbage.  (Clang emits a "note: instantiated into assembly
  here", which refers to this string.)

  The AsmParser gets destroyed before finalization, which means that
  the DiagHandlers the AsmParser installs into the SourceMgr will be
  stale.  Restore the saved DiagHandlers.

  Since now we're using just one SourceMgr for multiple inline asm
  strings, we need to tell the AsmParser which buffer it needs to parse
  currently.  Hand a buffer id -- returned from SourceMgr::
  AddNewSourceBuffer -- to the AsmParser.

  Reviewers: rnk, grosbach, compnerd, rengolin, rovka, anemet

  Reviewed By: rnk

  Subscribers: llvm-commits

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

This improves error reporting for some inline assembly constructs that
clang does not approve of: instead of crashing with a "fatal backend
error", it will now show a normal error message, and point out the
location of the problematic assembly.

Reported by: mmel

7 years agoMFC r317284:
pfg [Sat, 6 May 2017 02:43:26 +0000 (02:43 +0000)]
MFC r317284:
pmcstat(8); unsign some allocation variables and use reallocarray(3).

Use unsigned values in some internal variables that will be used during
allocation. The variables are used in reduced scope and have no chance of
becoming negative.

Provide bounds checking through reallocarray(3).

7 years agoMFC r317283:
pfg [Sat, 6 May 2017 02:39:11 +0000 (02:39 +0000)]
MFC r317283:
fsck_ffs: Unsign some variables and make use of reallocarray(3).

Instead of casting listmax and numdirs to unsigned values just define
them as unsigned and avoid the casts. Use reallocarray(3).

While here, fs_ncg is already unsigned so the cast is unnecessary.

Reviewed by: mckusick

7 years agoMFC r317247: Dump md_iterations as signed, which it really is.
mav [Sat, 6 May 2017 00:51:25 +0000 (00:51 +0000)]
MFC r317247: Dump md_iterations as signed, which it really is.

PR: 208305
PR: 196834

7 years agoMFC r317246: Always allow setting number of iterations for the first time.
mav [Sat, 6 May 2017 00:50:24 +0000 (00:50 +0000)]
MFC r317246: Always allow setting number of iterations for the first time.

Before this change it was impossible to set number of PKCS#5v2 iterations,
required to set passphrase, if it has two keys and never had any passphrase.
Due to present metadata format limitations there are still cases when number
of iterations can not be changed, but now it works in cases when it can.

PR: 218512
Sponsored by: iXsystems, Inc.

7 years agoMFC r316945-r316946
asomers [Fri, 5 May 2017 21:59:34 +0000 (21:59 +0000)]
MFC r316945-r316946

r316945:
Add 410.status-mfi, a periodic script for mfi(4) arrays

PR: 176049
Submitted by: doconnor@gsoft.com.au
Reviewed by: scottl, Larry Rosenman <ler@lerctr.org>
Relnotes: yes

r316946:
Reorder Makefile entries from r316945

PR: 176049
Reported by: Oliver Pinter
X-MFC-With: 316945

7 years agoMFC r316856:
asomers [Fri, 5 May 2017 21:57:26 +0000 (21:57 +0000)]
MFC r316856:

MFV 316855

7900 zdb shouldn't print the path of a znode at verbosity < 5

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alan Somers <asomers@freebsd.org>

illumos/illumos-gate@e548d2fa41d1baa06662ed9abbb8bcec86e27dd9
https://www.illumos.org/issues/7900

Sponsored by: Spectra Logic Corp

7 years agoMFC r307769: daemon: Allow logging daemon stdout/stderr to file or syslog.
jilles [Fri, 5 May 2017 21:52:14 +0000 (21:52 +0000)]
MFC r307769: daemon: Allow logging daemon stdout/stderr to file or syslog.

There are various new options, documented in the man page, to send the
daemon's standard output and/or standard error to a file or to syslog.

Relnotes: yes

7 years agoMFC r317680:
ken [Fri, 5 May 2017 20:21:13 +0000 (20:21 +0000)]
MFC r317680:

  Add the SCSI SSC Manufacturer assigned serial number VPD page.

  This is current as of SSC-5r03.

Submitted by: Sam Klopsch
Sponsored by: Spectra Logic

7 years agoMFC r316760:
asomers [Fri, 5 May 2017 16:19:54 +0000 (16:19 +0000)]
MFC r316760:

Fix vdev_geom_attach_by_guids for partitioned disks

When opening a vdev whose path is unknown, vdev_geom must find a geom
provider with a label whose guids match the desired vdev. However, due to
partitioning, it is possible that two non-synonomous providers will share
some labels. For example, if the first partition starts at the beginning of
the drive, then ada0 and ada0p1 will share the first label. More troubling,
if the last partition runs to the end of the drive, then ada0p3 and ada0
will share the last label. If vdev_geom opens ada0 when it should've opened
ada0p3, then the pool won't be readable. If it opens ada0 when it should've
opened ada0p1, then it will corrupt some other partition when it writes the
3rd and 4th labels.

The easiest way to reproduce this problem is to install a mirrored root pool
with the default partition layout, then swap the positions of the two boot
drives and reboot.  Whether the bug manifests depends on the order in which
geom lists its providers, which is arbitrary.

Fix this situation by modifying the search algorithm to prefer geom
providers that have all four labels intact. If no such provider exists, then
open whichever provider has the most.

Reviewed by: mav
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10365

7 years agoMFC r317566:
brooks [Fri, 5 May 2017 15:15:41 +0000 (15:15 +0000)]
MFC r317566:

Don't pass size_t arguments to setsockopt(SO_SNDBUF/SO_RCVBUF).

These commands take an int. The tests work by accident on little-endian,
64-bit systems.

PR: 218919
Tested with: qemu-cheri and CheriBSD built for mips64
Reviewed by: asomers, ngie
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

7 years agoMFC r317568:
hselasky [Fri, 5 May 2017 13:21:11 +0000 (13:21 +0000)]
MFC r317568:

Improve sysadmin visibility of physical port error counters in the
mlx5en driver.

Sponsored by: Mellanox Technologies

7 years agoMFC 317821
sephe [Fri, 5 May 2017 03:38:41 +0000 (03:38 +0000)]
MFC 317821
    hyperv/kbd: Channel read expects non-NULL channel argument.

    Sponsored by:   Microsoft

7 years agoMFC r317200, r317201, r317216:
pfg [Thu, 4 May 2017 15:00:09 +0000 (15:00 +0000)]
MFC r317200, r317201, r317216:
libthread_db: unsign map_len and use reallocarray(3).

Lengths are not negative, so map_len should be unsigned. Unsign the
corresponding indexes too and bring a small use of reallocarray(3).

Reorder the memset to be consistent with the reallocarray.

7 years agoMFC r317596:
pfg [Thu, 4 May 2017 14:54:22 +0000 (14:54 +0000)]
MFC r317596:
mixer(8): Prevent possible sscanf() overflow.

Fix %s buffer sizes in sscanf().

Obtained from: DragonflyBSD (git dab952e2)

7 years agoMFC r317583:
pfg [Thu, 4 May 2017 14:48:57 +0000 (14:48 +0000)]
MFC r317583:
Fix some cases where an index was used before its limits check.

Obtained from: DragonFlyBSD (git 799ba435)

7 years agoMFC r317657:
ken [Thu, 4 May 2017 14:20:52 +0000 (14:20 +0000)]
MFC r317657:

  Fix camcontrol timestamp setting and update the man page.

  camcontrol timestamp -s would somtimes fail due to stack garbage.  Zero out
  the timestamp parameters to fix it.

  Fix another nearby bug, and update the man page.

  sbin/camcontrol/timestamp.c:
   In set_timestamp(), bzero ts_p prior to creating the timestamp.
   Previously stack garbage could cause some tape drives to reject the
   timestamp.

   In set_timestamp(), check for failures from strptime().

  sbin/camcontrol/camcontrol.8:
   Add the time argument to the -T option to camcontrol timestamp -s
   in the long description.

   Change the time/date format used in the camcontrol timestamp
   example to RFC 2822 format.  This fixes a time zone issue with the
   original example by specifying the time zone as -0600.  Otherwise,
   the time zone seems to default to standard time in the current
   locale, which makes the time, when reported back from the drive,
   1 hour off from the intended setting.  This also fixes a duplicate
   day of the week ("Wednesday Wed") in the previous example.

Submitted by: Sam Klopsch
Sponsored by: Spectra Logic

7 years agoMFC r317148:
markj [Wed, 3 May 2017 23:41:09 +0000 (23:41 +0000)]
MFC r317148:
Drop Giant before sleeping in linux_wait_for_{timeout_,}common().

7 years agoMFC r317436:
kib [Wed, 3 May 2017 09:52:11 +0000 (09:52 +0000)]
MFC r317436:
getpagesize(3) cannot fail.

7 years agoMFC r317431:
ae [Wed, 3 May 2017 09:25:26 +0000 (09:25 +0000)]
MFC r317431:
  Fix SP refcount leak.

  PCB SP cache acquires extra reference, when SP is stored in the cache.
  Release this reference when PCB is destroyed in ipsec_delete_pcbpolicy().
  In ipsec_copy_pcbpolicy() release reference to SP in case if sp_in or
  sp_out are not NULL.

  Reported by: Slawa Olhovchenkov <slw at zxy spb ru>

7 years agoMFC r316685: libelf: add an assert that msz is non-zero
emaste [Wed, 3 May 2017 02:37:44 +0000 (02:37 +0000)]
MFC r316685: libelf: add an assert that msz is non-zero

Reported by: Coverity
CID: 976023
Sponsored by: The FreeBSD Foundation

7 years agoMFC r313411 (jhibbits): Add elf*-powerpc-freebsd targets
emaste [Wed, 3 May 2017 02:30:58 +0000 (02:30 +0000)]
MFC r313411 (jhibbits): Add elf*-powerpc-freebsd targets

to the elftoolchain target list

FreeBSD uses the full target triple when generating embedded rootfs images
(MFS_IMAGE= make option).  Without this change objcopy errors out with:

objcopy: elf64-poewrpc-freebsd: invalid target name

7 years agoMFC r307808: elfcopy: select mode by the end of the program name
emaste [Wed, 3 May 2017 02:25:11 +0000 (02:25 +0000)]
MFC r307808: elfcopy: select mode by the end of the program name

The mode of operation (elfcopy, mcs, or strip) is chosen based on the
program name.  Broaden this to allow a substring match at the end of the
name to allow prefixes - for example, bsdstrip or aarch64-freebsd-strip.

This improves use of these tools as drop-in replacements for GNU objcopy
and strip, which are often built with a limited set of supported targets
and installed with a target prefix for cross tools.

7 years agoMFC r309679 (cem): readelf -S: Include zero index and match binutils' no-name
emaste [Wed, 3 May 2017 02:19:45 +0000 (02:19 +0000)]
MFC r309679 (cem): readelf -S: Include zero index and match binutils' no-name

Include the SHN_UNDEF (zero) index special section in extended-attribute
ELF files, like GNU binutils' readelf.

Additionally, print "<no-name>" for sections without names, like GNU
binutils.

7 years agoMFC r309547 (cem): readelf: Add support for extended program header numbers
emaste [Wed, 3 May 2017 02:12:45 +0000 (02:12 +0000)]
MFC r309547 (cem): readelf: Add support for extended program header numbers

Add support for extended program header numbers to elftoolchain
'readelf -h'.

7 years agoMFC r312779: strings: avoid unnecessary trip through handle_file for stdin
emaste [Wed, 3 May 2017 02:04:38 +0000 (02:04 +0000)]
MFC r312779: strings: avoid unnecessary trip through handle_file for stdin

Sponsored by: The FreeBSD Foundation

7 years agoMFC libelf: Fix extended numbering
emaste [Wed, 3 May 2017 01:57:06 +0000 (01:57 +0000)]
MFC libelf: Fix extended numbering

r310136 (cem): libelf: Fix extended numbering detection

Extended numbering is used for any of these fields overflowing.

r310137 (cem): gelf_getphdr: Allow extended indices

Needed for 'readelf -l' of extended phnum files.  (Parity with GNU
binutils.)

7 years agoMFC r317141: readelf: dump MIPS abiflags section
emaste [Wed, 3 May 2017 01:06:56 +0000 (01:06 +0000)]
MFC r317141: readelf: dump MIPS abiflags section

This is not fully fleshed out but is sufficient to dump the
SHT_MIPS_ABIFLAGS used in FreeBSD.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r317279: Remove unneeded conditions.
mav [Tue, 2 May 2017 19:30:42 +0000 (19:30 +0000)]
MFC r317279: Remove unneeded conditions.

7 years agoMFC r317253: Add interface reference counting to if_lagg.
mav [Tue, 2 May 2017 19:30:05 +0000 (19:30 +0000)]
MFC r317253: Add interface reference counting to if_lagg.

Using plain ifunit() looks like request for troubles.

7 years agoMFC r312979 (by loos):
mav [Tue, 2 May 2017 19:29:31 +0000 (19:29 +0000)]
MFC r312979 (by loos):
Do not update the lagg link layer address when destroying a lagg clone.

This would enqueue an event to send the gratuitous arp on a dying lagg
interface without any physical ports attached to it.

Apart from that, the taskqueue_drain() on lagg_clone_destroy() runs too
late, when the ifp data structure is already freed.  Fix that too.

7 years agoMFC r317080: Block FPDMA TRIM for ASMedia HBAs.
mav [Tue, 2 May 2017 06:27:46 +0000 (06:27 +0000)]
MFC r317080: Block FPDMA TRIM for ASMedia HBAs.

Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the
same SSDs working fine on Intel HBAs.

7 years agohyperv/hn: Enable sorted LRO (direct commit).
sephe [Tue, 2 May 2017 01:30:46 +0000 (01:30 +0000)]
hyperv/hn: Enable sorted LRO (direct commit).

This is a direct commit.  Sorted LRO is much better than plain
(linked list LRO), which hash LRO is not available on this
branch.

Sponsored by: Microsoft

7 years agoPartial, manual MFC of r317411:
brooks [Mon, 1 May 2017 17:10:43 +0000 (17:10 +0000)]
Partial, manual MFC of r317411:

Remove directory made empty by IEEE488 removal.

7 years agoMFC r317388:
brooks [Mon, 1 May 2017 17:02:51 +0000 (17:02 +0000)]
MFC r317388:

Use the approved syntax to build no man pages.

Sponsored by: DARPA, AFRL

7 years agoMFC r317385:
brooks [Mon, 1 May 2017 16:59:54 +0000 (16:59 +0000)]
MFC r317385:

Clean up Makefile.

Prefer SRCTOP vs .CURDIR relative paths.

Find libnetbsd using LIBADD infrastructure rather than manual hackery.

Reviewed by: ngie, bapt
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

7 years agoMFC r317034:
bapt [Mon, 1 May 2017 12:42:06 +0000 (12:42 +0000)]
MFC r317034:

Fix strcoll_l disagreeing with strxfrm by reworking the forward order case in
wcscoll_l().

Illumos fixed this while grabbing back our patches:
https://www.illumos.org/rb/r/402/

This does not 100% fix what postgresql folks reported as there is still a
remaining issue: https://www.illumos.org/issues/7962, it improves the situation

The initial issue was reported in postgresql mailing lists:
https://www.postgresql.org/message-id/flat/111D0E27-A8F3-4A84-A4E0-B0FB703863DF@s24.com#111D0E27-A8F3-4A84-A4E0-B0FB703863DF@s24.com

Submitted by: Yuri Pankov <yuri.pankov@nexenta.com>
Obtained from: Illumos

7 years agoMFC r302920
bapt [Mon, 1 May 2017 12:41:10 +0000 (12:41 +0000)]
MFC r302920

Add a regression test to make sure the Russian collation is actually working

when importing collation support from Dragonfly/Illumos amdmi3@ tested the
collation branch and reported an issue with Russian collation. John Marino fixed
the issue in Dragonfly and I merged it back to FreeBSD.

Now that Illumos is working on merging our fixes they (Lauri Tirkkonen) found
issues with the commit that fixes the russian collation in UTF-8 that resulted
in a crash with strxfrm(3) and the ISO-8859-5 locale (fixed in FreeBSD r302916).
This small test was written to ensure we do not bring back the old issue with
russian collation while fixing the other issue.

7 years agoMFC r316426:
dchagin [Mon, 1 May 2017 06:42:39 +0000 (06:42 +0000)]
MFC r316426:

Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() with
the proper handling of the TIMER_ABSTIME flag.

7 years agoMFC r317356: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.
mav [Mon, 1 May 2017 06:04:34 +0000 (06:04 +0000)]
MFC r317356: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.

7 years agoMFC r317064: Optimize pathologic case of telldir() for Samba.
mav [Mon, 1 May 2017 06:03:07 +0000 (06:03 +0000)]
MFC r317064: Optimize pathologic case of telldir() for Samba.

When application reads large directory, calling telldir() for each entry,
like Samba does, it creates exponential performance drop as number of
entries reach tenths to hundreds of thousands.  It is caused by full search
through the internal list, that never finds matches in that scenario, but
creates O(n^2) delays.  This patch optimizes that search, limiting it to
entries of the same buffer, turning time closer to O(n) in case of linear
directory scan.

7 years agoMFC r317075: Update ELF Tool Chain to upstream r3520
emaste [Mon, 1 May 2017 01:52:03 +0000 (01:52 +0000)]
MFC r317075: Update ELF Tool Chain to upstream r3520

Highlights of changes between r3490 and r3520:

- Improve C++ demangling
- Improve compatibility with Binutils tools wrt. error messages
- Handle additional types/sections/etc. in readelf and elfdump
- addr2line, cxxfilt: use setvbuf to set line buffering for filter use

Also MFC r317076, version bump.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r316430
vangyzen [Mon, 1 May 2017 01:40:24 +0000 (01:40 +0000)]
MFC r316430

Fix indentation in dd(1)

Quoting http://mdocml.bsd.lv/mdoc/details/width.html

Do not use macros in the argument specifying the width,
since that's not portable.  While GNU troff can handle it,
mandoc cannot.

Sponsored by: Dell EMC

7 years agoMFC r315526
vangyzen [Mon, 1 May 2017 01:36:54 +0000 (01:36 +0000)]
MFC r315526

Add clock_nanosleep()

Add a clock_nanosleep() syscall, as specified by POSIX.
Make nanosleep() a wrapper around it.

Attach the clock_nanosleep test from NetBSD. Adjust it for the
FreeBSD behavior of updating rmtp only when interrupted by a signal.
I believe this to be POSIX-compliant, since POSIX mentions the rmtp
parameter only in the paragraph about EINTR. This is also what
Linux does. (NetBSD updates rmtp unconditionally.)

Copy the whole nanosleep.2 man page from NetBSD because it is complete
and closely resembles the POSIX description. Edit, polish, and reword it
a bit, being sure to keep any relevant text from the FreeBSD page.

Regenerate syscall files.

Relnotes: yes
Sponsored by: Dell EMC

7 years agoMFC r317372:
pfg [Mon, 1 May 2017 00:42:31 +0000 (00:42 +0000)]
MFC r317372:
scandir(3): promote arraysz to size_t to match numitems.

The internal array size goes through a loop and is compared with numitems
which at its limits makes can be unreachably higher than arraysz.
Prevent an hypothetical overflow, and signed/unsigned comparison, by
matching the types.

7 years agoMFC r316749 (by cem):
markj [Sun, 30 Apr 2017 18:39:31 +0000 (18:39 +0000)]
MFC r316749 (by cem):
drm2: Add some missing PCIIDs for some Haswell systems

PR: 218969

7 years agoMFC r310889 (by jkim):
dim [Sun, 30 Apr 2017 13:25:10 +0000 (13:25 +0000)]
MFC r310889 (by jkim):

Do not remove llvm-objdump.  It is installed by default since r310840.

MFC r311311 (by jkim):

Remove llvm-objdump when Clang is disabled.  It was missed in r310889.

Submitted by: dim

7 years agoMFC r317324:
dchagin [Sun, 30 Apr 2017 06:15:56 +0000 (06:15 +0000)]
MFC r317324:

Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.

7 years agoMFC r317323:
dchagin [Sun, 30 Apr 2017 06:14:57 +0000 (06:14 +0000)]
MFC r317323:

Add Evdev ioctl handler to the Linuxulator.

PR: 218627

7 years agoMFC r317214:
dim [Sat, 29 Apr 2017 23:26:36 +0000 (23:26 +0000)]
MFC r317214:

Turn off llvm/clang's ENABLE_BACKTRACES setting, since it never worked
properly anyway.  (Upstream has reorganized this somewhat in the mean
time, but for proper backtraces we would need llvm-symbolizer in base.)

MFC r317215:

Add function and data sections when building llvm, clang, lld and lldb,
and allow the linker to garbage collect them.  This shaves off up to a
few MB from the final executables.

7 years agoMFC r316776 (by cem@):
dchagin [Sat, 29 Apr 2017 09:26:30 +0000 (09:26 +0000)]
MFC r316776 (by cem@):

linux_ioctl: Refactor some v4l2 struct converters

According to the C standard, it is invalid to copy beyond the end of an
object, even if that object is obviously a member of a larger object (a
struct, in this case).

Appease the standard and Coverity by refactoring the copy in a
straightforward way.  No functional change.

7 years agoMFC r316289:
dchagin [Sat, 29 Apr 2017 09:21:00 +0000 (09:21 +0000)]
MFC r316289:

Use kern_mincore() helper instead of abusing syscall entry.

7 years agoMFC r316288:
dchagin [Sat, 29 Apr 2017 09:20:04 +0000 (09:20 +0000)]
MFC r316288:

Add kern_mincore() helper for mincore() syscall.

7 years agoMFC r315957:
dchagin [Sat, 29 Apr 2017 09:18:55 +0000 (09:18 +0000)]
MFC r315957:

Implement Linux mincore() system call.
This is necessary for the upcoming drm-next.

7 years agoMerge r317444, r317445:
glebius [Sat, 29 Apr 2017 02:03:20 +0000 (02:03 +0000)]
Merge r317444, r317445:

  UMA_ZONE_REFCNT was removed.

PR: 209715
PR: 218887

7 years agoMFC: r316829
rmacklem [Sat, 29 Apr 2017 00:46:51 +0000 (00:46 +0000)]
MFC: r316829
Remove unused "cred" argument to ncl_flush().

The "cred" argument of ncl_flush() is unused and it was confusing to have
the code passing in NULL for this argument in some cases. This patch deletes
this argument.
There is no semantic change because of this patch.

7 years agoMFC r316794:
bdrewery [Fri, 28 Apr 2017 17:57:07 +0000 (17:57 +0000)]
MFC r316794:

  Cache compiler metadata and reuse it at installworld time.

7 years agoMFC r316780:
bdrewery [Fri, 28 Apr 2017 17:56:09 +0000 (17:56 +0000)]
MFC r316780:

  Pass COMPILER_FEATURES down to submakes for installworld.

7 years agoMFC r316690:
bdrewery [Fri, 28 Apr 2017 17:55:27 +0000 (17:55 +0000)]
MFC r316690:

  Fix build with LLD by removing duplicate symbols already in IBVERBS_1.0.

7 years agoMFC r316586:
bdrewery [Fri, 28 Apr 2017 17:54:45 +0000 (17:54 +0000)]
MFC r316586:

  META_MODE: Fix build-tools still sometimes rebuilding during target build.

7 years agoMFC r316611:
asomers [Fri, 28 Apr 2017 14:48:29 +0000 (14:48 +0000)]
MFC r316611:

sbin/mount: strcpy -> strlcpy

Reported by: Coverity
CID: 10111731011174
Sponsored by: Spectra Logic Corp

7 years agoMFC r316610:
asomers [Fri, 28 Apr 2017 14:45:03 +0000 (14:45 +0000)]
MFC r316610:

usr.bin/netstat: strcpy -> strlcpy

Reported by: Coverity
CID: 10067411006744
Sponsored by: Spectra Logic Corp

7 years agoMFC r316548:
asomers [Fri, 28 Apr 2017 14:43:14 +0000 (14:43 +0000)]
MFC r316548:

Quiet 450.status-security when *_inline="YES"

Previously, 450.status-security would always set rc=3 in inline mode,
because it doesn't know whether "periodic security" is going to find
anything interesting. But this annoyingly results in daily reports that
simply say "Security check: \n\n-- End of daily output --".

This change fixes that by testing whether "periodic security" printed
anything, and setting 450.status-security's exit status to 3 if it did. An
alternative would be to change the exit status of periodic(8) to be the
worst of its scripts' exit statuses, but that would be a more intrusive
change.

Reviewed by: brian
Differential Revision: https://reviews.freebsd.org/D10267

7 years agoMove td_sigqueue to the end of struct thread
badger [Thu, 27 Apr 2017 22:28:49 +0000 (22:28 +0000)]
Move td_sigqueue to the end of struct thread

In order to preserve KBI in stable branches, replace the existing
td_sigqueue slot with padding and move the expanded (as of r315949)
td_sigqueue to the end of the struct.

Reported by: jhb
Suggested by: kib
Reviewed by: jhb, kib, vangyzen
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10515

7 years agoMFC: r316793
rmacklem [Thu, 27 Apr 2017 20:21:29 +0000 (20:21 +0000)]
MFC: r316793
Document the "oneopenown" option added by r316792.

This is a content change.

7 years agoMFC: r316792
rmacklem [Thu, 27 Apr 2017 20:14:54 +0000 (20:14 +0000)]
MFC: r316792
Add an NFSv4.1 mount option for "use one openowner".

Some NFSv4.1 servers such as AmazonEFS can only support a small fixed number
of open_owner4s. This patch adds a mount option called "oneopenown" that
can be used for NFSv4.1 mounts to make the client do all Opens with the
same open_owner4 string. This option can only be used with NFSv4.1 and
may not work correctly when Delegations are is use.

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

7 years agoMFC: r316782
rmacklem [Thu, 27 Apr 2017 20:07:14 +0000 (20:07 +0000)]
MFC: r316782
Add call to svcpool_close() for the NFSv4 callback pool (svcpool_nfscbd).

A function called svcpool_close() was added to the server side krpc by
r313735, so that a pool could be closed without destroying the data structures.
This little patch adds a call to it for the callback pool (svcpool_nfscbd),
so that the nfscbd daemon can be killed/restarted and continue to work
correctly.

7 years agoMFC r316759:
ae [Thu, 27 Apr 2017 12:16:58 +0000 (12:16 +0000)]
MFC r316759:
  Add large replay widow support to setkey(8) and libipsec.

  When the replay window size is large than UINT8_MAX, add to the request
  the SADB_X_EXT_SA_REPLAY extension header that was added in r309144.

  Also add support of SADB_X_EXT_NAT_T_TYPE, SADB_X_EXT_NAT_T_SPORT,
  SADB_X_EXT_NAT_T_DPORT, SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR,
  SADB_X_EXT_SA_REPLAY, SADB_X_EXT_NEW_ADDRESS_SRC, SADB_X_EXT_NEW_ADDRESS_DST
  extension headers to the key_debug that is used by `setkey -x`.

  Modify kdebug_sockaddr() to use inet_ntop() for IP addresses formatting.
  And modify kdebug_sadb_x_policy() to show policy scope and priority.

  Reviewed by: gnn, Emeric Poupon
  Differential Revision: https://reviews.freebsd.org/D10375

7 years agoMFC r317196:
kib [Thu, 27 Apr 2017 12:12:33 +0000 (12:12 +0000)]
MFC r317196:
Write-combine framebuffer writes through user-space mappings, if possible.

7 years agoMFC r316777 (by cem)
truckman [Thu, 27 Apr 2017 07:30:48 +0000 (07:30 +0000)]
MFC r316777 (by cem)

dummynet: Use strlcpy to appease static checkers

Some dummynet modules used strcpy() to copy from a larger buffer
(dn_aqm->name) to a smaller buffer (dn_extra_parms->name).  It happens that
the lengths of the strings in the dn_aqm buffers were always hardcoded to be
smaller than the dn_extra_parms buffer ("CODEL", "PIE").

Use strlcpy() instead, to appease static checkers.  No functional change.

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

7 years agoMFC r317185: Some cosmetic polishing for pre-timeouts.
mav [Thu, 27 Apr 2017 06:29:02 +0000 (06:29 +0000)]
MFC r317185: Some cosmetic polishing for pre-timeouts.

7 years agoMFC r316758: Update list of Conexant and Realtek codecs.
mav [Thu, 27 Apr 2017 06:28:12 +0000 (06:28 +0000)]
MFC r316758: Update list of Conexant and Realtek codecs.

7 years agoMFC r315961: Add ids for ALC233 found on Intel Skull Mountain NUC.
mav [Thu, 27 Apr 2017 06:27:39 +0000 (06:27 +0000)]
MFC r315961: Add ids for ALC233 found on Intel Skull Mountain NUC.

7 years agoMFC 317353
sephe [Thu, 27 Apr 2017 01:58:20 +0000 (01:58 +0000)]
MFC 317353

    hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.

    Hyper-V hot channel effect:
    Operation latency on hot channel is only _half_ of the operation
    latency on cold channels.

    This commit takes the advantage of the above Hyper-V host channel
    effect, and can reduce more than 75% latency and more than 50%
    latency stdev, i.e. lower and more stable/predictable latency,
    for various types of web server workloads.

    Sponsored by:   Microsoft

7 years agoMFC r317193: elfcopy: document --strip-symbols=filename in the man page
emaste [Thu, 27 Apr 2017 00:25:24 +0000 (00:25 +0000)]
MFC r317193: elfcopy: document --strip-symbols=filename in the man page

Reported by: bz
Sponsored by: The FreeBSD Foundation

7 years agoMFC: r316745
rmacklem [Wed, 26 Apr 2017 22:31:43 +0000 (22:31 +0000)]
MFC: r316745
Fix the NFS client for "text file modified, process killed" mmap'd case.

When an mmap'd text file is written and then executed immediately
afterwards, it was possible that the modify time would change after the
text file was executing, resulting in the process executing the file
being killed. This was usually only observed when the file system's
times were set to higher resolution, but could have occurred for any
time resolution.
This patch adds a VOP_SET_TEXT() to the NFS client which flushed all
dirty pages to the NFS server and then makes sure that n_mtime is up
to date to avoid this from occurring.
Thanks go to kib@ and pho@ for their help with developing this patch.

7 years agoMFC r315449:
smh [Wed, 26 Apr 2017 22:25:01 +0000 (22:25 +0000)]
MFC r315449:

Reduce ARC fragmentation threshold

Sponsored by: Multiplay

7 years agoMFC r316460:
smh [Wed, 26 Apr 2017 22:23:42 +0000 (22:23 +0000)]
MFC r316460:

Fix expandsz 16.0E vals and vdev_min_asize of RAIDZ children

Sponsored by: Multiplay

7 years agoMFC: r316719
rmacklem [Wed, 26 Apr 2017 22:17:54 +0000 (22:17 +0000)]
MFC: r316719
Don't throw away Open state when a NFSv4.1 client recovery fails.

If the ExchangeID/CreateSession operations done by an NFSv4.1 client
after the server crashes/reboots fails, it is possible that some process/thread
is waiting for an open_owner lock. If the client state is free'd, this
can cause a crash.
This would not normally happen, but has been observed on a mount of the
AmazonEFS service.

7 years agoMFC: r316717
rmacklem [Wed, 26 Apr 2017 22:11:44 +0000 (22:11 +0000)]
MFC: r316717
During a server crash recovery, fix the NFSv4.1 client for a NFSERR_BADSESSION
during recovery.

If the NFSv4.1 client gets a NFSv4.1 NFSERR_BADSESSION reply to an Open/Lock
operation while recovering from the server crash/reboot, allow the opens
to be retained for a subsequent recovery attempt. Since NFSv4.1 servers
should only reply NFSERR_BADSESSION after a crash/reboot that has lost
state, this case should almost never happen.
However, for the AmazonEFS file service, this has been observed when
the client does a fresh TCP connection for RPCs.

7 years agoMFC: r316694
rmacklem [Wed, 26 Apr 2017 22:04:55 +0000 (22:04 +0000)]
MFC: r316694
Fix a crash during unmount of an NFSv4.1 mount.

Larry Rosenman reported a crash on freebsd-current@ which was caused by
a premature release of the krpc backchannel socket structure.
I believe this was caused by a race between the SVC_RELEASE() in clnt_vc.c
and the xprt_unregister() in the higher layer (clnt_rc.c), which tried
to lock the mutex in the xprt structure and crashed.
This patch fixes this by removing the xprt_unregister() in the clnt_vc
layer and allowing this to always be done by the clnt_rc (higher reconnect
layer).

7 years agoMFC r317169:
gjb [Wed, 26 Apr 2017 16:27:20 +0000 (16:27 +0000)]
MFC r317169:
 Trim trailing '/release/..' when setting _OBJDIR so arm64/aarch64
 boot1.efifat is properly located when creating virtual machine images.

 Note, the underlying issue has no direct impact against stable/10,
 as arm64/aarch64 virtual machine images are not created for 10-STABLE.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r316530, r316535
asomers [Wed, 26 Apr 2017 14:50:06 +0000 (14:50 +0000)]
MFC r316530, r316535

r316530:
Fix clearing geom metadata if DIOCGSECTORSIZE fails

An unhandled error case would result in passing SIZE_MAX to malloc.
While I'm here, remove an unnecessary NULL check before free

Reported by: Coverity
CID: 1017793
Sponsored by: Spectra Logic Corp

r316535:
Fix memory leak in "gpart bootcode"

Also, annotate that gpart_issue never returns

Reported by: Coverity
CID: 1007105
Sponsored by: Spectra Logic Corp

7 years agoMFC r316501, r316523
asomers [Wed, 26 Apr 2017 14:44:39 +0000 (14:44 +0000)]
MFC r316501, r316523

r316501:
Fix file descriptor and memory leaks in pr(1)

Also, hook NetBSD's pr test into the build, and add three more test cases.

Reported by: Coverity, Valgrind
CID: 271650 271651 271652 271653 271654 271655 271656 271656
CID: 271657 271658 271659 1006939 1006940 1006941 1006942 1009098
Reviewed by: ngie
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9137

r316523:
Remove a duplicate fclose() that snuck into r316501

Reported by: Coverity
CID: 1373338
X-MFC-With: 316501
Sponsored by: Spectra Logic Corp

7 years agoMFC r316500:
asomers [Wed, 26 Apr 2017 14:43:21 +0000 (14:43 +0000)]
MFC r316500:

strcpy => strlcpy, strcat => strlcat

Reported by: Coverity
CID: 1006703 978863 1006745 1347163
Reviewed by: cem
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10192

7 years agoMFC r316810, r316814, r316816, r316991:
cy [Wed, 26 Apr 2017 02:37:25 +0000 (02:37 +0000)]
MFC r316810, r316814, r316816, r316991:

Keep state incorrectly assumes keep frags. This is counter to the
ipfilter man pages. This also currently restricts keep frags to only when
keep state is used, which is redundant because keep state currently
assumes keep frags. This commit fixes this.

To the user this change means that to maintain the current behaviour
one must add keep frags to any ipfilter keep state rule (as documented
in the man pages).

This patch also allows the flexability to specify and use keep frags
separate from keep state, as documented in an example in ipf.conf.5,
instead of the currently broken behaviour.

MFC suggested by: rgrimes
Relnotes: yes

7 years agoMFC: r316692
rmacklem [Tue, 25 Apr 2017 23:43:37 +0000 (23:43 +0000)]
MFC: r316692
Set initial values for nfsstatfs in the NFSv4 client.

The AmazonEFS NFSv4.1 server does not support the FILES_FREE and FILES_TOTAL
attributes. As such, an NFSv4.1 mount to the server would return garbage
for these values. This patch initializes the fields of the nfsstatfs structure,
so that "df" and friends will at least return consistent bogus values.

7 years agoMFC: r316669
rmacklem [Tue, 25 Apr 2017 20:24:00 +0000 (20:24 +0000)]
MFC: r316669
Avoid starvation of the server crash recovery thread for the NFSv4 client.

This patch gives a requestor of the exclusive lock on the client state
in the NFSv4 client priority over shared lock requestors. This avoids
the server crash recovery thread being starved out by other threads doing
RPCs.

7 years agoMFC: r316667
rmacklem [Tue, 25 Apr 2017 19:14:31 +0000 (19:14 +0000)]
MFC: r316667
Fix the NFSv4 client hndling of a stale write verifier in the Commit operation.

When the NFSv4 client Commit operation encountered a stale write verifier,
it erroneously mapped that to EIO. This could have caused recently written
data to be lost when a server crashes/reboots between an UNSTABLE write
and the subsequent commit. This patch fixes this.
The bug was only for the NFSv4 client and did not affect NFSv3.

7 years agoMFC: r316666
rmacklem [Tue, 25 Apr 2017 19:02:34 +0000 (19:02 +0000)]
MFC: r316666
Fix the NFSv4.1 client for NFSERR_BADSESSION recovery via ReclaimComplete.

For the ReclaimComplete operation, the RPC layer should not loop on
NFSERR_BADSESSION. If it does, the recovery thread (nfscl) can get stuck
looping and will not do a recovery.
This patch fixes it so it does not loop. This bug only affects NFSv4.1 and
only when a server reboots.

7 years agoMFC r316698:
kib [Tue, 25 Apr 2017 13:07:06 +0000 (13:07 +0000)]
MFC r316698:
Remove debugging printf.

7 years agoMFC: r316655
rmacklem [Tue, 25 Apr 2017 11:59:23 +0000 (11:59 +0000)]
MFC: r316655
Fix parsing failure for NFSv4 Setattr operation for failed case.

If an operation that preceeds a Setattr in an NFSv4 compound fails,
there is no bitmap of attributes to parse. Without this patch, the
parsing would fail and return EBADRPC instead of the correct failure
error. This could break recovery from a server crash/reboot.

7 years agoMFC r316699:
ae [Tue, 25 Apr 2017 11:19:22 +0000 (11:19 +0000)]
MFC r316699:
  Do not adjust interface MTU automatically. Leave this task to the system
  administrator.

  Before r274246 interface MTU was adjusted only when GRE key is configured.
  The r274246 has changed this behavior to automatically adjust MTU when any
  option, that changes the size of GRE header is configured.
  This patch removes automatic MTU adjustment from if_gre(4) and if_me(4),
  and restores the behavior that was prior to r274246.

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

7 years agoMFC r317273 (by cem):
markj [Tue, 25 Apr 2017 00:00:34 +0000 (00:00 +0000)]
MFC r317273 (by cem):
fuse: Implement FOPEN_KEEP_CACHE flag

7 years agoMFC: r310491
rmacklem [Mon, 24 Apr 2017 23:47:12 +0000 (23:47 +0000)]
MFC: r310491
Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors.

For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure
that indicates that the server has lost session/open/lock state.
However, recent testing by cperciva@ against the AmazonEFS server found
several problems with client recovery from this due to it generating this
failure frequently.
Briefly, the problems fixed are:
- If all session slots were in use at the time of the failure, some processes
  would continue to loop waiting for a slot on the old session forever.
- If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION,
  it would fail the RPC/syscall instead of initiating recovery and then
  looping to retry the RPC.
- If a successful reply to an RPC for an old session wasn't processed
  until after a new session was created for a NFS4ERR_BAD_SESSION error,
  it would erroneously update the new session and corrupt it.
- The use of the first element of the session list in the nfs mount
  structure (which is always the current metadata session) was slightly
  racey. With changes for the above problems it became more racey, so all
  uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT().
- Although the kernel malloc() usually allocates more bytes than requested
  and, as such, this wouldn't have caused problems, the allocation of a
  session structure was 1 byte smaller than it should have been.
  (Null termination byte for the string not included in byte count.)

There are probably still problems with a pNFS data server that fails
with NFS4ERR_BAD_SESSION, but I have no server that does this to test
against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet.

Although this patch is fairly large, it should only affect the handling
of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server.
Thanks go to cperciva@ for the extension testing he did to help isolate/fix
these problems.