]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
6 years agoMFH r328332:
mm [Sat, 3 Feb 2018 02:17:25 +0000 (02:17 +0000)]
MFH r328332:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

git-svn-id: svn://svn.freebsd.org/base/stable/10@328828 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC of 328444.
mckusick [Fri, 2 Feb 2018 01:28:14 +0000 (01:28 +0000)]
MFC of 328444.

Eliminate "fsync: giving up on dirty" messages.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328765 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328623:
hselasky [Thu, 1 Feb 2018 13:16:11 +0000 (13:16 +0000)]
MFC r328623:
Properly implement the cond_resched() function macro in the LinuxKPI.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@328656 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328497:
pfg [Thu, 1 Feb 2018 02:00:36 +0000 (02:00 +0000)]
MFC r328497:
pfctl(8): Fix two wrong conditions.

Caught by gcc80's -Wtautological-compare option.

MFC after: 5 days
Reviewed by: kp
Obtained from: DragonFlyBSD (git e3cdbf6c)

git-svn-id: svn://svn.freebsd.org/base/stable/10@328649 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328350:
ae [Wed, 31 Jan 2018 09:26:28 +0000 (09:26 +0000)]
MFC r328350:
  Merge revision 1.35 from NetBSD:
    fix pointer/offset mistakes in handling of IPv4 options

  Reported by:  Maxime Villard <maxv at NetBSD.org>

MFC r328352:
  Adopt revision 1.76 and 1.77 from NetBSD:
    Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely
    crash the kernel with a single packet.

    In this loop we need to increment 'ad' by two, because the length field
    of the option header does not count the size of the option header itself.

    If the length is zero, then 'count' is incremented by zero, and there's
    an infinite loop. Beyond that, this code was written with the assumption
    that since the IPv6 packet already went through the generic IPv6 option
    parser, several fields are guaranteed to be valid; but this assumption
    does not hold because of the missing '+2', and there's as a result a
    triggerable buffer overflow (write zeros after the end of the mbuf,
    potentially to the next mbuf in memory since it's a pool).

    Add the missing '+2', this place will be reinforced in separate commits.

  Reported by:  Maxime Villard <maxv at NetBSD.org>

git-svn-id: svn://svn.freebsd.org/base/stable/10@328621 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 327561:
jhb [Mon, 29 Jan 2018 23:43:04 +0000 (23:43 +0000)]
MFC 327561:
Report offset relative to the backing object for kinfo_vmentry structures.

For the pathname reported in kinfo_vmentry structures (kve_path), the
sysctl handlers walk the object chain to find the bottom-most VM object.
This permits a COW mapping of a file with dirty pages to report the
pathname of the originally mapped file.  Do the same for the object
offset (kve_offset) computing a cumulative offset during the same object
walk so that the reported offset is relative to the reported pathname.

Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset
rather than the raw offset of the VM map entry.

Note also that this does not affect procstat -v output (even structured
output) since that output does not include the kve_offset field.

Sponsored by: DARPA / AFRL

git-svn-id: svn://svn.freebsd.org/base/stable/10@328571 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoRevert a local change and sync. with head. No functional change.
jkim [Mon, 29 Jan 2018 18:21:50 +0000 (18:21 +0000)]
Revert a local change and sync. with head.  No functional change.

Note this is a direct commit because head has OpenSSL 1.0.2.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328557 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoPull in r217197 from upstream clang trunk (by Richard Smith):
dim [Mon, 29 Jan 2018 18:11:27 +0000 (18:11 +0000)]
Pull in r217197 from upstream clang trunk (by Richard Smith):

  PR20844: If we fail to list-initialize a reference, map to the
  referenced type before retrying the initialization to produce
  diagnostics. Otherwise, we may fail to produce any diagnostics, and
  silently produce invalid AST in a -Asserts build. Also add a note to
  this codepath to make it more clear why we were trying to create a
  temporary.

This should fix assertions when parsing some forms of incomplete list
intializers.

Direct commit to stable/9 and stable/10, since stable/11 and head
already have this upstream fix.

Reported by: ajcbowhill@gmail.com
PR: 202665

git-svn-id: svn://svn.freebsd.org/base/stable/10@328555 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agopsm: Log syncmask[1], not syncmask[0] twice
dumbbell [Sat, 27 Jan 2018 17:24:59 +0000 (17:24 +0000)]
psm: Log syncmask[1], not syncmask[0] twice

MFC of: r328208

git-svn-id: svn://svn.freebsd.org/base/stable/10@328485 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328055: Import tzdata 2018a
philip [Sat, 27 Jan 2018 13:34:14 +0000 (13:34 +0000)]
MFC r328055: Import tzdata 2018a
MFC r328318: Import tzdata 2018c

git-svn-id: svn://svn.freebsd.org/base/stable/10@328476 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328283, r328284:
gjb [Fri, 26 Jan 2018 04:32:31 +0000 (04:32 +0000)]
MFC r328283, r328284:

 r328283:
  When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh
  within the CHROOTDIR.  If it does not exist, unset CHROOTBUILD_SKIP
  to prevent build failures.

 r328284:
  Bump Copyright year.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@328429 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328297:
brooks [Fri, 26 Jan 2018 00:35:33 +0000 (00:35 +0000)]
MFC r328297:

Don't escape '?'s in protocol output.

This isn't required by mandoc and is nonfunctional in groff.

PR: 224632
Reported by: w.schwarzenfeld@utanet.at
Differential Revision: https://reviews.freebsd.org/D13779

git-svn-id: svn://svn.freebsd.org/base/stable/10@328422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 287600,287602: Fixes for fork following tests.
jhb [Thu, 25 Jan 2018 00:08:13 +0000 (00:08 +0000)]
MFC 287600,287602: Fixes for fork following tests.

287600:
Properly size the children[] arrays in the follow fork tests.

287602:
Use _exit() instead of exit() in child processes created during tests.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328384 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 325028,328344: Discard the correct thread event reported for a ptrace stop.
jhb [Wed, 24 Jan 2018 21:48:39 +0000 (21:48 +0000)]
MFC 325028,328344: Discard the correct thread event reported for a ptrace stop.

325028:
Discard the correct thread event reported for a ptrace stop.

When multiple threads wish to report a tracing event to a debugger,
both threads call ptracestop() and one thread will win the race to be
the reporting thread (p->p_xthread).  The debugger uses PT_LWPINFO
with the process ID to determine which thread / LWP is reporting an
event and the details of that event.  This event is cleared as a side
effect of the subsequent ptrace event that resumed the process
(PT_CONTINUE, PT_STEP, etc.).  However, ptrace() was clearing the
event identified by the LWP ID passed to the resume request even if
that wasn't the 'p_xthread'.  This could result in clearing an event
that had not yet been observed by the debugger and leaving the
existing event for 'p_thread' pending so that it was reported a second
time.

Specifically, if the debugger stopped due to a software breakpoint in
one thread, but then switched to another thread that was used to
resume (e.g. if the user switched to a different thread and issued a
step), the resume request (PT_STEP) cleared a pending event (if any)
for the thread being stepped.  However, the process immediately
stopped and the first thread reported it's breakpoint event a second
time.  The debugger decremented the PC for "both" breakpoint events
which resulted in the PC now pointing into the middle of an
instruction (on x86) and a SIGILL fault when the process was resumed a
second time.

To fix, always clear the pending event for 'p_xthread' when resuming a
process.  ptrace() still honors the requested LWP ID when enabling
single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE).

328344:
Mark the unused argument to continue_thread() as such.

clang in HEAD and 11 does not warn about this, but clang in 10 does.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328379 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 326953:
jhb [Wed, 24 Jan 2018 00:32:02 +0000 (00:32 +0000)]
MFC 326953:
Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies.

Some of the ptrace tests need to wait for a child process to become a
zombie before preceding.  The parent process polls the child process
via the kern.proc.pid sysctl to wait for it to become a zombie.
Previously the code polled until the sysctl failed with ESRCH.  Now it
will poll until either the sysctl fails with ESRCH (for compatiblity
with older kernels) or returns a kinfo_proc structure with the ki_stat
field set to SZOMB.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328309 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests.
jhb [Tue, 23 Jan 2018 18:22:41 +0000 (18:22 +0000)]
MFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests.

__BSD_VISIBLE is always defined and it's value instead needs to be
tested via #if to determine if FreeBSD-specific APIs should be
exposed.

PR: 196226

git-svn-id: svn://svn.freebsd.org/base/stable/10@328294 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327675
kp [Tue, 23 Jan 2018 05:03:26 +0000 (05:03 +0000)]
MFC r327675

pf: Avoid integer overflow issues by using mallocarray() iso. malloc()

pfioctl() handles several ioctl that takes variable length input, these
include:
- DIOCRADDTABLES
- DIOCRDELTABLES
- DIOCRGETTABLES
- DIOCRGETTSTATS
- DIOCRCLRTSTATS
- DIOCRSETTFLAGS

All of them take a pfioc_table struct as input from userland. One of
its elements (pfrio_size) is used in a buffer length calculation.
The calculation contains an integer overflow which if triggered can lead
to out of bound reads and writes later on.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@328277 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327674, r327796
kp [Tue, 23 Jan 2018 04:37:31 +0000 (04:37 +0000)]
MFC r327674, r327796

Introduce mallocarray() in the kernel

Similar to calloc() the mallocarray() function checks for integer
overflows before allocating memory.
It does not zero memory, unless the M_ZERO flag is set.

Additionally, move the overflow check logic out to WOULD_OVERFLOW() for
consumers to have a common means of testing for overflowing allocations.
WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just
because an allocation won't overflow size_t does not mean it is a sane size
to request.  Callers should be imposing reasonable allocation limits far,
far, below overflow.

Obtained from: OpenBSD

git-svn-id: svn://svn.freebsd.org/base/stable/10@328276 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327718:
cy [Tue, 23 Jan 2018 04:01:48 +0000 (04:01 +0000)]
MFC r327718:

When growing the state, also grow the seed array. Otherwise memory
that was not allocated will be accessed.

This necessitated refactoring state seed allocation from
ipf_state_soft_init() into a new common ipf_state_seed_alloc() function
as it is now also used by ipf_state_rehash() when changing the size of
the state hash table in addition to by ipf_state_soft_init() during
initialization.

According to Christos Zoulas <christos@NetBSD.org>:

The bug was encountered by a NetBSD vendor who's customer machines had
large ipfilter states. The bug was reliably triggered by resizing the
state variables using "ipf -T".

Submitted by: Christos Zoulas <christos@NetBSD.org>
Reviewed by: delphij, rgrimes
Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10
Differential Revision: https://reviews.freebsd.org/D13755

git-svn-id: svn://svn.freebsd.org/base/stable/10@328274 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327497, r327498: fix memory disclosure in hpt* ioctls
emaste [Tue, 23 Jan 2018 02:29:39 +0000 (02:29 +0000)]
MFC r327497, r327498: fix memory disclosure in hpt* ioctls

r327497: hpt27xx: plug info leak in hpt_ioctl

The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27xx device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

Reported by:  Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> (M_ZERO)

r327498: hpt{nr,rr}: plug info leak in hpt_ioctl

The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27{nr,rr} device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.

Security: memory disclosure in root-only ioctls
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@328268 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317806 by glebius:
emaste [Tue, 23 Jan 2018 02:16:06 +0000 (02:16 +0000)]
MFC r317806 by glebius:

The nandsim(4) simulator driver doesn't have any protection against
races at least in its ioctl handler, and at the same time it creates
device entry with 0666 permissions.

To plug possible issues in it:
- Mark it as needing Giant.
- Switch device mode to 0600.

Submitted by: C Turt
Reviewed by: imp
Security: Possible double free in ioctl handler

git-svn-id: svn://svn.freebsd.org/base/stable/10@328267 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327913:
cy [Sat, 20 Jan 2018 18:04:08 +0000 (18:04 +0000)]
MFC r327913:

Remove redundant variable.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328204 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327912:
cy [Sat, 20 Jan 2018 18:00:42 +0000 (18:00 +0000)]
MFC r327912:

Though this block of code is not used by FreeBSD, correct a call to
sprintf() with a macro call to SNPRINTF similar to other calls to
SNPRINTF within this same block.

git-svn-id: svn://svn.freebsd.org/base/stable/10@328203 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327724: usbdevs: add ASMedia vendor ID
avg [Tue, 16 Jan 2018 11:25:08 +0000 (11:25 +0000)]
MFC r327724: usbdevs: add ASMedia vendor ID

git-svn-id: svn://svn.freebsd.org/base/stable/10@328051 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327725: zfs_mount: restore a bit of ifdef-out illumos code
avg [Tue, 16 Jan 2018 11:22:07 +0000 (11:22 +0000)]
MFC r327725: zfs_mount: restore a bit of ifdef-out illumos code

git-svn-id: svn://svn.freebsd.org/base/stable/10@328048 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327593: Fix a couple of comments in AMD Virtual Machine Control Block structure
avg [Mon, 15 Jan 2018 12:17:26 +0000 (12:17 +0000)]
MFC r327593: Fix a couple of comments in AMD Virtual Machine Control Block structure

git-svn-id: svn://svn.freebsd.org/base/stable/10@328002 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326567: ddb: fix validation of cpu id in 'set db_cpu=x'
avg [Mon, 15 Jan 2018 12:15:04 +0000 (12:15 +0000)]
MFC r326567: ddb: fix validation of cpu id in 'set db_cpu=x'

git-svn-id: svn://svn.freebsd.org/base/stable/10@328000 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326140: vmrun.sh: add -A option for AHCI emulation of disk devices
avg [Mon, 15 Jan 2018 12:00:34 +0000 (12:00 +0000)]
MFC r326140: vmrun.sh: add -A option for AHCI emulation of disk devices

git-svn-id: svn://svn.freebsd.org/base/stable/10@327998 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 327737:
cy [Fri, 12 Jan 2018 02:49:18 +0000 (02:49 +0000)]
MFC 327737:

USNO and possibly others have misinterpreted the maining of the
leapseconds last-update field and incorrectly increment it when changing
the file even though the leapsecond data has not changed. For instance,
if a leapsecond file is obtained from USNO, when it expires it will not
be replaced by a newer file from other sources because it has an
incorrect later last-update (version).

This corrects r304780.

PR: 225029
Submitted by: ian

git-svn-id: svn://svn.freebsd.org/base/stable/10@327859 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r284406:
bdrewery [Thu, 11 Jan 2018 21:31:10 +0000 (21:31 +0000)]
MFC r284406:

  Use cpp -I$includedir

git-svn-id: svn://svn.freebsd.org/base/stable/10@327847 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327289:
pfg [Wed, 10 Jan 2018 21:24:03 +0000 (21:24 +0000)]
MFC r327289:
rpc.sprayd: Bring some changes from NetBSD.

Most notable, other than some style issues:
CVS 1.11:
  do not use LOG_CONS.
CVS 1.13:
  consistently use exit instead of return in main().
  use LOG_WARNING instead of LOG_ERR for non critical errors.

Obtained from: NetBSD

git-svn-id: svn://svn.freebsd.org/base/stable/10@327793 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327540:
cy [Tue, 9 Jan 2018 06:10:57 +0000 (06:10 +0000)]
MFC r327540:

Correct function name in description block.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327717 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327336:
cy [Tue, 9 Jan 2018 06:07:51 +0000 (06:07 +0000)]
MFC r327336:

Correct the comment describing badrs which is bad router solicitiation,
not bad router advertisement.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327716 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327183:
eadler [Sat, 6 Jan 2018 05:00:30 +0000 (05:00 +0000)]
MFC r327183:

.git*: add gitattributes and gitignore

For users of the git mirrors, lets provide useful git configuration
files.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327608 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327329:
pfg [Fri, 5 Jan 2018 17:23:17 +0000 (17:23 +0000)]
MFC r327329:
dev/txp: Update if_txpreg.h to match OpenBSD's version.

Resolve a minor mismatch: TXP_CMD_READ_VERSION instead of
TXP_CMD_VERSIONS_READ.
Curiously the later is defined but not used in OpenBSD.

Obtained from: OpenBSD (CVS 1.31-1.34)

git-svn-id: svn://svn.freebsd.org/base/stable/10@327590 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327295:
pfg [Thu, 4 Jan 2018 15:57:49 +0000 (15:57 +0000)]
MFC r327295:
Start syncing changes from OpenBSD's ip6_id.c instead of ip_id.c.

correct non-repetitive ID code, based on comments from niels provos.
- seed2 is necessary, but use it as "seed2 + x" not "seed2 ^ x".
- skipping number is not needed, so disable it for 16bit generator (makes
  the repetition period to 30000)

Obtained from: OpenBSD (CVS rev. 1.2)

git-svn-id: svn://svn.freebsd.org/base/stable/10@327550 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322812:
smh [Wed, 3 Jan 2018 16:16:20 +0000 (16:16 +0000)]
MFC r322812:

Avoid TCP log messages which are false positives.

Sponsored by: Multiplay

git-svn-id: svn://svn.freebsd.org/base/stable/10@327520 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327164:
dim [Mon, 1 Jan 2018 20:39:12 +0000 (20:39 +0000)]
MFC r327164:

Fix clang 6.0.0 compiler warnings in binutils

Latest clang git has a warning -Wnull-pointer-arithmetic which will
trigger a -Werror failure. Addition and subtraction from a null pointer
is undefined behaviour and could be optimized into anything.

Furthermore, using the difference between two pointers and casting the
result back to a pointer is not portable since the size of ptrdiff_t
does not necessary have to be the same as size of void* (this happens
e.g. on CHERI). Using intptr_t instead fixes this portability issue and
the compiler warning.

Submitted by; Alexander Richardson
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D12928

git-svn-id: svn://svn.freebsd.org/base/stable/10@327471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327167:
dim [Mon, 1 Jan 2018 20:24:16 +0000 (20:24 +0000)]
MFC r327167:

Remove obsolete register keyword from opensolaris's sysmacros.h.  When
compiling zfsd with recent clang, it leads to a warning about the
register storage class being incompatible with C++17.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327029:
ume [Wed, 27 Dec 2017 14:50:07 +0000 (14:50 +0000)]
MFC r327029:
Don't ignore trailing spaces after numerical IP addresses.

PR: 224403

git-svn-id: svn://svn.freebsd.org/base/stable/10@327238 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326791: Close the correct file descriptor.
delphij [Tue, 26 Dec 2017 08:33:02 +0000 (08:33 +0000)]
MFC r326791: Close the correct file descriptor.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327192 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326185: Set errno to EFTYPE instead of EINVAL to be more consistent
delphij [Mon, 25 Dec 2017 04:34:10 +0000 (04:34 +0000)]
MFC r326185: Set errno to EFTYPE instead of EINVAL to be more consistent
with the rest of code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327172 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326898:
ae [Sun, 24 Dec 2017 02:06:16 +0000 (02:06 +0000)]
MFC r326898:
  Fix possible memory leak.

  vxlan_ftable entries are sorted in descending order, due to wrong arguments
  order it is possible to stop search before existing element will be found.
  Then new element will be allocated in vxlan_ftable_update_locked() and can
  be inserted in the list second time or trigger MPASS() assertion with
  enabled INVARIANTS.

  PR: 224371

git-svn-id: svn://svn.freebsd.org/base/stable/10@327142 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326872: fix expiration arithmetic after r326738 and MFC.
eugen [Fri, 22 Dec 2017 18:15:34 +0000 (18:15 +0000)]
MFC r326872: fix expiration arithmetic after r326738 and MFC.

Approved by:    mav (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@327091 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326851:
kib [Thu, 21 Dec 2017 13:32:49 +0000 (13:32 +0000)]
MFC r326851:
In devfs_lookupx() dotdot lookup case, avoid dereferencing
dvp->v_mount after dvp is unlocked.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327060 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326562: Use strlcpy().
delphij [Wed, 20 Dec 2017 07:18:07 +0000 (07:18 +0000)]
MFC r326562: Use strlcpy().

git-svn-id: svn://svn.freebsd.org/base/stable/10@327019 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r326544
rmacklem [Tue, 19 Dec 2017 23:00:08 +0000 (23:00 +0000)]
MFC: r326544
Avoid the overhead of acquiring a lock in nfsrv_checkgetattr() when
there are no write delegations issued.

manu@ reported on the freebsd-current@ mailing list that there was
a significant performance hit in nfsrv_checkgetattr() caused by
the acquisition/release of a state lock, even when there were no
write delegations issued.
This patch add a count of outstanding issued write delegations to the
NFSv4 server. This count allows nfsrv_checkgetattr() to return without
acquiring any lock when the count is 0, avoiding the performance hit
for the case where no write delegations are issued.

git-svn-id: svn://svn.freebsd.org/base/stable/10@327008 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326880:
dim [Tue, 19 Dec 2017 11:44:24 +0000 (11:44 +0000)]
MFC r326880:

Pull in r320755 from upstream clang trunk (by me):

  Don't trigger -Wuser-defined-literals for system headers

  Summary:
  In D41064, I proposed adding `#pragma clang diagnostic ignored
  "-Wuser-defined-literals"` to some of libc++'s headers, since these
  warnings are now triggered by clang's new `-std=gnu++14` default:

  $ cat test.cpp
  #include <string>

  $ clang -std=c++14 -Wsystem-headers -Wall -Wextra -c test.cpp
  In file included from test.cpp:1:
  In file included from /usr/include/c++/v1/string:470:
  /usr/include/c++/v1/string_view:763:29: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<char> operator "" sv(const char *__str, size_t __len)
                              ^
  /usr/include/c++/v1/string_view:769:32: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len)
                                 ^
  /usr/include/c++/v1/string_view:775:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len)
                                  ^
  /usr/include/c++/v1/string_view:781:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len)
                                  ^
  In file included from test.cpp:1:
  /usr/include/c++/v1/string:4012:24: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<char> operator "" s( const char *__str, size_t __len )
                         ^
  /usr/include/c++/v1/string:4018:27: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
                            ^
  /usr/include/c++/v1/string:4024:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
                             ^
  /usr/include/c++/v1/string:4030:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
                             ^
  8 warnings generated.

  Both @aaron.ballman and @mclow.lists felt that adding this workaround
  to the libc++ headers was the wrong way, and it should be fixed in
  clang instead.

  Here is a proposal to do just that.  I verified that this suppresses
  the warning, even when -Wsystem-headers is used, and that the warning
  is still emitted for a declaration outside of system headers.

  Reviewers: aaron.ballman, mclow.lists, rsmith

  Reviewed By: aaron.ballman

  Subscribers: mclow.lists, aaron.ballman, andrew, emaste, cfe-commits

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

This will allow to compile some of the libc++ headers in C++14 mode
(which is the default for gcc 6 and higher, and will be the default for
clang 6.0.0 and higher), with -Wsystem-headers and -Werror enabled.

Reported by: andrew

git-svn-id: svn://svn.freebsd.org/base/stable/10@326976 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoRevert revision 326923
grog [Tue, 19 Dec 2017 01:02:58 +0000 (01:02 +0000)]
Revert revision 326923

Demanded unconditionally by: imp@

git-svn-id: svn://svn.freebsd.org/base/stable/10@326955 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoCorrect character set.
grog [Sun, 17 Dec 2017 22:12:57 +0000 (22:12 +0000)]
Correct character set.

git-svn-id: svn://svn.freebsd.org/base/stable/10@326923 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326558, r326566:
cy [Sun, 17 Dec 2017 06:00:49 +0000 (06:00 +0000)]
MFC r326558, r326566:

fdformat is a sysadmin command and thus its man page should be in
volume 8 instead of volume 1.

Reviewed by: imp

git-svn-id: svn://svn.freebsd.org/base/stable/10@326918 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326738: pw(8): correct expiration period handling
eugen [Thu, 14 Dec 2017 13:10:22 +0000 (13:10 +0000)]
MFC r326738: pw(8): correct expiration period handling
  and command line overrides to preconfigured values for -e, -p and -w flags.

  Use non-negative symbols instead of magic values
  in passwd_val/pw_password functions.

PR: 223431
Submitted by: Yuri Pankov (in part, patch for the manual)
Approved by: mav (mentor)
Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/10@326849 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326657:
kib [Thu, 14 Dec 2017 11:45:02 +0000 (11:45 +0000)]
MFC r326657:
Fix livelock in ufsdirhash_create().

git-svn-id: svn://svn.freebsd.org/base/stable/10@326846 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326391: Prevent OOB access on corrupted msdos directories.
delphij [Thu, 14 Dec 2017 07:55:11 +0000 (07:55 +0000)]
MFC r326391: Prevent OOB access on corrupted msdos directories.

Submitted by: Veo Zhang <veo live com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@326843 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r324248:
cy [Wed, 13 Dec 2017 20:15:23 +0000 (20:15 +0000)]
MFC r324248:

hen building multiple kernels using KERNCONF, non-existent KERNCONF
files will produce an error and buildkernel will fail. Previously missing
KERNCONF files silently failed giving no indication as to why, only to
subsequently discover during installkernel that the desired kernel was
never built in the first place.

This is a rework of r302865.

This is the correct patch.

Reviewed by: ngie (previous version, r302865)
Differential Revision: https://reviews.freebsd.org/D7167

git-svn-id: svn://svn.freebsd.org/base/stable/10@326833 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326748:
dim [Wed, 13 Dec 2017 18:38:02 +0000 (18:38 +0000)]
MFC r326748:

Document the existence and precision of the remaining long double
functions for which an imprecise stub implementation was added in
r255294, namely powl(3) and tgammal(3).

Submitted by: Steve Kargl

MFC r326753:

Correct r326748, indicating that tgammal(3) is mapped to tgamma(3), not
to itself.

Noticed by: jilles

git-svn-id: svn://svn.freebsd.org/base/stable/10@326830 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326361: Remove unused include.
delphij [Wed, 13 Dec 2017 06:20:18 +0000 (06:20 +0000)]
MFC r326361: Remove unused include.

git-svn-id: svn://svn.freebsd.org/base/stable/10@326818 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326282: (by fsu)
pfg [Tue, 12 Dec 2017 22:10:12 +0000 (22:10 +0000)]
MFC r326282: (by fsu)

Remap ENOATTR to ENODATA in the linuxulator.
In the linux ENOADATA is frequently #defined as ENOATTR. The change is
required for an xattrs support implementation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@326814 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoRevert r326763. The change depends on r264387 which was not merged.
delphij [Tue, 12 Dec 2017 04:08:30 +0000 (04:08 +0000)]
Revert r326763.  The change depends on r264387 which was not merged.

Pointy hat to: delphij

git-svn-id: svn://svn.freebsd.org/base/stable/10@326790 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r325723:
delphij [Mon, 11 Dec 2017 05:21:48 +0000 (05:21 +0000)]
MFC r325723:

find(1): Don't treat statfs() error as fatal in f_fstype, which can happen
when a directory is removed in the middle of find.

Instead of a full err(), allow find to continue, plus print a warning with
exitstatus set when appropriate.

Reported by: 100.chksetuid via gordon
Reviewed by: jilles

git-svn-id: svn://svn.freebsd.org/base/stable/10@326763 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326244:
delphij [Mon, 11 Dec 2017 05:10:11 +0000 (05:10 +0000)]
MFC r326244:

Don't assign rs as we will assign it later.

git-svn-id: svn://svn.freebsd.org/base/stable/10@326761 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326670:
dim [Sun, 10 Dec 2017 14:49:06 +0000 (14:49 +0000)]
MFC r326670:

Remove an unused incude from lib/msun/bsdsrc/b_log.c.

Submitted by: Steve Kargl

git-svn-id: svn://svn.freebsd.org/base/stable/10@326747 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326669:
dim [Sun, 10 Dec 2017 13:58:37 +0000 (13:58 +0000)]
MFC r326669:

Remove the sentence in math(3) about some long double math functions not
being available.

Submitted by: Steve Kargl

git-svn-id: svn://svn.freebsd.org/base/stable/10@326746 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326655,326668: correct error handling for graid
eugen [Sun, 10 Dec 2017 13:45:41 +0000 (13:45 +0000)]
MFC r326655,326668: correct error handling for graid
SINGLE/CONCAT/RAID5 volumes.

Approved by:    mav (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@326745 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix error state handling.
gordon [Sat, 9 Dec 2017 03:41:31 +0000 (03:41 +0000)]
Fix error state handling.

Security: CVE-2017-3737
Security: FreeBSD-SA-17:12.openssl

git-svn-id: svn://svn.freebsd.org/base/stable/10@326721 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoAdd support for IPv6 based addresses as part of the TCP unify portspace feature
hselasky [Fri, 8 Dec 2017 19:21:46 +0000 (19:21 +0000)]
Add support for IPv6 based addresses as part of the TCP unify portspace feature
in ibcore. This resolves an interopability issue when using both iWarp(T6) and
RDMA(CX-4 and CX-5) devices at the same time.

The problem is IPv4 based sockets cannot be bound to an IPv6 based address
causing sobind() to fail preventing all use of IPv6 based addresses with RDMA
when an iWarp device is present.

This is a direct commit.

Tested by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com>
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@326704 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326362:
hselasky [Fri, 8 Dec 2017 15:26:57 +0000 (15:26 +0000)]
MFC r326362:
Disallow TUN and TAP character device IOCTLs to modify the network device
type to any value. This can cause page faults and panics due to accessing
uninitialized fields in the "struct ifnet" which are specific to the network
device type.

Found by: jau@iki.fi
PR: 223767
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@326692 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326633:
bapt [Fri, 8 Dec 2017 10:50:13 +0000 (10:50 +0000)]
MFC r326633:

Update to 2017-12-06

git-svn-id: svn://svn.freebsd.org/base/stable/10@326690 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326527:
bapt [Fri, 8 Dec 2017 10:47:29 +0000 (10:47 +0000)]
MFC r326527:

Only skip looking for manpages if both man directory and cat directory
are not existing.

This allows man(1) to read catpages when no man directories are available at all

PR: 223559
Reported by: wosch

git-svn-id: svn://svn.freebsd.org/base/stable/10@326688 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326526:
bapt [Fri, 8 Dec 2017 10:44:44 +0000 (10:44 +0000)]
MFC r326526:

In case man(1) found a catpage to display skip looking ".so" which is manpage
only.

In case we are trying to read a catpage, the manpage variable is not defined.
It results in the "cattool" having no arguments.

In case the catpage is compressed, the cattool used is "zcat" which dies if the
standard input is a terminal, meaning the function calling it is exiting as if
there were no ".so"
In case the catpage is uncompressed, the cattool used is "zcat -f" which waits
reading standard input, making the man(1) command hang.

PR: 223560
Reported by: wosch

git-svn-id: svn://svn.freebsd.org/base/stable/10@326686 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r267961, r309361, r322710, r323286, r326378, r326383, r326407
jkim [Wed, 6 Dec 2017 21:40:24 +0000 (21:40 +0000)]
MFC: r267961, r309361, r322710, r323286, r326378, r326383, r326407

Sync. hwpstate with head.

r267961 (hselasky, partial):

Remove a redundant TUNABLE statement.

r309361 (danfe):

- Mention mismatching numbers in MSR vs. ACPI _PSS count warning.
- Rephrase unsupported AMD CPUs message and wrap as an overly long line.
- Improve readability when reporting resulted P-state transition (debug).

r322710, r323286 (cem):

- Add support for family 17h pstate info from MSRs.
- Yield CPU awaiting frequency change.

r326378, r326383, r326407:

- Fix some style(9) nits.
- Add a tunable "debug.hwpstate_verify" to check P-state after changing it
and turn it off by default.

git-svn-id: svn://svn.freebsd.org/base/stable/10@326638 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326343:
cy [Wed, 6 Dec 2017 00:00:37 +0000 (00:00 +0000)]
MFC r326343:

Fix fetching ntp leapfile after 325256

Submitted by: Ronald Klop <ronald-lists@klop.ws>
Original commit by:    asomers
MFC PR: 224126

git-svn-id: svn://svn.freebsd.org/base/stable/10@326604 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoSteps to Reproduce:
julian [Tue, 5 Dec 2017 14:46:12 +0000 (14:46 +0000)]
Steps to Reproduce:
#ngctl mkpeer ipfw: patch 7 in
#ngctl name ipfw:7 tcp_rst
#ngctl connect ipfw: tcp_rst: 8 out
#ngctl msg tcp_rst: setconfig { count=1 csum_flags=0 ops=[ { mode=8 value=4 length=1 offset=33 } ] }
ngctl: send msg: Argument list too long

It's broken after base r309389 and could be fixed in base r309408, but the first one went to 10.4 and the second one didn't.

PR: 224019
Submitted by: sd@mostnet.ru

git-svn-id: svn://svn.freebsd.org/base/stable/10@326568 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326315, r326330, r326331, r326412:
gjb [Mon, 4 Dec 2017 15:28:07 +0000 (15:28 +0000)]
MFC r326315, r326330, r326331, r326412:

 r326315:
  Set DISTDIR and WRKDIRPREFIX when building ports within the
  chroot(8) to avoid mtime changes within the ports checkout,
  which can cause checksum differences.

 r326330:
  Add a comment to release/release.conf.sample documenting
  EMBEDDEDPORTS. [1]

  Remove and update stale documentation from release(7) while here.

 r326331:
  Correct a comment.

 r326412:
  Fix port build flags passed to make(1) after r326315, where
  it was missed for embedded image builds.

PR: 206344 [1]
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@326534 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326424:
kib [Mon, 4 Dec 2017 10:05:59 +0000 (10:05 +0000)]
MFC r326424:
Add comment for vm_map_find_min().

git-svn-id: svn://svn.freebsd.org/base/stable/10@326523 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r325897:
hselasky [Mon, 4 Dec 2017 09:54:03 +0000 (09:54 +0000)]
MFC r325897:
Improve the library dependencies helper script in src/tools.

Implement double pass of the relevant Makefiles. First make a list of
library names and directories and then scan for all the dependencies.
Spaces in directories in the source tree are not supported.

This avoids using hardcoded mappings between the library name
and the directory containing the library Makefile.

Add support for scanning contrib/ofed .

Bail out on any errors.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@326521 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326161:
hselasky [Mon, 4 Dec 2017 09:46:08 +0000 (09:46 +0000)]
MFC r326161:
Implement atomic_fetchadd_64() for i386. This function is needed by the
atomic64 header file in the LinuxKPI for i386.

Reviewed by: kib
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@326515 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326392:
hselasky [Mon, 4 Dec 2017 09:27:36 +0000 (09:27 +0000)]
MFC r326392:
Properly define the VLAN_XXX() function macros to avoid miscompilation when
used inside "if" statements comparing with another value.

Detailed explanation:
"if (a ? b : c != 0)" is not the same like "if ((a ? b : c) != 0)"
which is the expected behaviour of a function macro.

Affects:
toecore, linuxkpi and ibcore.

Reviewed by: kib
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@326512 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326070: zfs_write: fix problem with writes appearing to succeed when over quota
avg [Fri, 1 Dec 2017 11:14:13 +0000 (11:14 +0000)]
MFC r326070: zfs_write: fix problem with writes appearing to succeed when over quota

The problem happens when the writes have offsets and sizes aligned with
a filesystem's recordsize (maximum block size).  In this scenario
dmu_tx_assign() would fail because of being over the quota, but the uio
would already be modified in the code path where we copy data from the
uio into a borrowed ARC buffer.  That makes an appearance of a partial
write, so zfs_write() would return success and the uio would be modified
consistently with writing a single block.

That bug can result in a data loss because the writes over the quota
would appear to succeed while the actual data is being discarded.

This commit fixes the bug by ensuring that the uio is not changed until
after all error checks are done.  To achieve that the code now uses
uiocopy() + uioskip() as in the original illumos design.  We can do that
now that uiocopy() has been updated in r326067 to use
vn_io_fault_uiomove().

git-svn-id: svn://svn.freebsd.org/base/stable/10@326428 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326067: make illumos uiocopy use vn_io_fault_uiomove
avg [Fri, 1 Dec 2017 11:11:25 +0000 (11:11 +0000)]
MFC r326067: make illumos uiocopy use vn_io_fault_uiomove

git-svn-id: svn://svn.freebsd.org/base/stable/10@326426 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r325850: pfctl: teach route-to to deal with interfaces with multiple addresses
kp [Thu, 30 Nov 2017 21:32:28 +0000 (21:32 +0000)]
MFC r325850: pfctl: teach route-to to deal with interfaces with multiple addresses

The route_host parsing code set the interface name, but only for the first
node_host in the list. If that one happened to be the inet6 address and the
rule wanted an inet address it'd get removed by remove_invalid_hosts() later
on, and we'd have no interface name.

We must set the interface name for all node_host entries in the list, not just
the first one.

PR: 223208

git-svn-id: svn://svn.freebsd.org/base/stable/10@326414 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326122:
kib [Thu, 30 Nov 2017 14:38:07 +0000 (14:38 +0000)]
MFC r326122:
Kill all descendants of the reaper, even if they are descendants of a
subordinate reaper.  Also, mark reapers when listing pids.

PR: 223745

git-svn-id: svn://svn.freebsd.org/base/stable/10@326397 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326135: bfd: fix segfault in the ihex parser on malformed ihex file
emaste [Thu, 30 Nov 2017 00:27:49 +0000 (00:27 +0000)]
MFC r326135: bfd: fix segfault in the ihex parser on malformed ihex file

From binutils commit 0102ea8cec5fc509bba6c91df61b7ce23a799d32, made
available under GPLv2 by Nick Clifton.

PR: 198824
Security: CVE-2014-8503

git-svn-id: svn://svn.freebsd.org/base/stable/10@326382 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326136: bfd: avoid crash on corrupt binaries
emaste [Thu, 30 Nov 2017 00:25:25 +0000 (00:25 +0000)]
MFC r326136: bfd: avoid crash on corrupt binaries

From binutils commits 5a4b0ccc20ba30caef53b01bee2c0aaa5b855339 and
7e1e19887abd24aeb15066b141cdff5541e0ec8e, made available under GPLv2
by Nick Clifton.

PR: 198824
Security: CVE-2014-8501
Security: CVE-2014-8502

git-svn-id: svn://svn.freebsd.org/base/stable/10@326380 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326082: freebsd-update: do not duplicate patchlist entries
emaste [Wed, 29 Nov 2017 20:44:40 +0000 (20:44 +0000)]
MFC r326082: freebsd-update: do not duplicate patchlist entries

PR: 221079
Submitted by: Masachika ISHIZUKA
Submitted by: ota@j.email.ne.jp
Reviewed by: cperciva

git-svn-id: svn://svn.freebsd.org/base/stable/10@326374 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument SA-17:06 through SA-17:11 and EN-17:07 through EN:17-10.
gjb [Wed, 29 Nov 2017 14:45:28 +0000 (14:45 +0000)]
Document SA-17:06 through SA-17:11 and EN-17:07 through EN:17-10.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@326368 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoAvoid out-of-bounds read.
delphij [Wed, 29 Nov 2017 05:35:28 +0000 (05:35 +0000)]
Avoid out-of-bounds read.

Security: CVE-2017-3735
Security: FreeBSD-SA-17:11.openssl
Obtained from: OpenSSL https://github.com/openssl/openssl/pull/4276

git-svn-id: svn://svn.freebsd.org/base/stable/10@326357 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r325363:
asomers [Tue, 28 Nov 2017 19:57:16 +0000 (19:57 +0000)]
MFC r325363:

Fix mpr(4) panics caused by bad drive mapping tables

sys/dev/mpr/mpr_mapping.c
If _mapping_process_dpm_pg0 detects inconsistencies in the drive
mapping table (stored in the HBA's NVRAM), abort reading it and
continue to boot as if the mapping table were blank.  I observed
such inconsistencies in several HBAs after upgrading firmware from
14.0.0.0 to 15.0.0.0.

Reviewed by: slm
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12901

git-svn-id: svn://svn.freebsd.org/base/stable/10@326341 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r324805:
asomers [Tue, 28 Nov 2017 19:46:48 +0000 (19:46 +0000)]
MFC r324805:

Fix the mps(4) HISTORY section.

Looks like a copy/paste error from r302673.

Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@326340 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r324221:
asomers [Tue, 28 Nov 2017 18:44:58 +0000 (18:44 +0000)]
MFC r324221:

MFV r316861: 6866 zdb -l should return non-zero if it fails to find any label

illumos/illumos-gate@64723e361134b2a2c45341334174f9d34002f8d0
https://github.com/illumos/illumos-gate/commit/64723e361134b2a2c45341334174f9d34002f8d0

https://www.illumos.org/issues/6866
  Need this for #6865.
  To be generally more scripting-friendly, overload this issue with adding '-q'
  option which should skip printing any label information.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@326336 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r324220:
asomers [Tue, 28 Nov 2017 18:35:58 +0000 (18:35 +0000)]
MFC r324220:

MFC r316858 7280 Allow changing global libzpool variables in zdb

7280 Allow changing global libzpool variables in zdb and ztest through command line

illumos/illumos-gate@0e60744c982adecd0a1f146f5637475d07ab1069
https://github.com/illumos/illumos-gate/commit/0e60744c982adecd0a1f146f5637475d07ab1069

https://www.illumos.org/issues/7280
  zdb is very handy for diagnosing problems with a pool in a safe and
  quick way. When a pool is in a bad shape, we often want to disable some
  fail-safes, or adjust some tunables in order to open them. In the
  kernel, this is done by changing public variables in mdb. The goal of
  this feature is to add the same capability to zdb and ztest, so that
  they can change libzpool tuneables from the command line.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@326335 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323813:
asomers [Tue, 28 Nov 2017 18:27:25 +0000 (18:27 +0000)]
MFC r323813:

MFV r323789:  8473 scrub does not detect errors on active spares

illumos/illumos-gate@554675eee75dd2d7398d960aa5c81083ceb8505a
https://github.com/illumos/illumos-gate/commit/554675eee75dd2d7398d960aa5c81083ceb8505a

https://www.illumos.org/issues/8473
Scrubbing is supposed to detect and repair all errors in the pool. However,
it wrongly ignores active spare devices. The problem can easily be
reproduced in OpenZFS at git rev 0ef125d with these commands:

truncate -s 64m /tmp/a /tmp/b /tmp/c
sudo zpool create testpool mirror /tmp/a /tmp/b spare /tmp/c
sudo zpool replace testpool /tmp/a /tmp/c
/bin/dd if=/dev/zero bs=1024k count=63 oseek=1 conv=notrunc of=/tmp/c
sync
sudo zpool scrub testpool
zpool status testpool # Will show 0 errors, which is wrong
sudo zpool offline testpool /tmp/a
sudo zpool scrub testpool
zpool status testpool # Will show errors on /tmp/c,
      # which should've already been fixed

FreeBSD head is partially affected: the first scrub will detect some errors, but the second scrub will detect more.

Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@326334 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323275, r324112
asomers [Tue, 28 Nov 2017 18:18:39 +0000 (18:18 +0000)]
MFC r323275, r324112

r323275:
Add basic tests for chflags, mkdir, rcp, and rmdir

Add basic command line parsing test coverage for these utilities.  The tests
were automatically generated based on their man pages.  These tests can be
expanded by hand for more thorough coverage.  The aim is to generate very
basic amount of test coverage for all the utilities in the base system.

Submitted by: shivansh
Reviewed by: asomers, brooks
Sponsored by: Google, Inc (GSoC 2017)
Differential Revision: https://reviews.freebsd.org/D12036

r324112:
Fix Makefile entries from r323275

Reported by: Vladimir Zakharov <zakharov.vv@gmail.com>
Reviewed by: ngie
X-MFC-With: 323275

git-svn-id: svn://svn.freebsd.org/base/stable/10@326332 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323194:
asomers [Tue, 28 Nov 2017 17:33:10 +0000 (17:33 +0000)]
MFC r323194:

Fix remounting ZFS filesystem with "zfs mount"

"zfs mount -o" passes a list of mount options directly to nmount(2) after
sanity checking them. In particular, zfs(8) will refuse to mount an already
existing file system unless "remount" is specified in the option list.
However, the "remount" option only exists in Illumos. FreeBSD's equivalent is
"update".

PR: 221985
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12233

git-svn-id: svn://svn.freebsd.org/base/stable/10@326328 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323193:
asomers [Tue, 28 Nov 2017 17:30:25 +0000 (17:30 +0000)]
MFC r323193:

Honor all options of "zfs mount -o"

The existing code in zmount incorrectly parses the comma-delimited option
string. The result is that nmount only honors the last option. AFAICT the
parsing has been broken ever since ZFS's initial import in change 168404.

PR: 222078
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12232

git-svn-id: svn://svn.freebsd.org/base/stable/10@326327 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322868:
asomers [Tue, 28 Nov 2017 17:27:00 +0000 (17:27 +0000)]
MFC r322868:

Fix 100.chksetuid and 110.neggrpperm for mountpoints with spaces

Also, fix them for mountpoints with tabs.

PR: 48325
Reported by: pguyot@kallisys.net, aaron@baugher.biz

git-svn-id: svn://svn.freebsd.org/base/stable/10@326326 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322546:
asomers [Tue, 28 Nov 2017 17:25:24 +0000 (17:25 +0000)]
MFC r322546:

Fix some ZFS debugging messages

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Be more careful about the use of provider names vs vdev names in
ZFS_LOG statements.

Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@326325 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r301679 (partial), r309626, r326307
brooks [Tue, 28 Nov 2017 17:20:53 +0000 (17:20 +0000)]
MFC r301679 (partial), r309626, r326307

r301679:
Update to a June 8th snapshot of (un)vis form NetBSD.

This adds stravis() and some new encoding flags VIS_SHELL, VIS_META,
and VIS_NOLOCALE.

Assorted cleanups and fixes includeing a manpage typo[0].

NOTE: The symbol for stravis() is not exported in this merge.

r309626:
strvis(3): Avoid internal state of multibyte functions being tainted.

The mbtoc(3) and wctomb(3) functions use internal state which may be
tainted before the call to strvis(3).  In this context we can just use
the thread-safe versions mbrtoc(3) and wcrtomb(3) which allow passing
our own state from our stack.

r326307:
Update vis(3) the latest from NetBSD.

This adds VIS_DQ for compatiblity with OpenBSD.

Correct by an off-by-one error and a read buffer overflow detected using
asan.

PR: 210013 [0]
Submitted by: pi [0]

git-svn-id: svn://svn.freebsd.org/base/stable/10@326324 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r326068:
gjb [Mon, 27 Nov 2017 15:12:14 +0000 (15:12 +0000)]
MFC r326068:
 Remove /etc/resolv.conf from virtual machine images, which is
 copied from the build host.  It is renamed to /etc/resolv.conf.bak
 on boot, so never used anyway.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@326264 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r325755: Be more careful when doing calculation with request from
delphij [Mon, 27 Nov 2017 03:49:51 +0000 (03:49 +0000)]
MFC r325755: Be more careful when doing calculation with request from
userland.

git-svn-id: svn://svn.freebsd.org/base/stable/10@326243 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f