]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoAdd kyua TAP test integration examples
Enji Cooper [Wed, 28 Jun 2017 08:22:04 +0000 (08:22 +0000)]
Add kyua TAP test integration examples

The examples are patterned loosely after the ATF examples, similar
to the plain test examples.

MFC after: 1 month

7 years agoshare/examples/tests/{atf,plain}/Makefile: tweak example Makefile snippets
Enji Cooper [Wed, 28 Jun 2017 08:20:51 +0000 (08:20 +0000)]
share/examples/tests/{atf,plain}/Makefile: tweak example Makefile snippets

- Including bsd.own.mk isn't required since no MK_<foo> knobs are being
  manipulated.
- Update documentation to note that ${FILES} is installed via bsd.progs.mk,
  not bsd.prog.mk.

MFC after: 1 month

7 years agoshare/examples/tests/Makefile: clean up example snippets/documentation
Enji Cooper [Wed, 28 Jun 2017 07:01:22 +0000 (07:01 +0000)]
share/examples/tests/Makefile: clean up example snippets/documentation

- TESTSDIR doesn't need to be specified after r289158.
- Including bsd.own.mk isn't required since no MK_<foo> knobs are being
  manipulated.
- TESTS_SUBDIRS should be written out in an append format, one entry
  per line, to provide a better, more conflict resistant example.

MFC after:      1 month

7 years agoUse strlcpy() instead of strncpy() and nul-terminating.
Xin LI [Wed, 28 Jun 2017 04:24:10 +0000 (04:24 +0000)]
Use strlcpy() instead of strncpy() and nul-terminating.

MFC after: 2 weeks

7 years agoChase malloc() change by removing lg_chunk malloc_conf settings.
Xin LI [Wed, 28 Jun 2017 04:19:54 +0000 (04:19 +0000)]
Chase malloc() change by removing lg_chunk malloc_conf settings.

In jemalloc 5, there are no longer chunks, and as configured on
FreeBSD (the "retain" option defaults to false), the mmap()
requests are precisely sized for the specific needs, which means
the virtual memory overhead should be lower for small applications.

Reviewed by: jasone, ian
Differential Revision: https://reviews.freebsd.org/D11366

7 years agoTreat the addr argument for mmap(2) request without MAP_FIXED flag as
Konstantin Belousov [Wed, 28 Jun 2017 04:02:36 +0000 (04:02 +0000)]
Treat the addr argument for mmap(2) request without MAP_FIXED flag as
a hint.

Right now, for non-fixed mmap(2) calls, addr is de-facto interpreted
as the absolute minimal address of the range where the mapping is
created.  The VA allocator only allocates in the range [addr,
VM_MAXUSER_ADDRESS].  This is too restrictive, the mmap(2) call might
unduly fail if there is no free addresses above addr but a lot of
usable space below it.

Lift this implementation limitation by allocating VA in two passes.
First, try to allocate above addr, as before.  If that fails, do the
second pass with less restrictive constraints for the start of
allocation by specifying minimal allocation address at the max bss
end, if this limit is less than addr.

One important case where this change makes a difference is the
allocation of the stacks for new threads in libthr.  Under some
configuration conditions, libthr tries to hint kernel to reuse the
main thread stack grow area for the new stacks.  This cannot work by
design now after grow area is converted to stack, and there is no
unallocated VA above the main stack.  Interpreting requested stack
base address as the hint provides compatibility with old libthr and
with (mis-)configured current libthr.

Reviewed by: alc
Tested by: dim (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoIn poolnodecommand() (ippool -a and ippool -r) -m (pool name) is not
Cy Schubert [Wed, 28 Jun 2017 02:30:32 +0000 (02:30 +0000)]
In poolnodecommand() (ippool -a and ippool -r) -m (pool name) is not
optional.

7 years agoSpelling.
Greg Lehey [Wed, 28 Jun 2017 00:50:51 +0000 (00:50 +0000)]
Spelling.

7 years agocxgbe/t4_tom: Do not include space taken by the TCP timestamp option in
Navdeep Parhar [Tue, 27 Jun 2017 22:05:06 +0000 (22:05 +0000)]
cxgbe/t4_tom: Do not include space taken by the TCP timestamp option in
the "effective MSS" for the connection.  The chip expects it this way.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agoReport some aspects of namespaces and namespace support in identify
Warner Losh [Tue, 27 Jun 2017 20:24:44 +0000 (20:24 +0000)]
Report some aspects of namespaces and namespace support in identify
command.

Sponsored by: Netflix
Submitted by: Matt Williams (via D11330)

7 years agoAdd new definitions for namespaces.
Warner Losh [Tue, 27 Jun 2017 20:24:39 +0000 (20:24 +0000)]
Add new definitions for namespaces.

Sponsored by: Netflix
Submitted by: Matt Williams (via D11330)

7 years agoMove 128-bit integer routines to util.c so they can be used by more
Warner Losh [Tue, 27 Jun 2017 20:24:25 +0000 (20:24 +0000)]
Move 128-bit integer routines to util.c so they can be used by more
than just the log page code.

Sponsored by: Netflix, Inc
Submitted by: Matt Williams (via D11330)

7 years agoDo not ignore an error from vm_mmap_object().
Konstantin Belousov [Tue, 27 Jun 2017 20:12:13 +0000 (20:12 +0000)]
Do not ignore an error from vm_mmap_object().

Found and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFix a panic in camperiphfree().
Kenneth D. Merry [Tue, 27 Jun 2017 19:26:02 +0000 (19:26 +0000)]
Fix a panic in camperiphfree().

If a peripheral driver (e.g. da, sa, cd) is added or removed from the
peripheral driver list while an unrelated peripheral driver instance (e.g.
da0, sa5, cd2) is going away and is inside camperiphfree(), we could
dereference an invalid pointer.

When peripheral drivers are added or removed (see periphdriver_register()
and periphdriver_unregister()), the peripheral driver array is resized
and existing entries are moved.

Although we hold the topology lock while we traverse the peripheral driver
list, we retain a pointer to the location of the peripheral driver pointer
and then drop the topology lock.  So we are still vulnerable to the list
getting moved around while the lock is dropped.

To solve the problem, cache a copy of the peripheral driver pointer.  If
its storage location in the list changes while we have the lock dropped, it
won't have any effect.

This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
to individual instances like "da0", "cd0") are not generally part of a
reference counting scheme to guard against deregistering them while there
are instances active.  The caller (generally the person unloading a module)
has to be aware of active drivers and not unload something that is in use.

sys/cam/cam_periph.c:
In camperiphfree(), cache a pointer to the peripheral driver
instance to avoid holding a pointer to an invalid memory location
in the event that the peripheral driver list changes while we have
the topology lock dropped.

PR: kern/219701
Submitted by: avg
MFC after: 3 days
Sponsored by: Spectra Logic

7 years agoIn scsi_zbc_in(), fill in the length in the ZBC IN CDB.
Kenneth D. Merry [Tue, 27 Jun 2017 17:55:25 +0000 (17:55 +0000)]
In scsi_zbc_in(), fill in the length in the ZBC IN CDB.

Without the allocation length set, the target will either reject
the command or complete it without transferring any data.

This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
as well as ATA ZAC protocol devices that are behind a SCSI to ATA
translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
drives.

This will fix REPORT ZONE commands sent to the da(4) driver via the
GEOM bio interface and zonectl, and REPORT ZONE commands sent from
camcontrol(8).

Note that in the case of camcontrol(8), we currently only send
SCSI ZBC commands to native SCSI protocol devices, not ATA devices
behind a SAT layer.

sys/cam/scsi/scsi_da.c:
Fill in the length field in scsi_zbc_in().

MFC after: 3 days
Sponsored by: Spectra Logic

7 years agocxgbe/iw_cxgbe: Disable debug output by default. The help text for the sysctl
Navdeep Parhar [Tue, 27 Jun 2017 17:48:11 +0000 (17:48 +0000)]
cxgbe/iw_cxgbe: Disable debug output by default.  The help text for the sysctl
already says that the default is 0.

Sponsored by: Chelsio Communications

7 years agocxgbe/iw_cxgbe: Catch up with r319722. The socket lock is not the same as the
Navdeep Parhar [Tue, 27 Jun 2017 17:45:47 +0000 (17:45 +0000)]
cxgbe/iw_cxgbe: Catch up with r319722.  The socket lock is not the same as the
lock for the receive buffer any more.

Sponsored by: Chelsio Communications

7 years agoAddress the remaining integer overflow issues with the "skip" parameters
Alan Cox [Tue, 27 Jun 2017 17:45:26 +0000 (17:45 +0000)]
Address the remaining integer overflow issues with the "skip" parameters
and "next_skip" variables.  The "skip" value in struct blist has long been
a 64-bit quantity but various functions have implicitly truncated this
value to 32 bits.  Now, all arithmetic involving the "skip" value is 64
bits wide.  (This should allow us to relax the size limit on a swap device
in the swap pager.)

Maintain the ability to test this allocator as a user-space application by
including <stdbool.h>.

Remove an unused variable from blst_radix_print().

Reviewed by: kib, markj
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D11358

7 years agocxgbe/t4_tom: sbspace on listening sockets is no longer supported (as of
Navdeep Parhar [Tue, 27 Jun 2017 17:43:28 +0000 (17:43 +0000)]
cxgbe/t4_tom: sbspace on listening sockets is no longer supported (as of
r319722), use sol_sbrcv_hiwat instead.

Sponsored by: Chelsio Communications

7 years agoFix one more place uio_resid is truncated to int
Conrad Meyer [Tue, 27 Jun 2017 17:23:20 +0000 (17:23 +0000)]
Fix one more place uio_resid is truncated to int

A follow-up to r231949 and r194990.

Reported by: pho@
Reviewed by: kib@, markj@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11373

7 years agoExpect :mmap_eof_not_eol to fail
Enji Cooper [Tue, 27 Jun 2017 17:22:03 +0000 (17:22 +0000)]
Expect :mmap_eof_not_eol to fail

It relies on a jemalloc feature (opt.redzone) no longer available after
r319971.

MFC with: r318908, r319971
PR: 220309

7 years agoFix LINT, broken by a -Wformat warning in r320329 with PFS_DELEN being
Enji Cooper [Tue, 27 Jun 2017 17:01:46 +0000 (17:01 +0000)]
Fix LINT, broken by a -Wformat warning in r320329 with PFS_DELEN being
changed from %d to a long-width type.

Use uintmax_t casting and %ju to futureproof the format string against
potential changes with either the #define or the implementation-specific
definition for offsetof(..).

7 years agoNamespace is 32-bits, don't cast it to 16 here
Warner Losh [Tue, 27 Jun 2017 16:48:05 +0000 (16:48 +0000)]
Namespace is 32-bits, don't cast it to 16 here

7 years agoAdd parentheses missed in r320388
Andrew Turner [Tue, 27 Jun 2017 16:30:01 +0000 (16:30 +0000)]
Add parentheses missed in r320388

Sponsored by: DARPA, AFRL

7 years agoRevert part of r320359, as suggested by rmacklem@. That case is only used
Edward Tomasz Napierala [Tue, 27 Jun 2017 15:14:06 +0000 (15:14 +0000)]
Revert part of r320359, as suggested by rmacklem@.  That case is only used
for nfsuserd -manage-gids and shouldn't depend on sysctl.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoext2fs: Support e2di_uid_high and e2di_gid_high.
Pedro F. Giffuni [Tue, 27 Jun 2017 15:07:19 +0000 (15:07 +0000)]
ext2fs: Support e2di_uid_high and e2di_gid_high.

The fields exist on all versions of the filesystem and using them is a mount
option on linux. For FreeBSD, the corresponding i_uid and i_gid are always
long enough so use them by default.

Reviewed by: Fedor Uporov
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D11354

7 years agoRemove CHROOT_MAKEENV from the RPI3 configuration file, to avoid
Glen Barber [Tue, 27 Jun 2017 14:39:00 +0000 (14:39 +0000)]
Remove CHROOT_MAKEENV from the RPI3 configuration file, to avoid
assuming the build host is amd64.

MFC after: 3 days
X-MFC-With: r320252, r320253, r320254
X-MFC-Note: maybe
Sponsored by: The FreeBSD Foundation

7 years agoA little tweak for performance
John W. De Boskey [Tue, 27 Jun 2017 13:24:06 +0000 (13:24 +0000)]
A little tweak for performance

Reviewed by: adrian
Approved by: rmacklem (mentor)
MFC after: 3 weeks

7 years agoSome of the atomic_clear_* functions were incorrectly defined to be an
Andrew Turner [Tue, 27 Jun 2017 10:45:13 +0000 (10:45 +0000)]
Some of the atomic_clear_* functions were incorrectly defined to be an
atomic add. Correct these, fixing a NULL-pointer dereference in netgraph.

PR: 220273
MFC after: 3 days
Sponsored by: DARPA, AFRL

7 years agoAdd initial documentation for procstat_freeptlwpinfo and procstat_getptlwpinfo
Enji Cooper [Tue, 27 Jun 2017 08:49:47 +0000 (08:49 +0000)]
Add initial documentation for procstat_freeptlwpinfo and procstat_getptlwpinfo

MFC after: 1 month
MFC with: r316286

7 years agoprocstat_getptlwpinfo(..): clarify the fact that KVM/SYSCTL support
Enji Cooper [Tue, 27 Jun 2017 08:18:08 +0000 (08:18 +0000)]
procstat_getptlwpinfo(..): clarify the fact that KVM/SYSCTL support
isn't supported

This will make the error message reported in bug 220023 a bit more
intuitive for end-users that don't have access to the source code to
decode the procstat->type argument.

MFC after: 1 month
MFC with: r316286
PR: 220023

7 years agoReplace AF_INET6 ifdefs with USE_INET6 to be consistent with the rest
Cy Schubert [Tue, 27 Jun 2017 04:54:58 +0000 (04:54 +0000)]
Replace AF_INET6 ifdefs with USE_INET6 to be consistent with the rest
of the ipfilter souce tree.

7 years agoioctl METEORGBRIG in bktr_core.c forgets to add 128 to value
Josh Paetzel [Tue, 27 Jun 2017 03:57:31 +0000 (03:57 +0000)]
ioctl METEORGBRIG in bktr_core.c forgets to add 128 to value

PR: 59289
Submitted by: Danovitsch@Vitsch.net

7 years agodriver incorrectly handles the setting of frame rates
Josh Paetzel [Tue, 27 Jun 2017 03:45:09 +0000 (03:45 +0000)]
driver incorrectly handles the setting of frame rates

PR: 36415
Submitted by: brandt@fokus.gmd.de

7 years agoDisable interrupts when updating the TLB
Justin Hibbits [Tue, 27 Jun 2017 01:57:22 +0000 (01:57 +0000)]
Disable interrupts when updating the TLB

Without disabling interrupts it's possible for another thread to preempt
and update the registers post-read (tlb1_read_entry) or pre-write
(tlb1_write_entry), and confuse the kernel with mixed register states.

MFC after: 2 weeks

7 years agoUpdate comments and simplify conditionals for compat32
Justin Hibbits [Tue, 27 Jun 2017 01:29:10 +0000 (01:29 +0000)]
Update comments and simplify conditionals for compat32

Only amd64 (because of i386) needs 32-bit time_t compat now, everything else is
64-bit time_t.  Rather than checking on all 64-bit time_t archs, only check the
oddball amd64/i386.

Reviewed By: emaste, kib, andrew
Differential Revision: https://reviews.freebsd.org/D11364

7 years agoWith r318394 seems it breaks gpart(8) in some embedded systems such like PCEngines,
Marcelo Araujo [Tue, 27 Jun 2017 01:22:27 +0000 (01:22 +0000)]
With r318394 seems it breaks gpart(8) in some embedded systems such like PCEngines,
RPI1-B, Alix and APU2 boards as well as NanoBSD with the following message:

vnode_pager_generic_getpages_done: I/O read error 5

Seems the breakage was because it was missed to include acr in glabel update.

Reported by: Peter Blok <pblok@bsd4all.org>,
madpilot, imp and trasz.
Reviewed by: trasz
Tested by: Peter Blok and madpilot.
MFC after: 3 days.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11365

7 years agoSort the compat11.* syscalls I added. Remove duplicate compat11.stat.
Warner Losh [Mon, 26 Jun 2017 22:48:04 +0000 (22:48 +0000)]
Sort the compat11.* syscalls I added. Remove duplicate compat11.stat.

Submitted by: jhb@

7 years agoIn _bswap16 and _bswap32 cast constant values to the appropriate type. This is
Andrew Turner [Mon, 26 Jun 2017 22:32:52 +0000 (22:32 +0000)]
In _bswap16 and _bswap32 cast constant values to the appropriate type. This is
similar to what is done in the x86 code.

Sponsored by: DARPA, AFRL

7 years ago[arm] Use correct index value when checking range validity
Oleksandr Tymoshenko [Mon, 26 Jun 2017 21:45:33 +0000 (21:45 +0000)]
[arm] Use correct index value when checking range validity

Reviewed by: andrew
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D9145

7 years agoSort SRCS.
Mark Johnston [Mon, 26 Jun 2017 21:14:33 +0000 (21:14 +0000)]
Sort SRCS.

MFC after: 1 week

7 years agoRevert r319603, r319608, and r319609. Creating a hard link to the
Glen Barber [Mon, 26 Jun 2017 20:17:48 +0000 (20:17 +0000)]
Revert r319603, r319608, and r319609.  Creating a hard link to the
dtb file for the cubieboard2 is no longer needed in 12-CURRENT.

Sponsored by: The FreeBSD Foundation

7 years agoFix a memory leak in ses_get_elm_devnames().
Mark Johnston [Mon, 26 Jun 2017 19:41:14 +0000 (19:41 +0000)]
Fix a memory leak in ses_get_elm_devnames().

After r307132 the sbuf buffer is malloc()ed, but corresponding
sbuf_delete() call was missing.

Fix a nearby whitespace bug.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoAdd IPSEC support to mips ERL kernel config file
Kurt Lidl [Mon, 26 Jun 2017 18:28:00 +0000 (18:28 +0000)]
Add IPSEC support to mips ERL kernel config file

7 years agoAdd "Terminus BSD Console" size 32
Ed Maste [Mon, 26 Jun 2017 18:11:48 +0000 (18:11 +0000)]
Add "Terminus BSD Console" size 32

Dimitar Toshkov, Terminus' creator, has made size 32 available under the
2-clause BSD license for use by *BSD consoles.

7 years agoImplement parts of the hrtimer API in the LinuxKPI.
Mark Johnston [Mon, 26 Jun 2017 16:28:46 +0000 (16:28 +0000)]
Implement parts of the hrtimer API in the LinuxKPI.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11359

7 years agoImprove terminology in a comment.
Edward Tomasz Napierala [Mon, 26 Jun 2017 16:08:28 +0000 (16:08 +0000)]
Improve terminology in a comment.

Suggested by: ian
MFC after: 2 weeks

7 years agoProvide visual feedback when timezone files are installed.
Edward Tomasz Napierala [Mon, 26 Jun 2017 15:40:24 +0000 (15:40 +0000)]
Provide visual feedback when timezone files are installed.
After r320003 it wasn't being shown in any way.

Submitted by: bdrewery
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D11154

7 years agoMake resizewin(1) do flushing by using TCSAFLUSH instead of TCSANOW
Edward Tomasz Napierala [Mon, 26 Jun 2017 13:14:41 +0000 (13:14 +0000)]
Make resizewin(1) do flushing by using TCSAFLUSH instead of TCSANOW
followed by tcflush(3).  This works just as well and is more elegant.

Suggested by: bde
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoAdd vfs.nfsd.nfsd_enable_uidtostring, which works just like
Edward Tomasz Napierala [Mon, 26 Jun 2017 13:11:21 +0000 (13:11 +0000)]
Add vfs.nfsd.nfsd_enable_uidtostring, which works just like
vfs.nfsd.nfsd_enable_stringtouid, but in reverse - when set to 1,
it forces the NFSv4 server to return numeric UIDs and GIDs instead
of "user@domain" strings. This helps with clients that can't
translate returned identifiers, eg when rerooting.

The same can be achieved by just never running nfsuserd(8),
but the sysctl is useful to toggle the behaviour back and forth
without rebooting.

Reviewed by: rmacklem (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11326

7 years agolinux_getdents, linux_readdir: fix mismatch between malloc and free tags
Andriy Gapon [Mon, 26 Jun 2017 09:13:25 +0000 (09:13 +0000)]
linux_getdents, linux_readdir: fix mismatch between malloc and free tags

MFC after: 3 days

7 years agozfs: port vdev_file part of illumos change 3306
Andriy Gapon [Mon, 26 Jun 2017 09:10:09 +0000 (09:10 +0000)]
zfs: port vdev_file part of illumos change 3306

3306 zdb should be able to issue reads in parallel
illumos/illumos-gate/31d7e8fa33fae995f558673adb22641b5aa8b6e1
https://www.illumos.org/issues/3306

The upstream change was made before we started to import upstream commits
individually.  It was imported into the illumos vendor area as r242733.
That commit was MFV-ed in r260138, but as the commit message says
vdev_file.c was left intact.

This commit actually implements the parallel I/O for vdev_file using a
taskqueue with multiple thread.  This implementation does not depend on
the illumos or FreeBSD bio interface at all, but uses zio_t to pass
around all the relevent data.  So, the code looks a bit different from
the upstream.

This commit also incorporates ZoL commit
zfsonlinux/zfs/bc25c9325b0e5ced897b9820dad239539d561ec9 that fixed
https://github.com/zfsonlinux/zfs/issues/2270
We need to use a dedicated taskqueue for exactly the same reason as ZoL
as we do not implement TASKQ_DYNAMIC.

Obtained from: illumos, ZFS on Linux
MFC after: 2 weeks

7 years agoSolve the y2038 problem for powerpc
Justin Hibbits [Mon, 26 Jun 2017 02:25:19 +0000 (02:25 +0000)]
Solve the y2038 problem for powerpc

AKA Make time_t 64 bits on powerpc(32).

PowerPC currently (until now) was one of two architectures with a 32-bit time_t
on 32-bit archs (the other being i386).  This is an ABI breakage, so all ports,
and all local binaries, *must* be recompiled.

Tested by: andreast, others
MFC after: Never
Relnotes: Yes

7 years agoAdd support to the NFSv4.1/pNFS client for commits through the DS.
Rick Macklem [Mon, 26 Jun 2017 00:43:04 +0000 (00:43 +0000)]
Add support to the NFSv4.1/pNFS client for commits through the DS.

A NFSv4.1/pNFS server using File Layout can specify that Commit operations
are to be done against the DS instead of MDS. Since no extant pNFS
server did this, the code was untested and "#ifdef notyet".
The FreeBSD pNFS server I am developing does specify that Commits be done
through the DS, so the code has been enabled/tested.
This patch should only affect the case of a pNFS server that specfies
Commits through the DS.

PR: 219551
MFC after: 2 weeks

7 years agoFor now, allow mprotect(2) over the guards to succeed regardless of
Konstantin Belousov [Sun, 25 Jun 2017 23:16:37 +0000 (23:16 +0000)]
For now, allow mprotect(2) over the guards to succeed regardless of
the requested protection.

The syscall returns success without changing the protection of the
guard.  This is consistent with the current mprotect(2) behaviour on
the unmapped ranges.  More important, the calls performed by libc and
libthr to allow execution of stacks, if requested by the loaded ELF
objects, do the expected change instead of failing on the grow space
guard.

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

7 years agoUpdate to ELF Tool Chain snapshot at r3561
Ed Maste [Sun, 25 Jun 2017 22:39:28 +0000 (22:39 +0000)]
Update to ELF Tool Chain snapshot at r3561

This update is primarily bug fixes in C++ symbol demangling, including:

- rvalue reference
- builtin type auto and decltype(auto)
- revamped support for function return types
- formatting fixes
- omit void when its the only param
- ref-qualifiers and others in function types
- type qualifiers in pointer-to-member function types
- incorrect handling regarding CV-qualifiers in function types
- ref-qualifier found in nested-name
- properly handle <name> ::= <substitute><template-args>
- make sure that nested function name is not a substitute candidate
- correctly handle expression in template args
- skip unknown substitution abbreviations

MFC after: 4 days

7 years agoImport ELF Tool Chain snapshot at r3561
Ed Maste [Sun, 25 Jun 2017 22:19:01 +0000 (22:19 +0000)]
Import ELF Tool Chain snapshot at r3561

From http://svn.code.sf.net/p/elftoolchain/code

7 years agosh: Ignore error when cd writes the directory actually switched to.
Jilles Tjoelker [Sun, 25 Jun 2017 21:53:08 +0000 (21:53 +0000)]
sh: Ignore error when cd writes the directory actually switched to.

If CDPATH is used non-trivially or the operand is "-", cd writes the
directory actually switched to. (We currently do this only in interactive
shells, but POSIX requires this in non-interactive shells as well.)

As mentioned in Austin group bug #1045, cd shall not return an error while
leaving the current directory changed. Therefore, ignore any write error.

7 years agoCorrectly handle small MAP_STACK requests.
Konstantin Belousov [Sun, 25 Jun 2017 20:06:05 +0000 (20:06 +0000)]
Correctly handle small MAP_STACK requests.

If mmap(2) is called with the MAP_STACK flag and the size which is
less or equal to the initial stack mapping size plus guard,
calculation of the mapping layout created zero-sized guard.  Attempt
to create such entry failed in vm_map_insert(), causing the whole
mmap(2) call to fail.

Fix it by adjusting the initial mapping size to have space for
non-empty guard.  Reject MAP_STACK requests which are shorter or equal
to the configured guard pages size.

Reported and tested by: Manfred Antar <null@pozo.com>
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove stale part of the comment.
Konstantin Belousov [Sun, 25 Jun 2017 19:59:39 +0000 (19:59 +0000)]
Remove stale part of the comment.

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

7 years agoAdd u64_to_user_ptr() to the LinuxKPI.
Mark Johnston [Sun, 25 Jun 2017 19:30:20 +0000 (19:30 +0000)]
Add u64_to_user_ptr() to the LinuxKPI.

MFC after: 1 week

7 years agoAdd ns_to_ktime() to the LinuxKPI.
Mark Johnston [Sun, 25 Jun 2017 19:28:01 +0000 (19:28 +0000)]
Add ns_to_ktime() to the LinuxKPI.

MFC after: 1 week

7 years agoAdd a couple of macros to lockdep.h in the LinuxKPI.
Mark Johnston [Sun, 25 Jun 2017 19:23:14 +0000 (19:23 +0000)]
Add a couple of macros to lockdep.h in the LinuxKPI.

MFC after: 1 week

7 years agoAdd the thaw_early method to struct dev_pm_ops in the LinuxKPI.
Mark Johnston [Sun, 25 Jun 2017 19:21:59 +0000 (19:21 +0000)]
Add the thaw_early method to struct dev_pm_ops in the LinuxKPI.

MFC after: 1 week

7 years agoAdd noop_lseek() to the LinuxKPI.
Mark Johnston [Sun, 25 Jun 2017 19:20:12 +0000 (19:20 +0000)]
Add noop_lseek() to the LinuxKPI.

MFC after: 1 week

7 years agoStyle.
Konstantin Belousov [Sun, 25 Jun 2017 18:40:59 +0000 (18:40 +0000)]
Style.

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

7 years agoPFS_DELEN is the sum of the permanent part of the struct dirent and
Dmitry Chagin [Sun, 25 Jun 2017 15:21:51 +0000 (15:21 +0000)]
PFS_DELEN is the sum of the permanent part of the struct dirent and
fixed size for the name buffer PFS_NAMELEN.
As r318736 was commited (ino64 project) the size of the permanent part
of the struct dirent was changed, so calulate PFS_DELEN properly.

7 years agoStop calling cpu_dcache_wb_range from PTE_SYNC.
Andrew Turner [Sun, 25 Jun 2017 13:22:49 +0000 (13:22 +0000)]
Stop calling cpu_dcache_wb_range from PTE_SYNC.

We set the shareability attributes in TCR_EL1 on boot. These tell the
hardware the pagetables are in cached memory so there is no need to flush
the entries from the cache to memory.

This has about 4.2% improvement in system time and 2.7% improvement in
user time for a buildkernel -j48 on a ThunderX.

Keep the old code for now to allow for further comparisons.

7 years agoRemove ALLWINNER kernel config file, all release image for SMP Allwinner
Emmanuel Vadot [Sun, 25 Jun 2017 11:31:39 +0000 (11:31 +0000)]
Remove ALLWINNER kernel config file, all release image for SMP Allwinner
board uses GENERIC and it's not updated for newer SoC.

7 years agoProvide sbsetopt() that handles socket buffer related socket options.
Gleb Smirnoff [Sun, 25 Jun 2017 01:41:07 +0000 (01:41 +0000)]
Provide sbsetopt() that handles socket buffer related socket options.
It distinguishes between data flow sockets and listening sockets, and
in case of the latter doesn't change resource limits, since listening
sockets don't hold any buffers, they only carry values to be inherited
by their children.

7 years agoAdd RPC count reporting for the two new RPCs added by r320322.
Rick Macklem [Sat, 24 Jun 2017 20:09:23 +0000 (20:09 +0000)]
Add RPC count reporting for the two new RPCs added by r320322.

This is a content change.

PR: 219550
MFC after: 2 weeks

7 years agoAdd two new compound RPCs to the NFSv4.1/pNFS client.
Rick Macklem [Sat, 24 Jun 2017 20:01:21 +0000 (20:01 +0000)]
Add two new compound RPCs to the NFSv4.1/pNFS client.

When the NFSv4.1 client is doing pNFS, it needs to get an Open and
a Layout for every file it will be doing I/O on. The current code
does two separate RPCs to get these. This patch adds two new compounds
that do the both the Open and LayoutGet in the same RPC, reducing the
RPC count.
It also factors out the code that sets up and parses the LayoutGet operation
into separate functions, so that the code doesn't get duplicated for
these new RPCs.
This patch is fairly large, but should only affect the NFSv4.1 client
when the "pnfs" option is specified.

PR: 219550
MFC after: 2 weeks

7 years agoClean up stale dependencies after r320278
Ed Maste [Sat, 24 Jun 2017 18:37:51 +0000 (18:37 +0000)]
Clean up stale dependencies after r320278

Our current approach to dependency tracking cannot cope with switching
generated asm syscall stubs into C wrappers. Perpetuate the hack in
Makefile.inc1 to paper over the problem until we can take a holistic
approach to fixing dependency problems.

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

7 years agoIncrease the pageout cluster size to 32 pages.
Alan Cox [Sat, 24 Jun 2017 17:10:33 +0000 (17:10 +0000)]
Increase the pageout cluster size to 32 pages.

Decouple the pageout cluster size from the size of the hash table entry
used by the swap pager for mapping (object, pindex) to a block on the
swap device(s), and keep the size of a hash table entry at its current
size.

Eliminate a pointless macro.

Reviewed by: kib, markj (an earlier version)
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D11305

7 years agoUse address space guard to implement inter-segment gap.
Konstantin Belousov [Sat, 24 Jun 2017 17:04:27 +0000 (17:04 +0000)]
Use address space guard to implement inter-segment gap.

Rtld checks and use old MAP_ANON/PROT_NONE method of creating gap if
running on old kernel.

Reviewed by: alc, markj
Tested by: pho, Qualys
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoImplement address space guards.
Konstantin Belousov [Sat, 24 Jun 2017 17:01:11 +0000 (17:01 +0000)]
Implement address space guards.

Guard, requested by the MAP_GUARD mmap(2) flag, prevents the reuse of
the allocated address space, but does not allow instantiation of the
pages in the range.  It is useful for more explicit support for usual
two-stage reserve then commit allocators, since it prevents accidental
instantiation of the mapping, e.g. by mprotect(2).

Use guards to reimplement stack grow code.  Explicitely track stack
grow area with the guard, including the stack guard page.  On stack
grow, trivial shift of the guard map entry and stack map entry limits
makes the stack expansion.  Move the code to detect stack grow and
call vm_map_growstack(), from vm_fault() into vm_map_lookup().

As result, it is impossible to get random mapping to occur in the
stack grow area, or to overlap the stack guard page.

Enable stack guard page by default.

Reviewed by: alc, markj
Man page update reviewed by: alc, bjk, emaste, markj, pho
Tested by: pho, Qualys
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11306 (man pages)

7 years agoDo not try to unmark MAP_ENTRY_IN_TRANSITION marked by other thread.
Konstantin Belousov [Sat, 24 Jun 2017 16:47:41 +0000 (16:47 +0000)]
Do not try to unmark MAP_ENTRY_IN_TRANSITION marked by other thread.

The issue is catched by "vm_map_wire: alien wire" KASSERT at the end
of the vm_map_wire().  We currently check for MAP_ENTRY_WIRE_SKIPPED
flag before ensuring that the wiring_thread is curthread. For HOLESOK
wiring, this means that we might see WIRE_SKIPPED entry from different
wiring.

The fix it by only checking WIRE_SKIPPED if the entry is put
IN_TRANSITION by us.  Also fixed a typo in the comment explaining the
situation.

Reported and tested by: pho
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoAllwinner: Add support for H2 Plus SoC
Emmanuel Vadot [Sat, 24 Jun 2017 16:41:26 +0000 (16:41 +0000)]
Allwinner: Add support for H2 Plus SoC

H2+ SoC is a stripped down version of H3 without gigabit ethernet and 4K HDMI.
Also add sun8i-h2-plus-orangepi-zero.dts to the build as we run on this board.

7 years agoRemove the description of MAP_HASSEMAPHORE.
Konstantin Belousov [Sat, 24 Jun 2017 16:36:30 +0000 (16:36 +0000)]
Remove the description of MAP_HASSEMAPHORE.

The flag is not implemented, all FreeBSD architectures correctly
handle locks on normal cacheable mappings.  On the other hand, the
flag was specified by some software, so it is kept in the header as
nop.  Removal from the man page should discourage its use.

Reviewed by: alc, bjk, emaste, markj, pho
MFC after: 3 days
X-Differential revision: https://reviews.freebsd.org/D11306

7 years agoFix typo.
Konstantin Belousov [Sat, 24 Jun 2017 16:21:34 +0000 (16:21 +0000)]
Fix typo.

Noted by: alc
MFC after: 3 days

7 years agoDocument that the dependencies aren't quite right for non-clean build.
Warner Losh [Sat, 24 Jun 2017 14:32:57 +0000 (14:32 +0000)]
Document that the dependencies aren't quite right for non-clean build.

7 years agoTranslate between abridged and full x87 tags for compat32
Konstantin Belousov [Sat, 24 Jun 2017 11:38:31 +0000 (11:38 +0000)]
Translate between abridged and full x87 tags for compat32
ptrace(PT_GETFPREGS).

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFix indent.
Konstantin Belousov [Sat, 24 Jun 2017 10:19:06 +0000 (10:19 +0000)]
Fix indent.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoloader.efi: Disable smbios for arm
Emmanuel Vadot [Sat, 24 Jun 2017 09:33:25 +0000 (09:33 +0000)]
loader.efi: Disable smbios for arm

The smbios code does a lot of unaligned access, since we don't really
care about smbios info on ARM (not all board expose information and those
who does don't expose useful ones) disable smbios for this arch (at least
for now).

7 years agoBe sure to free allocated statfs11 buffer.
Warner Losh [Sat, 24 Jun 2017 00:28:35 +0000 (00:28 +0000)]
Be sure to free allocated statfs11 buffer.

Submitted by: Alistair Crooks

7 years agoDoh, fix some botched "fix" in r320277.
Maxim Sobolev [Fri, 23 Jun 2017 23:11:05 +0000 (23:11 +0000)]
Doh, fix some botched "fix" in r320277.

Reported by: cem
MFC after: 6 weeks

7 years agoHandle sctp_get_next_param() in a consistent way.
Michael Tuexen [Fri, 23 Jun 2017 21:01:57 +0000 (21:01 +0000)]
Handle sctp_get_next_param() in a consistent way.

This addresses an issue found by Felix Weinrank using libfuzz.
While there, use also consistent nameing.

MFC after: 3 days

7 years agodtc: Update to upstream 9ce35ff8
Emmanuel Vadot [Fri, 23 Jun 2017 20:21:53 +0000 (20:21 +0000)]
dtc: Update to upstream 9ce35ff8

 - Add "compatible with gpl dtc X.Y.Z" to version output so U-Boot doesn't complain
 - Fix cross reference node

This fixes some Allwinner DTS (and probably others).

7 years agoNO_ROOT: Remove excessive // when DESTDIR/DISTDIR are empty.
Bryan Drewery [Fri, 23 Jun 2017 19:03:31 +0000 (19:03 +0000)]
NO_ROOT: Remove excessive // when DESTDIR/DISTDIR are empty.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agomakefs: add copies of NetBSD makefs msdos source files
Ed Maste [Fri, 23 Jun 2017 18:58:28 +0000 (18:58 +0000)]
makefs: add copies of NetBSD makefs msdos source files

We do not treat makefs as contrib code.  Import copies of makefs msdos
files from NetBSD so that we can track our changes to these files.

These are copied from NetBSD, with only a change to use __FBSDID and
$FreeBSD$ instead of __KERNEL_RCSID and $NetBSD$.  A copy of the
original $NetBSD$ tag remains in each source file.

These two files were missed in r320212.  Also remove a stray blank line
added in msdosfs_vfsops.c.

Submitted by: Siva Mahadevan
Sponsored by: The FreeBSD Foundation

7 years agoInclude WORLD_FLAGS in CHROOT_IMAKEFLAGS and CHROOT_DMAKEFLAGS, to
Glen Barber [Fri, 23 Jun 2017 18:42:47 +0000 (18:42 +0000)]
Include WORLD_FLAGS in CHROOT_IMAKEFLAGS and CHROOT_DMAKEFLAGS, to
allow passing '-jN' to the installworld and distributeworld targets.

Submitted by: bdrewery
Sponsored by: The FreeBSD Foundation

7 years agoAllow Clang's integrated assembler to assemble boot0
Ed Maste [Fri, 23 Jun 2017 18:41:49 +0000 (18:41 +0000)]
Allow Clang's integrated assembler to assemble boot0

dim@ compared clang IAS-built and GNU as-built boot0 and found them
equivalent.  IAS encoded one instruction using two bytes where GNU as
used three, and another instruction using three bytes where GNU as used
two.  The net result is equivalent and tested, so there is no need to
force IAS off for boot0.

7 years agoRemove redundant wording, minor edits for clarity.
Warren Block [Fri, 23 Jun 2017 18:38:27 +0000 (18:38 +0000)]
Remove redundant wording, minor edits for clarity.

MFC after: 1 week
Sponsored by: iXsystems

7 years agocompiler-metadata: Properly handle cross-build OBJDIR.
Bryan Drewery [Fri, 23 Jun 2017 18:27:03 +0000 (18:27 +0000)]
compiler-metadata: Properly handle cross-build OBJDIR.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoExpose only the create-packages-* targets since they set needed DEST/DIRDIR.
Bryan Drewery [Fri, 23 Jun 2017 18:27:00 +0000 (18:27 +0000)]
Expose only the create-packages-* targets since they set needed DEST/DIRDIR.

The other targets just fail confusingly otherwise.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agopackages: Parallelize individual kernel packaging.
Bryan Drewery [Fri, 23 Jun 2017 18:26:57 +0000 (18:26 +0000)]
packages: Parallelize individual kernel packaging.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agopackages: Allow actually building individual world packages in parallel.
Bryan Drewery [Fri, 23 Jun 2017 18:26:54 +0000 (18:26 +0000)]
packages: Allow actually building individual world packages in parallel.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agopackages: Allow creating kernel/world packages in parallel.
Bryan Drewery [Fri, 23 Jun 2017 18:26:51 +0000 (18:26 +0000)]
packages: Allow creating kernel/world packages in parallel.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agopackages: Allow staging world/kernel in parallel.
Bryan Drewery [Fri, 23 Jun 2017 18:26:47 +0000 (18:26 +0000)]
packages: Allow staging world/kernel in parallel.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agopackages: Allow stageworld/stagekernel to run with make jobs.
Bryan Drewery [Fri, 23 Jun 2017 18:26:33 +0000 (18:26 +0000)]
packages: Allow stageworld/stagekernel to run with make jobs.

The -B was originally added in projects/release-pkg r289381 as a copy
of what 'make world' did at the time.  The -B was removed from
the 'installworld' call in 'world' in r303844 though.  The staging
of files is safe to run in parallel.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon