]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r327770: lld: introduce basic man page
emaste [Wed, 24 Jan 2018 00:52:25 +0000 (00:52 +0000)]
MFC r327770: lld: introduce basic man page

Upstream lld has no man page. Introduce a basic one for FreeBSD based on
ld.lld --help, with a brief introduction and additional detail for some
options.

We'll continue refining this in FreeBSD, and then submit it upstream once
the first round of edits are complete.

Submitted by: krion, Arshan Khanifar, emaste, bjk
Sponsored by: The FreeBSD Foundation

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.

6 years agoMFC r328221:
pfg [Wed, 24 Jan 2018 00:11:46 +0000 (00:11 +0000)]
MFC r328221:

Define a new __alloc_size2 attribute to complement the existing support.

At least on GCC7, calling __alloc_size(x) twice is not equivalent to
calling using the attribute once with two arguments. The later is the
documented use in GCC documentation so add a new alloc_size(n, x)
alternative to cover for the few places where it is used: basically:
calloc(3), reallocarray(3) and  mallocarray(9).

Submitted by: Mark Millard

6 years agoMFC 320900,323882,324224,324226,324228,326986,326988,326989,326990,326993,
jhb [Tue, 23 Jan 2018 20:08:25 +0000 (20:08 +0000)]
MFC 320900,323882,324224,324226,324228,326986,326988,326989,326990,326993,
326994,326995,327004: Various fixes for pathconf(2).

The original change to use vop_stdpathconf() more widely was motivated
by a panic due to recent AIO-related changes.  However, bde@ reported
that vop_stdpathconf() contained too many settings that were not
filesystem-independent.  The end result of this set of patches is to
fix the AIO-related panic via use of a trimmed-down vop_stdpathconf()
while also adding support for missing pathconf variables in various
filesystems (and removing a few settings incorrectly reported as
supported).

320900:
Consistently use vop_stdpathconf() for default pathconf values.

Update filesystems not currently using vop_stdpathconf() in pathconf
VOPs to use vop_stdpathconf() for any configuration variables that do
not have filesystem-specific values.  vop_stdpathconf() is used for
variables that have system-wide settings as well as providing default
values for some values based on system limits.  Filesystems can still
explicitly override individual settings.

323882:
Only handle _PC_MAX_CANON, _PC_MAX_INPUT, and _PC_VDISABLE for TTY devices.

Move handling of these three pathconf() variables out of vop_stdpathconf()
and into devfs_pathconf() as TTY devices can only be devfs files.  In
addition, only return settings for these three variables for devfs devices
whose device switch has the D_TTY flag set.

324224:
Handle _PC_FILESIZEBITS and _PC_SYMLINK_MAX pathconf() requests in cd9660.

cd9660 only supports symlinks with Rock Ridge extensions, so
_PC_SYMLINK_MAX is conditional on Rock Ridge.

324226:
Return 64 for pathconf(_PC_FILESIZEBITS) on tmpfs.

324228:
Flesh out pathconf() on UDF.

- Return 64 bits for _PC_FILESIZEBITS.
- Handle _PC_SYMLINK_MAX.
- Defer _PC_PATH_MAX to vop_stdpathconf().

326986:
Add a custom VOP_PATHCONF method for fdescfs.

The method handles NAME_MAX and LINK_MAX explicitly.  For all other
pathconf variables, the method passes the request down to the underlying
file descriptor.  This requires splitting a kern_fpathconf() syscallsubr
routine out of sys_fpathconf().  Also, to avoid lock order reversals with
vnode locks, the fdescfs vnode is unlocked around the call to
kern_fpathconf(), but with the usecount of the vnode bumped.

326988:
Add a custom VOP_PATHCONF method for fuse.

This method handles _PC_FILESIZEBITS, _PC_SYMLINK_MAX, and _PC_NO_TRUNC.
For other values it defers to vop_stdpathconf().

326989:
Support _PC_FILESIZEBITS in msdosfs' VOP_PATHCONF().

326990:
Handle _PC_FILESIZEBITS and _PC_NO_TRUNC for smbfs' VOP_PATHCONF().

326993:
Move NAME_MAX, LINK_MAX, and CHOWN_RESTRICTED out of vop_stdpathconf().

Having all filesystems fall through to default values isn't always correct
and these values can vary for different filesystem implementations.  Most
of these changes just use the existing default values with a few exceptions:
- Don't report CHOWN_RESTRICTED for ZFS since it doesn't do the exact
  permissions check this claims for chown().
- Use NANDFS_NAME_LEN for NAME_MAX for nandfs.
- Don't report a LINK_MAX of 0 on smbfs.  Now fail with EINVAL to
  indicate hard links aren't supported.

326994:
Handle _PC_FILESIZEBITS and _PC_SYMLINK_MAX for devfs' VOP_PATHCONF().

326995:
Use FUSE_LINK_MAX for LINK_MAX in fuse' VOP_PATHCONF().

Should have included this in r326993.

327004:
Rework pathconf handling for FIFOs.

On the one hand, FIFOs should respect other variables not supported by
the fifofs vnode operation (such as _PC_NAME_MAX, _PC_LINK_MAX, etc.).
These values are fs-specific and must come from a fs-specific method.
On the other hand, filesystems that support FIFOs are required to
support _PC_PIPE_BUF on directory vnodes that can contain FIFOs.
Given this latter requirement, once the fs-specific VOP_PATHCONF
method supports _PC_PIPE_BUF for directories, it is also suitable for
FIFOs permitting a single VOP_PATHCONF method to be used for both
FIFOs and non-FIFOs.

To that end, retire all of the FIFO-specific pathconf methods from
filesystems and change FIFO-specific vnode operation switches to use
the existing fs-specific VOP_PATHCONF method.  For fifofs, set it's
VOP_PATHCONF to VOP_PANIC since it should no longer be used.

While here, move _PC_PIPE_BUF handling out of vop_stdpathconf() so that
only filesystems supporting FIFOs will report a value.  In addition,
only report a valid _PC_PIPE_BUF for directories and FIFOs.

PR: 219851
Sponsored by: Chelsio Communications

6 years agoMFC 323993: Use tmpfs_print for tmpfs FIFOs.
jhb [Tue, 23 Jan 2018 19:00:13 +0000 (19:00 +0000)]
MFC 323993: Use tmpfs_print for tmpfs FIFOs.

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

6 years agoMFC r327675
kp [Tue, 23 Jan 2018 04:30:46 +0000 (04:30 +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>

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

6 years agoMFC r328008:
eadler [Mon, 22 Jan 2018 04:15:12 +0000 (04:15 +0000)]
MFC r328008:

units(1) free savescr in error condition too

CID:          978392

6 years agoMFC r322245: MFV r322242: 8373 TXG_WAIT in ZIL commit path
mav [Mon, 22 Jan 2018 00:19:50 +0000 (00:19 +0000)]
MFC r322245: MFV r322242: 8373 TXG_WAIT in ZIL commit path

illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7
https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7

https://www.illumos.org/issues/8373
  The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign
  a transaction to a transaction group.  That seems to be logically
  incorrect as writing of the ZIL block does not introduce any new dirty
  data.  Also, when there is a lot of dirty data, the call can introduce
  significant delays into the ZIL commit path, thus affecting all
  synchronous writes. Additionally, ARC throttling may affect the ZIL
  writing.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Andriy Gapon <avg@FreeBSD.org>

6 years agoMFC r327965:
kib [Sun, 21 Jan 2018 10:43:01 +0000 (10:43 +0000)]
MFC r327965:
Add STAC and CLAC instructions wrappers.

6 years agoMFC r327964:
kib [Sun, 21 Jan 2018 10:39:57 +0000 (10:39 +0000)]
MFC r327964:
Enumerate and print Intel CPU features for Speculative Execution Side
Channel Mitigations.

6 years agoMFC r323822 (by cem):
kib [Sun, 21 Jan 2018 10:38:38 +0000 (10:38 +0000)]
MFC r323822 (by cem):
x86: Decode AMD "Extended Feature Extensions ID EBX" bits.

6 years agoMFC r327963:
kib [Sun, 21 Jan 2018 10:35:17 +0000 (10:35 +0000)]
MFC r327963:
When re-evaluating cpu_features, also re-print CPU identification.

6 years agoMFC r327674, r327796
kp [Sat, 20 Jan 2018 23:46:03 +0000 (23:46 +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

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

Remove redundant variable.

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.

6 years agoMFC r327917:
kib [Sat, 20 Jan 2018 12:31:21 +0000 (12:31 +0000)]
MFC r327917:
Add sysctl debug.kdb.stack_overflow.

6 years agoMFC r327946 r327947:
eadler [Sat, 20 Jan 2018 01:01:28 +0000 (01:01 +0000)]
MFC r327946 r327947:

limits(1): fix grammar

PR:           225147

6 years agoMFC r323317 (by scottl): Move the intrhook release to later in the function
mav [Fri, 19 Jan 2018 16:06:52 +0000 (16:06 +0000)]
MFC r323317 (by scottl): Move the intrhook release to later in the function
so that GEOM knows to wait longer for possible root devices to come online.
This fixes a race that seems to be triggered by EARLY_AP_STARTUP.

Submitted by: cgull@glup.org

6 years agoMFC r322288: regex(3): Refactor fast/slow stepping bits in matching engine
kevans [Thu, 18 Jan 2018 22:13:31 +0000 (22:13 +0000)]
MFC r322288: regex(3): Refactor fast/slow stepping bits in matching engine

Adding features for matching is fairly straightforward, but this requires
some duplication because of this fast/slow setup. They can be fairly
trivially combined into a single walk(), so do it to make future additions
less error prone.

6 years agoMFC r320742, r320750, r320796: Refactor regex(3) for maintainability
kevans [Thu, 18 Jan 2018 22:10:00 +0000 (22:10 +0000)]
MFC r320742, r320750, r320796: Refactor regex(3) for maintainability

MFC r320742:
The impending libregex will implement GNU extensions to bring BREs and
EREs closer together. Prepare for this and reduce the diff of libregex
changes by refactoring and combining the top-level parsers for EREs/BREs
ahead of time.

Branching functionality has been split out to make it easier to follow the
combined version of the top-level parser. It may also be enabled in the
parsing context to make it easier when libregex enables branching for BREs.

A branching context was also added for the various branching functions and
so that BREs, for instance, can determine if they're the first expression in
a chain of expressions within the current branch and treat '*' as ordinary
if so.

This should have no functional impact and negligible performance impact.

MFC r320750: Fix sparc64 libc build after r320742.

p_branch_empty was declared but never used due to an oversight. Use it as
designed, further comment on its return value.

MFC r320796:
Correctly ignore branch operators in the top-level parser when applicable.

An oversight in r320742 caused BREs to become sensitive to the branching
operator prematurely, which caused breakage in some limited situations --
namely, those that tried to use branching in a BRE. Most of these scenarios
had already been corrected beforehand to properly use gsed or grep for GNU
extensions, so the damage is slightly mitigated.

6 years agoMFC r327567: hexdump(1): Speed up -s flag on devices
kevans [Thu, 18 Jan 2018 21:59:13 +0000 (21:59 +0000)]
MFC r327567: hexdump(1): Speed up -s flag on devices

Using the -s flag on devices is extraordinarily slow due to using fseek(3) a
little too conservatively. Address this by using fseek on character/block
devices as well, falling back to getchar(3) only if we fail to seek or we're
operating on tape drives, where fseek may succeed while not actually being
supported.

PR: 86485

6 years agoMFC r326084: patch(1): don't assume match if we run out of context to check
kevans [Thu, 18 Jan 2018 21:53:07 +0000 (21:53 +0000)]
MFC r326084: patch(1): don't assume match if we run out of context to check

Patches with very little context (-U0 and -U1) could get misapplied if
the file to be patched changes and a hunk is no longer applicable. Matching
with fuzz would be attempted and default to a match when we unexpectedly ran
out of context.

This also affected patches with higher levels of context but had limited
actual context due to the hunk being located near the beginning/end of file.

PR: 74127

6 years agoMFC r324431: patch(1): Don't overrun line buffer in some cases
kevans [Thu, 18 Jan 2018 21:46:42 +0000 (21:46 +0000)]
MFC r324431: patch(1): Don't overrun line buffer in some cases

Patches like file.txt attached to PR 190195 with a final line formed
like ">(EOL)" could cause a copy past the end of the current line buffer. In
the case of PR 191641, this caused a duplicate line to be copied into the
resulting file.

Instead of running past the end, treat it as if it were a blank line.

PR: 191641

6 years agoMFC r322322: Expose device caps as libusb_bos_descriptor::dev_capability
kevans [Thu, 18 Jan 2018 21:39:03 +0000 (21:39 +0000)]
MFC r322322: Expose device caps as libusb_bos_descriptor::dev_capability

Some libusb consumers in Linux-land (in this case, libusb4java) expect a
dev_capability member that they can use to enumerate the device
capabilities.

No particular layout is expected of this, just that it can be traversed
using the bLength member until bNumDeviceCapabilities are read and that the
consumer may then use one of the libusb_get_*_descriptor methods to extract
specific (usb 2.0 vs. ss) capability information.

6 years agoMFC r322293: df(1): Add --si as an alias for -H
kevans [Thu, 18 Jan 2018 21:35:18 +0000 (21:35 +0000)]
MFC r322293: df(1): Add --si as an alias for -H

6 years agoMFC r322291: du(1): Add --si option to display in terms of powers of 1000
kevans [Thu, 18 Jan 2018 21:32:50 +0000 (21:32 +0000)]
MFC r322291: du(1): Add --si option to display in terms of powers of 1000

6 years agoMFC r322177: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)
kevans [Thu, 18 Jan 2018 21:29:46 +0000 (21:29 +0000)]
MFC r322177: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)

Instead of using a non-configurable ".BAK" suffix, respect the
SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This
simplifies cleanup operations in some patch/indent workflows.

6 years agoMFC r327560:
ed [Thu, 18 Jan 2018 13:43:09 +0000 (13:43 +0000)]
MFC r327560:

  Allow timed waits with relative timeouts on locks and condvars.

  Even though pthreads doesn't support this, there are various alternative
  APIs that use this. For example, uv_cond_timedwait() accepts a relative
  timeout. So does Rust's std::sync::Condvar::wait_timeout().

  Though I personally think that relative timeouts are bad (due to
  imprecision for repeated operations), it does seem that people want
  this. Extend the existing futex functions to keep track of whether an
  absolute timeout is used in a boolean flag.

6 years agoMFC r327822:
kib [Thu, 18 Jan 2018 12:14:24 +0000 (12:14 +0000)]
MFC r327822:
Skip IRELATIVE relocations when loader processes ELF files.

6 years agoMFC r327819:
kib [Thu, 18 Jan 2018 12:08:52 +0000 (12:08 +0000)]
MFC r327819:
Do not redundantly clear %RFLAGS.DF on fast syscall entry.

6 years agoMFC r327818:
kib [Thu, 18 Jan 2018 12:07:37 +0000 (12:07 +0000)]
MFC r327818:
Move the hardware setup for fast syscalls into a common function.

6 years agoMFC r327555:
kib [Thu, 18 Jan 2018 12:06:01 +0000 (12:06 +0000)]
MFC r327555:
Restructure swapout tests after vm map locking was removed.

6 years agoMFC r327450 (by alc):
kib [Thu, 18 Jan 2018 12:04:45 +0000 (12:04 +0000)]
MFC r327450 (by alc):
Eliminate "minslptime".

6 years agoMFC r327768:
markj [Wed, 17 Jan 2018 15:12:52 +0000 (15:12 +0000)]
MFC r327768:
Clarify the use of the gmirror flag mask constants.

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

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

6 years agoMFC r327723, r327821:
kib [Tue, 16 Jan 2018 10:58:31 +0000 (10:58 +0000)]
MFC r327723, r327821:
Generalize the fix from r322757 and apply it to several more places.

6 years agoMFC r327722:
kib [Tue, 16 Jan 2018 10:56:35 +0000 (10:56 +0000)]
MFC r327722:
When handling write completion, take SU lock around calls to
handle_written_XXX() in case of processing the buffer with an error.

6 years agoMFC r327721:
kib [Tue, 16 Jan 2018 10:54:32 +0000 (10:54 +0000)]
MFC r327721:
Postpone the disassotiation of the background write buffer with devvp
so that buf_complete() sees fully constructed buffer.

6 years agoMFC r327930:
dim [Tue, 16 Jan 2018 08:00:07 +0000 (08:00 +0000)]
MFC r327930:

Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):

  [Sema] Suppress warnings for C's zero initializer

  Patch by S. Gilles!

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

Pull in r314838 from upstream clang trunk (by Richard Smith):

  Suppress -Wmissing-braces warning when aggregate-initializing a
  struct with a single field that is itself an aggregate.

  In C++, such initialization of std::array<T, N> types is guaranteed
  to work by the standard, is completely idiomatic, and the "suggested"
  alternative from Clang was technically invalid.

Together, these suppress unneeded "suggest braces around initialization
of subobject" warnings for C++11 initializer lists.

6 years agoMFC r327099:
eadler [Mon, 15 Jan 2018 16:51:04 +0000 (16:51 +0000)]
MFC r327099:

fopen.1: document truncation

This documentation truncation similar to POSIX and glibc.

PR: 202545

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

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

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

6 years agoMFC r327845:
dim [Mon, 15 Jan 2018 08:04:55 +0000 (08:04 +0000)]
MFC r327845:

Pull in r316581 from upstream llvm trunk (by John Baldwin):

  Don't try to use a non-existent header on FreeBSD/mips.

  Reviewers: dim

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

Requested by: jhb

6 years agoMFC r327700:
markj [Mon, 15 Jan 2018 01:09:10 +0000 (01:09 +0000)]
MFC r327700:
Sort and remove unneeded includes.

6 years agoMFC r326281:
eadler [Sun, 14 Jan 2018 20:23:44 +0000 (20:23 +0000)]
MFC r326281:

Add vmm(4) man page

PR: 205705

6 years agoMFC r327817:
kib [Sun, 14 Jan 2018 09:33:44 +0000 (09:33 +0000)]
MFC r327817:
Rename COMMON_TSS_RSP0 to TSS_RSP0.

6 years agoMFC r327816, r327834:
kib [Sun, 14 Jan 2018 09:29:06 +0000 (09:29 +0000)]
MFC r327816, r327834:
Update comment explaining the check, to reality.

6 years agoMFC (conceptually) r327377: Pull in strnlen for sys/boot environment
kevans [Sun, 14 Jan 2018 05:10:02 +0000 (05:10 +0000)]
MFC (conceptually) r327377: Pull in strnlen for sys/boot environment

This is a direct commit to stable/11 due to restructuring of lib/libstand =>
stand/libsa in -HEAD. The diff remains the same and it is simply applied to
the previous location.

MFC r327377: Pull in strnlen from libc

strnlen is not used at the moment, but it will be when libfdt gets updated.
Prepare for the not-so-distant future by pulling in strnlen.

6 years agoMFC r327448:
bryanv [Sun, 14 Jan 2018 05:07:15 +0000 (05:07 +0000)]
MFC r327448:

Add rc.conf vxlan example

6 years agoMFC r327438:
bryanv [Sun, 14 Jan 2018 05:05:06 +0000 (05:05 +0000)]
MFC r327438:

Add VXLAN (RFC 7348) port

6 years agoMFC (conceptually) r327376, r327416: Improve libfdt compatibility
kevans [Sat, 13 Jan 2018 21:27:36 +0000 (21:27 +0000)]
MFC (conceptually) r327376, r327416: Improve libfdt compatibility

This is a direct commit to stable/11 due to restructuring of sys/boot =>
stand in -HEAD. The diff remains the same and it is simply applied to the
previous location.

MFC r327376: stand/fdt: Swap libfdt include order

libfdt.h should be included before fdt.h, as hinted at by all of libfdt/;
standard include order being libfdt.h, libfdt_env.h, fdt.h.

The current include order also causes problems when libfdt gets updated, as
fdt.h requires some definitions from libfdt.h.

MFC r327416: stand/fdt: Make fdt_overlay_apply signature-compatible with
    libfdt

libfdt will assume a writable fdt overlay blob has been passed in, so make
ours compatible to allow easier review when we try to drop libfdt into
place. overlay from the calling context is writable, making it safe to
simply rip out everything related to copying the overlay blob in
fdt_overlay_apply.

I note here that we still have problems: fdt_overlay_apply, both our version
and libfdt's, may fail and have already clobbered the base fdt to some
extent. Future work will make sure we don't apply a potentially bogus fdt,
instead discarding the base fdt if we had an error.

6 years agoMFC (conceptually) r327350: Consistently apply fdt_overlays
kevans [Sat, 13 Jan 2018 21:19:55 +0000 (21:19 +0000)]
MFC (conceptually) r327350: Consistently apply fdt_overlays

This is a direct commit to stable/11 due to restructuring of sys/boot =>
stand in -HEAD. The diff remains the same and it is simply applied to the
previous location.

MFC r327350: stand/fdt: Consistently apply fdt_overlays

Overlays were previously not applied when U-Boot provides FDT or EFI
provides FDT, only when we load FDT from /boot/dtb given name from U-Boot.

Make all three paths lead to loading fdt_overlays and applying them, so that
fdt_overlays can be expected to Just Work.

6 years agoMFC (conceptually) r327298, r327299: Fix overlay application behavior
kevans [Sat, 13 Jan 2018 21:08:38 +0000 (21:08 +0000)]
MFC (conceptually) r327298, r327299: Fix overlay application behavior

This is a direct commit to stable/11 due to restructuring of sys/boot =>
stand in -HEAD. The diff remains the same and it simply applied to the
previous location.

MFC r327298: stand/fdt: Fix loading of multiple fdt_overlays

fdt_load_dtb_overlays was written to unload previous overlay when a new
valid one is come across. fdt_apply_overlays further down is written to
iterate over all .dtbo's currently loaded and apply them one-by-one. Correct
fdt_load_dtb_overlays to stop dropping valid overlays that were previously
loaded and match expectations.

MFC r327299: stand/fdt: Avoid bailout when dtbo has no fixups

In the case of a simple dtbo where fragment uses target-path and the overlay
contains no references, /__fixups__ will not be included by either our dtc
or dtc from ports, but the file still has valid fragments to be applied.

Additional testing found that /__symbols__ might also be omitted if it's
empty, which is not necessarily an error.

6 years agoMFC r327375, r327385, r327386:
bryanv [Sat, 13 Jan 2018 17:21:45 +0000 (17:21 +0000)]
MFC r327375, r327385, r327386:

Add support for IPv6 scoped addresses to vxlan

Advertise IFCAP_LINKSTAT after r326480 added link status support

Add macro for vxlan list mutex lock and unlock

6 years agoAdd info about SW_WATCHDOG change to be dynamic in the common case.
karels [Sat, 13 Jan 2018 14:14:50 +0000 (14:14 +0000)]
Add info about SW_WATCHDOG change to be dynamic in the common case.

6 years agoMFC r327505:
karels [Sat, 13 Jan 2018 14:10:05 +0000 (14:10 +0000)]
MFC r327505:

make SW_WATCHDOG dynamic

Enable the hardclock-based watchdog previously conditional on the
SW_WATCHDOG option whenever hardware watchdogs are not found, and
watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
still causes the sofware watchdog to be enabled even if there is a
hardware watchdog. This does not change the other software-based
watchdog enabled by the --softtimeout option to watchdogd.

Note that the code to reprime the watchdog during kernel core dumps is
no longer conditional on SW_WATCHDOG. I think this was previously a bug.

Reviewed by:    imp alfred bjk
MFC after:      1 week
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D13713

6 years agoMFC r323390:
eadler [Sat, 13 Jan 2018 09:30:34 +0000 (09:30 +0000)]
MFC r323390:

If the user tries to set kern.randompid to 1 (which is meaningless), set
it to a random value between 100 and 1123, rather than 0 as before.

6 years agoMFC r324206:
eadler [Sat, 13 Jan 2018 09:28:43 +0000 (09:28 +0000)]
MFC r324206:

bsdinstall(8) hardening menu: Utilize new kern.randompid=1 behaviour

Enabling the PID randomization option in bsdinstall(8)'s hardening menu
now randomizes the effective value of kern.randompid on each boot.

Previous behaviour:
When kern.randompid was enabled via the the bsdinstall(8) hardening menu,
a random value was generated and placed in the systems /etc/sysctl.conf as
kern.randompid=value
This makes the value of kern.randompid static across reboots.

New behaviour:
When kern.randompid is enabled via the bsdinstall(8) hardening menu, the
line kern.randompid=1 is placed in the systems /etc/sysctl.conf.
This takes advantage of a new kernel feature and makes the value of
kern.randompid be randomized by the kernel on each reboot.

6 years agoFix fallout from applying a patch twice.
ian [Sat, 13 Jan 2018 03:12:21 +0000 (03:12 +0000)]
Fix fallout from applying a patch twice.

Reported by: jhb@
Pointy hat: ian@

6 years agoMFC r327697, r327699:
pfg [Fri, 12 Jan 2018 17:36:19 +0000 (17:36 +0000)]
MFC r327697, r327699:

Use the __result_use_check attribute for reallocf(9).

MFC r327751:
Use the __result_use_check attribute also for reallocf(3).

The GCC attribute causes a warning to be emitted if a caller of the
function with this attribute does not use its return value. Unlike the
traditional realloc, with reallocf(3) we don't have to check for NULL
values but we still have to make sure the result is used.

6 years agoMFC r327597:
kib [Fri, 12 Jan 2018 10:54:00 +0000 (10:54 +0000)]
MFC r327597:
Make it possible to re-evaluate cpu_features.

6 years agoMFC r327730:
kib [Fri, 12 Jan 2018 10:51:42 +0000 (10:51 +0000)]
MFC r327730:
Fix year.

6 years agoMFC r327862
asomers [Fri, 12 Jan 2018 04:31:52 +0000 (04:31 +0000)]
MFC r327862

dhclient(8): add missing include

stdbool is technically needed, though we can get away without it due to
header pollution.

Pointy-hat-to: asomers

6 years agoMFC r315292
asomers [Fri, 12 Jan 2018 04:25:16 +0000 (04:25 +0000)]
MFC r315292

r315292 (by glebius)

Fix buildworld broken in r315230 when /sys doesn't point into a right
source tree.  Usage of SYSDIR is apparently wrong here.

Discussed with: allanjude

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

6 years agoMFC r313962, r313972-r313973, r315230
asomers [Fri, 12 Jan 2018 00:31:07 +0000 (00:31 +0000)]
MFC r313962, r313972-r313973, r315230

r313962 by allanjude:
improve PBKDF2 performance

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

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

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

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

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

r313972 by ngie:
Unbreak the build when "make obj" is executed beforehand

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

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

r313973 by ngie:
A forced commit to note other portion of the Makefile change accidentally
committed in r313972

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

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

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

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

r315230 by ngie:
Move .../sys/geom/eli/pbkdf2... to .../sys/geom/class/eli/...

This change moves the tests added in r313962 to an existing directory
structure used by the geli TAP tests. It also, renames the test from
pbkdf2 to pbkdf2_test .

The changes to ObsoleteFiles.inc are being committed separately as they
aren't needed for the MFC to ^/stable/11, etc, if the MFC for the tests
is done all in one commit.

X-MFC with: r313962, r313972-r313973
Reviewed by: allanjude
Sponsored by: Dell EMC Isilon
Differential Revision: D9985

6 years agoMFC r309373 (by bdrewery)
asomers [Fri, 12 Jan 2018 00:25:56 +0000 (00:25 +0000)]
MFC r309373 (by bdrewery)

Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired.

This uses the same fix as r294894 did for the mlock test.  The code from
that commit is moved into a common object file which PROGS supports
building first.

Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D8689

6 years agoMFC r326834, r326853
asomers [Fri, 12 Jan 2018 00:01:08 +0000 (00:01 +0000)]
MFC r326834, r326853

r326834:
dhclient(8): Don't shift through the sign bit of a signed int

PR: 208007
Submitted by: Michael McConville <mmcco@mykolab.com>

r326853:
dhclient(8): raise WARNS to 3

Mostly had to fix a lot of signed/unsigned comparison warnings

Sponsored by: Spectra Logic Corp

6 years agoMFC r326799:
asomers [Fri, 12 Jan 2018 00:00:01 +0000 (00:00 +0000)]
MFC r326799:

less(1): diff reduction vs upstream

No functional change.

Sponsored by: Spectra Logic Corp

6 years agoMFC r326698:
asomers [Thu, 11 Jan 2018 23:59:27 +0000 (23:59 +0000)]
MFC r326698:

at(1): annotate some intended switch-case fallthroughs

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

6 years agoMFC r326646:
asomers [Thu, 11 Jan 2018 23:58:41 +0000 (23:58 +0000)]
MFC r326646:

Fix a null-pointer dereference and a tautological check in cam_get_device

Reported by: Coverity
CID: 1017964
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13184

6 years agoMFC r326640:
asomers [Thu, 11 Jan 2018 23:57:55 +0000 (23:57 +0000)]
MFC r326640:

Optimize telldir(3)

Currently each call to telldir() requires a malloc and adds an entry to a
linked list which must be traversed on future telldir(), seekdir(),
closedir(), and readdir() calls. Applications that call telldir() for every
directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and
closedir().

This optimization eliminates the malloc() and linked list in most cases by
packing the relevant information into a single long. On 64-bit architectures
msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation.  On
32-bit architectures msdosfs, NFS, and UFS can use the packed
representation, but ZFS and tmpfs can only use it for about the first 128
files per directory.  Memory savings is about 50 bytes per telldir(3) call.
Speedup for telldir()-heavy directory traversals is about 20-30x for one
million files per directory.

Reviewed by: kib, mav, mckusick
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13385

6 years agoMFC r326624:
asomers [Thu, 11 Jan 2018 23:56:55 +0000 (23:56 +0000)]
MFC r326624:

cam: fix sign-extension error in adagetparams

adagetparams contains a sign-extension error that will cause the sector
count to be incorrectly calculated for ATA disks of >=1TiB that still use
CHS addressing. Disks using LBA48 addressing are unaffected.

Reported by: Coverity
CID: 1007296
Reviewed by: ken
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13198

6 years agoMFC r326455:
asomers [Thu, 11 Jan 2018 23:56:01 +0000 (23:56 +0000)]
MFC r326455:

Reap dead code

usr.bin/dc/inout.c
Reap some dead code that was killed back in 2003 in OpenBSD, in
version 1.8 of this file.

6 years agoAdd description files for WITH/WITHOUT_LINT. These should have been part
ian [Thu, 11 Jan 2018 19:41:00 +0000 (19:41 +0000)]
Add description files for WITH/WITHOUT_LINT.  These should have been part
of r327837.

PR: 223892
Differential Revision:  https://reviews.freebsd.org/D13799

6 years agoDo not build lint(1) by default on stable-11, add WITH_LINT to enable
ian [Thu, 11 Jan 2018 17:51:22 +0000 (17:51 +0000)]
Do not build lint(1) by default on stable-11, add WITH_LINT to enable
building it.

lint(1) is required on the host build system to build lint(1) libraries, and
it is no longer available on FreeBSD 12. This prevents using a 12 or later
host to build an 11 or earlier system, which causes problems for building
jails and using poudriere. The problem could be fixed by treating lint as a
bootstrap tool when building on 12+, but that just adds complexity and build
time to build a broken tool that virtually nobody uses anymore.

This is a direct commit to 11-stable because lint no longer exists in later
branches.

PR: 223892
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D13799

6 years agoMFC r324125 (andreast):
markj [Thu, 11 Jan 2018 15:32:12 +0000 (15:32 +0000)]
MFC r324125 (andreast):
Initialize mdsize to make gcc happy again.

6 years agoMFC r327235:
delphij [Thu, 11 Jan 2018 07:06:22 +0000 (07:06 +0000)]
MFC r327235:

Don't initialize lastlong before assigning it.

6 years agoMFC r327698:
markj [Thu, 11 Jan 2018 00:54:54 +0000 (00:54 +0000)]
MFC r327698:
Release the queue lock before restarting the worker loop.

6 years agoMFC r327289:
pfg [Wed, 10 Jan 2018 21:17:33 +0000 (21:17 +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

6 years agoMFC r327525:
markj [Wed, 10 Jan 2018 21:05:46 +0000 (21:05 +0000)]
MFC r327525:
Add missing newlines to a couple of error messages.

6 years agoMFC r327168, r327213:
markj [Wed, 10 Jan 2018 20:48:21 +0000 (20:48 +0000)]
MFC r327168, r327213:
Fix two problems with the page daemon control loop.

6 years agoMFC r325530 (jeff), r325566 (kib), r325588 (kib):
markj [Wed, 10 Jan 2018 20:39:26 +0000 (20:39 +0000)]
MFC r325530 (jeff), r325566 (kib), r325588 (kib):
Replace many instances of VM_WAIT with blocking page allocation flags.

6 years agoMFC r327236:
delphij [Wed, 10 Jan 2018 09:06:07 +0000 (09:06 +0000)]
MFC r327236:

Replace send-mail with the more standarized sendmail, we do not create
links for send-mail in mailwrapper so it did not work anyway.

6 years agoMFC r327517:
kib [Wed, 10 Jan 2018 08:10:18 +0000 (08:10 +0000)]
MFC r327517:
Use the new SDM-approved way to serialize x2APIC MSR writes.

6 years agoMFC r327625:
kib [Tue, 9 Jan 2018 09:26:16 +0000 (09:26 +0000)]
MFC r327625:
Document kern.smp.disabled tunable.

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

Correct function name in description block.

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.

6 years agoMFC r327489: elfcopy: copy raw (untranslated) contents to binary output
emaste [Tue, 9 Jan 2018 00:27:02 +0000 (00:27 +0000)]
MFC r327489: elfcopy: copy raw (untranslated) contents to binary output

Previously elfcopy used elf_getdata to obtain data from ELF sections
being copied to binary output, but elf_getdata returns data that has
been translated - that is, data is in host byte order. When the host and
target differ in endianness (e.g., converting a big-endian MIPS ELF
object to binary on an x86 host) this resulted in byte-swapped data in
certain sections such as .dynamic.

Instead use elf_rawdata to keep data in the original, target endianness.

Reported by: Hiroki Mori <yamori83@yahoo.co.jp>, Bill Yuan
Sponsored by: The FreeBSD Foundation

6 years agoMFC r322547:
markj [Mon, 8 Jan 2018 16:36:33 +0000 (16:36 +0000)]
MFC r322547:
Add vm_page_alloc_after().

6 years agoMFC r327468:
kib [Mon, 8 Jan 2018 13:19:15 +0000 (13:19 +0000)]
MFC r327468:
Do not let vm_daemon run unbounded.

6 years agoMFC r327472:
kib [Mon, 8 Jan 2018 12:56:53 +0000 (12:56 +0000)]
MFC r327472:
Avoid re-check of usermode condition.

6 years agoMFC r327578:
eadler [Mon, 8 Jan 2018 00:57:28 +0000 (00:57 +0000)]
MFC r327578:

units(1): add missing ':' for two short arguments

PR:           209850

6 years agoMFC r326769:
bapt [Sun, 7 Jan 2018 10:29:15 +0000 (10:29 +0000)]
MFC r326769:

Remove hard coded number of lun definition

The number of lun exposed is now exposed via sysctl by the kernel.
Use that number in ctlstat instead of the hardcoded version
Add a backward compatibility in case the sysctl(2) request fails.

This also allows ctlstat -l 1118 to actually work when having more than
1024 luns.

Reviewed by: avg, manu (both before the backward compatibility addition)
Approved by: avg, manu (both before the backward compatibility addition)
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D13446

6 years agoMFC r327220-r327221
ian [Sun, 7 Jan 2018 02:59:27 +0000 (02:59 +0000)]
MFC r327220-r327221

r327220:
Update the FDT example for the lm75 sensor to match current devicetree
standards and what the existing driver expects.

Also change 'like' to 'such as' where the text is providing an example
rather than a simile.

r327221:
Complete the changing of the old "i2c-address" property to the modern "reg"
property by updating the description text to match the updated example.

This should have been part of r327220

6 years agoMFC r327222:
ian [Sun, 7 Jan 2018 02:57:35 +0000 (02:57 +0000)]
MFC r327222:

Add a new ARM kernel option, LOCORE_MAP_MB, to control the size of the
kernel VA mapping in the temporary page tables set up by locore-v6.S.

The number used to be hard-coded to 64MB, which is still the default if
the kernel option is not specified.  However, 64MB is insufficient for
using a large mdroot filesystem.  The hard-coded number can't be safely
increased because too large a number may run into memory-mapped IO space
on some SoCs that must not be mapped as ordinary memory.