]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agosystat -zarc to display disk activities like -vm
mr [Tue, 2 Apr 2019 14:01:03 +0000 (14:01 +0000)]
systat -zarc to display disk activities like -vm

PR: 213310
Submitted by: ota
MFH: 4 weeks
Differential Revision: https://reviews.freebsd.org/D18726

5 years agotmpfs: plug holes on rw->ro mount update.
kib [Tue, 2 Apr 2019 13:59:04 +0000 (13:59 +0000)]
tmpfs: plug holes on rw->ro mount update.

In particular:
- suspend the mount around vflush() to avoid new writes come after the
  vnode is processed;
- flush pending metadata updates (mostly node times);
- remap all rw mappings of files from the mount into ro.

It is not clear to me how to handle writeable mappings on rw->ro for
tmpfs best.  Other filesystems, which use vnode vm object, call
vgone() on vnodes with writers, which sets the vm object type to
OBJT_DEAD, and keep the resident pages and installed ptes as is.  In
particular, the existing mappings continue to work as far as
application only accesses resident pages, but changes are not flushed
to file.

For tmpfs the vm object of VREG vnodes also serves as the data pages
container, giving single copy of the mapped pages, so it cannot be set
to OBJT_DEAD.  Alternatives for making rw mappings ro could be either
invalidating them at all, or marking as CoW.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19737

5 years agotmpfs: ignore tmpfs_set_status() if mount point is read-only.
kib [Tue, 2 Apr 2019 13:49:32 +0000 (13:49 +0000)]
tmpfs: ignore tmpfs_set_status() if mount point is read-only.

In particular, this fixes atimes still changing for ro tmpfs.
tmpfs_set_status() gains tmpfs_mount * argument.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19737

5 years agoBlock creation of the new nodes for read-only tmpfs mounts.
kib [Tue, 2 Apr 2019 13:41:26 +0000 (13:41 +0000)]
Block creation of the new nodes for read-only tmpfs mounts.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19737

5 years agoCreate 64bit mibII counters for all interfaces.
ae [Tue, 2 Apr 2019 13:38:00 +0000 (13:38 +0000)]
Create 64bit mibII counters for all interfaces.

PR: 157015
Obtained from: Yandex LLC
MFC after: 1 month

5 years agoAdd IPv6 transport for bsnmp.
ae [Tue, 2 Apr 2019 12:50:01 +0000 (12:50 +0000)]
Add IPv6 transport for bsnmp.

This patch adds a new table begemotSnmpdTransInetTable that uses the
InetAddressType textual convention and can be used to create listening
ports for IPv4, IPv6, zoned IPv6 and based on DNS names. It also supports
future extension beyond UDP by adding a protocol identifier to the table
index. In order to support this gensnmptree had to be modified.

Submitted by:   harti
MFC after:      1 month
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D16654

5 years agoo Grab the number of devices supported by PLIC from FDT.
br [Tue, 2 Apr 2019 12:02:35 +0000 (12:02 +0000)]
o Grab the number of devices supported by PLIC from FDT.
o Fix bug in PLIC_ENABLE macro when irq >= 32.

Tested on the real hardware, which is HiFive Unleashed board.

Thanks to SiFive, Inc. for the board provided.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19775

5 years agoipmi: Fixes for ipmi_opal(powernv)
jhibbits [Tue, 2 Apr 2019 04:12:06 +0000 (04:12 +0000)]
ipmi: Fixes for ipmi_opal(powernv)

* Crank the OPAL state machine during the receive loop, to make sure the
  pollers are executed
* Add a proper detach function, so the module can be unloaded and reloaded
  at runtime.

It still doesn't reliably work 100% of the time on POWER9, and it appears
timing and/or cache related.  It may work on POWER8 now.

MFC after: 2 weeks

5 years agopowernv: Port OPAL asynchronous framework to use the new message framework
jhibbits [Tue, 2 Apr 2019 04:02:57 +0000 (04:02 +0000)]
powernv: Port OPAL asynchronous framework to use the new message framework

Since OPAL_GET_MSG does not discriminate between message types, asynchronous
completion events may be received in the OPAL_GET_MSG call, which dequeues
them from the list, thus preventing OPAL_CHECK_ASYNC_COMPLETION from
succeeding.  Handle this case by integrating with the messaging framework.

5 years agopowerpc/powernv: Add OPAL heartbeat thread
jhibbits [Tue, 2 Apr 2019 04:00:01 +0000 (04:00 +0000)]
powerpc/powernv: Add OPAL heartbeat thread

Summary:
OPAL needs to be kicked periodically in order for the firmware to make
progress on its tasks.  To do so, create a heartbeat thread to perform this task
every N milliseconds, defined by the device tree.  This task is also a central
location to handle all messages received from OPAL.

Reviewed By: luporl
Differential Revision: https://reviews.freebsd.org/D19743

5 years agoIntegrate capsicum-test into the FreeBSD test suite
ngie [Mon, 1 Apr 2019 21:24:50 +0000 (21:24 +0000)]
Integrate capsicum-test into the FreeBSD test suite

This change takes capsicum-test from upstream and applies some local changes to make the
tests work on FreeBSD when executed via Kyua.

The local modifications are as follows:
1. Make `OpenatTest.WithFlag` pass with the new dot-dot lookup behavior in FreeBSD 12.x+.
2. capsicum-test references a set of helper binaries: `mini-me`, `mini-me.noexec`, and
   `mini-me.setuid`, as part of the execve/fexecve tests, via execve, fexecve, and open.
   It achieves this upstream by assuming `mini-me*` is in the current directory, however,
   in order for Kyua to execute `capsicum-test`, it needs to provide a full path to
   `mini-me*`. In order to achieve this, I made `capsicum-test` cache the executable's
   path from argv[0] in main(..) and use the cached value to compute the path to
   `mini-me*` as part of the execve/fexecve testcases.
3. The capsicum-test test suite assumes that it's always being run on CAPABILITIES enabled
   kernels. However, there's a chance that the test will be run on a host without a
   CAPABILITIES enabled kernel, so we must check for the support before running the tests.
   The way to achieve this is to add the relevant `feature_present("security_capabilities")`
   check to SetupEnvironment::SetUp() and skip the tests when the support is not available.
   While here, add a check for `kern.trap_enotcap` being enabled. As noted by markj@ in
   https://github.com/google/capsicum-test/issues/23, this sysctl being enabled can trigger
   non-deterministic failures. Therefore, the tests should be skipped if this sysctl is
   enabled.

All local changes have been submitted to the capsicum-test project
(https://github.com/google/capsicum-test) and are in various stages of review.
Please see the following pull requests for more details:
1. https://github.com/google/capsicum-test/pull/35
2. https://github.com/google/capsicum-test/pull/41
3. https://github.com/google/capsicum-test/pull/42

Reviewed by: asomers
Discussed with: emaste, markj
Approved by: emaste (mentor)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D19758

5 years agoFix gdb/kgdb build under WITH_PIE
emaste [Mon, 1 Apr 2019 19:19:51 +0000 (19:19 +0000)]
Fix gdb/kgdb build under WITH_PIE

Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

Reported by: David E. Cross, on twitter
Sponsored by: The FreeBSD Foundation

5 years agoDevices behind downstream bridges should still get DMAR protection.
tychon [Mon, 1 Apr 2019 19:08:05 +0000 (19:08 +0000)]
Devices behind downstream bridges should still get DMAR protection.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19717

5 years agoRefactor error handling
kibab [Mon, 1 Apr 2019 18:54:15 +0000 (18:54 +0000)]
Refactor error handling

There is some code duplication in error handling paths in a few functions.
Create a function for printing such errors in human-readable way and get rid
of duplicates.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15912

5 years agoUse information about max data size that the controller is able to operate
kibab [Mon, 1 Apr 2019 18:49:39 +0000 (18:49 +0000)]
Use information about max data size that the controller is able to operate

Using DFLTPHYS/MAXPHYS is not always OK, instead make it possible for the
controller driver to provide maximum data size to MMCCAM, and use it there.

The old stack already does this.

Reviewed by: manu
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15892

5 years agoImport proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`
ngie [Mon, 1 Apr 2019 18:07:48 +0000 (18:07 +0000)]
Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`

Per the upstream pull-request [1]:

```
  gtest prior to this change would completely ignore `GTEST_SKIP()` if
  called in `Environment::SetUp()`, instead of bailing out early, unlike
  `Test::SetUp()`, which would cause the tests themselves to be skipped.
  The only way (prior to this change) to skip the tests would be to
  trigger a fatal error via `GTEST_FAIL()`.

  Desirable behavior, in this case, when dealing with
  `Environment::SetUp()` is to check for prerequisites on a system
  (example, kernel supports a particular featureset, e.g., capsicum), and
  skip the tests. The alternatives prior to this change would be
  undesirable:

  - Failing sends the wrong message to the test user, as the result of the
    tests is indeterminate, not failed.
  - Having to add per-test class abstractions that override `SetUp()` to
    test for the capsicum feature set, then skip all of the tests in their
    respective SetUp fixtures, would be a lot of human and computational
    work; checking for the feature would need to be done for all of the
    tests, instead of once for all of the tests.

  For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
  by not executing the testcases, is the most desirable solution.

  In order to properly diagnose what happened when running the tests if
  they are skipped, print out the diagnostics in an ad hoc manner.

  Update the documentation to note this change and integrate a new test,
  gtest_skip_in_environment_setup_test, into the test suite.

  This change addresses #2189.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
```

The goal with my merging in this change is to avoid requiring extensive
refactoring/retesting of test suites when ensuring prerequisites are met,
e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test
(see D19758 for more details).

The proof-of-concept is being imported before accepted by the upstream
project due to the fact that the upstream project is undergoing a potential
development freeze and the maintainers aren't responding to my PR.

1. https://github.com/google/googletest/pull/2203

Reported by: asomers (https://github.com/google/googletest/issues/2189)
Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D19765

5 years agolibbe: Fix zfs_is_mounted check w/ snapshots
kevans [Mon, 1 Apr 2019 17:44:20 +0000 (17:44 +0000)]
libbe: Fix zfs_is_mounted check w/ snapshots

'be_destroy' can destroy a boot environment (by name) or a given snapshot.
If the target to be destroyed is a dataset, check if it's mounted. We don't
want to check if the origin dataset is mounted when destroying a snapshot.

PR: 236043
Submitted by: Rob Fairbanks <rob.fx907 gmail com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19650

5 years agoFix and simplify code by using ATF_REQUIRE_FEATURE macro
olivier [Mon, 1 Apr 2019 14:21:32 +0000 (14:21 +0000)]
Fix and simplify code by using ATF_REQUIRE_FEATURE macro

PR: 236857
Reviewed by: asomers, ngie
Approved by: emaste
MFC after:  1 month
Sponsored by: Netflix

5 years agoCorrect a port number assignment.
ae [Mon, 1 Apr 2019 12:14:45 +0000 (12:14 +0000)]
Correct a port number assignment.

PR: 236930
MFC after: 1 week

5 years agoWhen using the force option to shut down a memory-disk device,
mckusick [Sun, 31 Mar 2019 21:34:58 +0000 (21:34 +0000)]
When using the force option to shut down a memory-disk device,
I/O operations already in its queue were not being properly drained.
The GEOM framework does the queue draining, but the device driver
needs to wait for the draining to happen. The waiting is done by
adding a g_md_providergone() function to wait for the I/O operations
to finish up.

It is likely that every GEOM provider that implements orphaning
attached GEOM consumers needs to use the "providergone" mechanism
for this same reason, but some of them do not do so. Apparently
Kenneth Merry (ken@) added the drain for just such races, but he
missed adding it to some of the device drivers that needed it.

Submitted by: Chuck Silvers
Reviewed by:  imp
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix

5 years agoImprove debugging options in bcm2835_sdhci.c
bz [Sun, 31 Mar 2019 19:27:44 +0000 (19:27 +0000)]
Improve debugging options in bcm2835_sdhci.c

Similar to bcm2835_sdhost.c add a TUNABLE and SYSCTL to selectively
turn on debugging printfs if debugging is turned on at compile time.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Reviewed by: gonzo, andrew
Differential Revision: https://reviews.freebsd.org/D19745

5 years agorun(4): properly set F_DATAPAD radiotap flag if frame has padding between
avos [Sun, 31 Mar 2019 14:18:02 +0000 (14:18 +0000)]
run(4): properly set F_DATAPAD radiotap flag if frame has padding between
frame header and data.

This will fix 'Mysterious OLPC stuff' for received frames and wrong
CCMP / TKIP / data decoding for transmitted frames in net/wireshark
dissector.

While here, drop unneeded comment - net80211 handles padding requirements
for Tx & Rx without driver adjustment.

Tested with D-Link DWA-140 rev B3, STA mode.

MFC after: 1 week

5 years agorun(4): do not clear PROTECTED bit if frame was not decrypted by NIC.
avos [Sun, 31 Mar 2019 13:41:20 +0000 (13:41 +0000)]
run(4): do not clear PROTECTED bit if frame was not decrypted by NIC.

Tested with D-Link DWA-140 rev B3, STA / MONITOR modes.

MFC after: 1 week

5 years agouath(4), urtw(4): restart driver if device does not respond after Tx request
avos [Sun, 31 Mar 2019 09:52:36 +0000 (09:52 +0000)]
uath(4), urtw(4): restart driver if device does not respond after Tx request

MFC after: 1 week

5 years agorandom(4): Attempt to persist entropy promptly
cem [Sun, 31 Mar 2019 04:57:50 +0000 (04:57 +0000)]
random(4): Attempt to persist entropy promptly

The goal of saving entropy in Fortuna is two-fold: (1) to provide early
availability of the random device (unblocking) on next boot; and (2), to
have known, high-quality entropy available for that initial seed.  We know
it is high quality because it's output taken from Fortuna.

The FS&K paper makes it clear that Fortuna unblocks when enough bits have
been input that the output //may// be safely seeded.  But they emphasize
that the quality of various entropy sources is unknown, and a saved entropy
file is essential for both availability and ensuring initial
unpredictability.

In FreeBSD we persist entropy using two mechanisms:

1. The /etc/rc.d/random shutdown() function, which is used for ordinary
   shutdowns and reboots; and,

2. A cron job that runs every dozen minutes or so to persist new entropy, in
   case the system suffers from power loss or a crash (bypassing the
   ordinary shutdown path).

Filesystems are free to cache dirty data indefinitely, with arbitrary flush
policy.  Fsync must be used to ensure the data is persisted, especially for
the cron job save-entropy, whose entire goal is power loss and crash safe
entropy persistence.

Ordinary shutdown may not need the fsync because unmount should flush out
the dirty entropy file shortly afterwards.  But it is always possible power
loss or crash occurs during the short window after rc.d/random shutdown runs
and before the filesystem is unmounted, so the additional fsync there seems
harmless.

PR: 230876
Reviewed by: delphij, markj, markm
Approved by: secteam (delphij)
Differential Revision: https://reviews.freebsd.org/D19742

5 years agofreebsd32: fix padding of computed control message length for recvmsg()
jah [Sat, 30 Mar 2019 23:43:58 +0000 (23:43 +0000)]
freebsd32: fix padding of computed control message length for recvmsg()

Each control message region must be aligned on a 4-byte boundary on 32-bit
architectures. The 32-bit compat shim for recvmsg() gets the actual layout
right, but doesn't pad the payload length when computing msg_controllen for
the output message header. If a control message contains an unaligned
payload, such as the 1-byte TTL field in the example attached to PR 236737,
this can produce control message payload boundaries that extend beyond
the boundary reported by msg_controllen.

PR: 236737
Reported by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19768

5 years agoDo not perform DAD on stf(4) interfaces.
markj [Sat, 30 Mar 2019 18:00:44 +0000 (18:00 +0000)]
Do not perform DAD on stf(4) interfaces.

stf(4) interfaces are not multicast-capable so they can't perform DAD.
They also did not set IFF_DRV_RUNNING when an address was assigned, so
the logic in nd6_timer() would periodically flag such an address as
tentative, resulting in interface flapping.

Fix the problem by setting IFF_DRV_RUNNING when an address is assigned,
and do some related cleanup:
- In in6if_do_dad(), remove a redundant check for !UP || !RUNNING.
  There is only one caller in the tree, and it only looks at whether
  the return value is non-zero.
- Have in6if_do_dad() return false if the interface is not
  multicast-capable.
- Set ND6_IFF_NO_DAD when an address is assigned to an stf(4) interface
  and the interface goes UP as a result. Note that this is not
  sufficient to fix the problem because the new address is marked as
  tentative and DAD is started before in6_ifattach() is called.
  However, setting no_dad is formally correct.
- Change nd6_timer() to not flag addresses as tentative if no_dad is
  set.

This is based on a patch from Viktor Dukhovni.

Reported by: Viktor Dukhovni <ietf-dane@dukhovni.org>
Reviewed by: ae
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19751

5 years agoAllow programs to set `NO_SHARED` on a per-PROG basis
ngie [Sat, 30 Mar 2019 17:23:15 +0000 (17:23 +0000)]
Allow programs to set `NO_SHARED` on a per-PROG basis

This is particularly useful when installing programs for tests that need to be
linked statically, e.g., mini-me from capsicum-test, which is linked statically
to avoid the dynamic library lookup in the upstream project.

Reviewed by: emaste
Approved by: emaste (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19756

5 years agoFix branding after r345661.
kib [Sat, 30 Mar 2019 16:58:51 +0000 (16:58 +0000)]
Fix branding after r345661.

In particular, elf32 FreeBSD binaries were not executed on LP64 hosts.
The interp_name_len value should account for the nul terminator.  This
is needed for strncmp()s in brand checking code to work.

Reported by: andreast
Sponsored by: The FreeBSD Foundation
MFC after: 12 days (together with r345661)

5 years agourtw(4): export TSF timestamp for received frames via radiotap
avos [Sat, 30 Mar 2019 09:24:06 +0000 (09:24 +0000)]
urtw(4): export TSF timestamp for received frames via radiotap

Tested with Netgear WG111 v3 (RTL8187B), STA mode.

MFC after: 1 week

5 years agoIf the autoexpand pool property is turned on and vdev is healthy try to
pjd [Sat, 30 Mar 2019 07:29:20 +0000 (07:29 +0000)]
If the autoexpand pool property is turned on and vdev is healthy try to
expand the pool automatically when we detect underlying GEOM provider
size change.

Obtained from: Fudo Security
Tested in: AWS

5 years agoIntroduce new event SIZECHANGE within GEOM system to inform about GEOM
pjd [Sat, 30 Mar 2019 07:24:34 +0000 (07:24 +0000)]
Introduce new event SIZECHANGE within GEOM system to inform about GEOM
providers mediasize changes.

While here, use GEOM nomenclature to describe providers instead of calling
them device nodes.

Obtained from: Fudo Security
Tested in: AWS

5 years agoImplement support for online disk capacity changes.
pjd [Sat, 30 Mar 2019 07:20:28 +0000 (07:20 +0000)]
Implement support for online disk capacity changes.

Obtained from: Fudo Security
Tested in: AWS

5 years agoPROG_OVERRIDE_VARS should override default values if specified
ngie [Sat, 30 Mar 2019 00:57:33 +0000 (00:57 +0000)]
PROG_OVERRIDE_VARS should override default values if specified

The behavior prior to this change would not override default values if set in
`bsd.own.mk`, or (in the more general case) globally before `bsd.progs.mk` was
included. This affected `bsd.test.mk` as well, since it consumes
`bsd.progs.mk`.

Some examples of this failing behavior are as follows:

* `BINMODE` defaults to 0555 per `bsd.own.mk`. If someone wanted to set the
  `BINMODE` to `NOBINMODE` (0444) for `prog`, for example, like
  `BINMODE.prog= ${NOBINMODE}`, `bsd.progs.mk` would not honor the per-PROG
  setting.
* An application, `prog`, does not build at `WARNS?= 6`. Before this change,
  setting to a lower `WARNS` value, e.g., `WARNS.prog= 3`, would have been
  impossible, requiring that `prog` be built from another directory,
  the global `WARNS` be lowered, or a per-PROG value needing to be set
  across the board. None of the above workarounds is desirable.

This change unbreaks variables defined in `PROG_OVERRIDE_VARS` which have
defaults set before `bsd.progs.mk` is included, by setting them to their
defined values if set on a per-PROG basis.

Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19755

5 years agoMerge the following changes from the capsicum-test project [1]
ngie [Fri, 29 Mar 2019 21:41:14 +0000 (21:41 +0000)]
Merge the following changes from the capsicum-test project [1]

Log:
```
commit feb47278d7cffa8cf4bc8c8ff78047126fa41e82 (HEAD -> dev, origin/dev, origin/HEAD)
Author: ngie-eign <1574099+ngie-eign@users.noreply.github.com>
Date:   Fri Mar 22 10:51:04 2019 -0700

    Remove `FAIL` macro use for non-x86 architectures when testing `sysarch(2)` (#38)

    `FAIL()` does not support being called in the form noted in the test,
    which causes a test failure on non-x86 architectures.

    The alternatives (use `ADD_TEST_FAILURE()` or `GTEST_SKIP()`) would be
    misleading (in both cases), and in the case of `GTEST_SKIP()` is unavailable
    on the version of googletest packaged with capsicum-test.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
commit 32ad0f3e4c11be7f7463d40eef8d4a78ac9f61a5
Author: Enji Cooper <yaneurabeya@gmail.com>
Date:   Fri Mar 15 20:01:56 2019 -0700

    Fix `-Wunused-parameter` issues

    Remove variable declarations from functions/methods where the variable
    is not required.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
commit 9437b4c550110200ef190ac39fb26c1d8fc55d9a
Author: Enji Cooper <yaneurabeya@gmail.com>
Date:   Fri Mar 15 19:59:00 2019 -0700

    Fix `-Wshadow` issues with `EXPECT_OPEN_OK(..)` macro

    * Wrap in do-while(0) block to avoid variable shadowing issue with
      multiple calls in the same function.
    * Prefix block local variables with `_` to try and avoid variable
      name clashes with values local to test methods.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
commit adf4a21a233b5da5cac440f4006e258ffba09510
Author: Enji Cooper <yaneurabeya@gmail.com>
Date:   Fri Mar 15 19:55:00 2019 -0700

    Fix `-Wmissing-variable-declarations` issue with `known_rights` global

    Staticize it since it is only used in the file.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
```

This merges a number of the outstanding changes made locally to
^/projects/capsicum-test that were accepted into the upstream project.

The sync was done like so:
```
curl -L https://github.com/google/capsicum-test/tarball/dd7eac98c0cf | tar --strip-components=1 -xvzf - -C dist/
rm -Rf dist/*/
```

1. https://github.com/google/capsicum-test

5 years agotcp_autorcvbuf_inc was removed in r344433.
np [Fri, 29 Mar 2019 21:39:47 +0000 (21:39 +0000)]
tcp_autorcvbuf_inc was removed in r344433.

Discussed with: tuexen@
Sponsored by: Chelsio Communications

5 years agoMerge ACPICA 20190329.
jkim [Fri, 29 Mar 2019 20:21:28 +0000 (20:21 +0000)]
Merge ACPICA 20190329.

5 years agoDon't check the inp socket pointer in in_pcboutput_eagain.
jhb [Fri, 29 Mar 2019 19:47:42 +0000 (19:47 +0000)]
Don't check the inp socket pointer in in_pcboutput_eagain.

Reviewed by: hps (by saying it was ok to be removed)
MFC after: 1 month
Sponsored by: Netflix

5 years agoarm: allwinner: clk: Fix nm_recalc
manu [Fri, 29 Mar 2019 19:40:04 +0000 (19:40 +0000)]
arm: allwinner: clk: Fix nm_recalc

When comparing best frequencies use the absolute value.
If we do not do that we end up choosing an always lower value than
the best one if the exact freq cannot be met.

MFC after: 2 weeks

5 years agoAllow users to override CSTD/CXXSTD on a per-prog basis
ngie [Fri, 29 Mar 2019 18:49:08 +0000 (18:49 +0000)]
Allow users to override CSTD/CXXSTD on a per-prog basis

The current logic for CSTD/CXXSTD requires homogenity as far as the
supported C/C++ standards, which is a sensible default. However, when
dealing with differing versions of C++, some code may compile with C++11, but
not C++17 (for instance). So in order to avoid having people convert over their
code to the new standard, give the users the ability to specify the standard on
a per-program basis.

This will allow a user to override the supporting standard for a set of
programs, mixing C++11 with C++14 (for instance).

Reviewed by: asomers
Apprved by: emaste (mentor)
MFC after: 1 month
MFC with: r345708
Differential Revision: https://reviews.freebsd.org/D19738

5 years agoStandardize `-std=c++* as `CXXSTD`
ngie [Fri, 29 Mar 2019 18:45:27 +0000 (18:45 +0000)]
Standardize `-std=c++* as `CXXSTD`

CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 1 month
MFC with: r345203, r345704, r345705
Relnotes: yes
Tested with: make tinderbox
Differential Revision: https://reviews.freebsd.org/D19732

5 years agoRevert r345706: the third time will be the charm
ngie [Fri, 29 Mar 2019 18:43:46 +0000 (18:43 +0000)]
Revert r345706: the third time will be the charm

When a review is closed via Phabricator it updates the patch attached to the
review. I downloaded the raw patch from Phabricator, applied it, and repeated
my mistake from r345704 by accident mixing content from D19732 and D19738.

For my own personal sanity, I will try not to mix reviews like this in the
future.

MFC after: 1 month
MFC with: r345706
Approved by: emaste (mentor, implicit)

5 years agoStandardize `-std=c++* as `CXXSTD`
ngie [Fri, 29 Mar 2019 18:31:48 +0000 (18:31 +0000)]
Standardize `-std=c++* as `CXXSTD`

CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 1 month
MFC with: r345203, r345704, r345705
Relnotes: yes
Tested with: make tinderbox
Differential Revision: https://reviews.freebsd.org/D19732

5 years agoRevert r345704
ngie [Fri, 29 Mar 2019 18:16:33 +0000 (18:16 +0000)]
Revert r345704

I accidentally committed code from two reviews. I will reintroduce the code to
bsd.progs.mk as part of a separate commit from r345704.

Approved by: emaste (mentor, implicit)
MFC after: 2 months
MFC with: r345704

5 years agoCXXSTD is the C++ analogue to CSTD.
ngie [Fri, 29 Mar 2019 18:13:44 +0000 (18:13 +0000)]
CXXSTD is the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Reviewed by: asomers
Approved by: emaste (mentor)
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D19732

5 years agoFix initial exec TLS mode for dynamically loaded shared objects.
kib [Fri, 29 Mar 2019 17:52:57 +0000 (17:52 +0000)]
Fix initial exec TLS mode for dynamically loaded shared objects.

If dso uses initial exec TLS mode, rtld tries to allocate TLS in
static space. If there is no space left, the dlopen(3) fails. If space
if allocated, initial content from PT_TLS segment is distributed to
all threads' pcbs, which was missed and caused un-initialized TLS
segment for such dso after dlopen(3).

The mode is auto-detected either due to the relocation used, or if the
DF_STATIC_TLS dynamic flag is set.  In the later case, the TLS segment
is tried to allocate earlier, which increases chance of the dlopen(3)
to succeed.  LLD was recently fixed to properly emit the flag, ld.bdf
did it always.

Initial test by: dumbbell
Tested by: emaste (amd64), ian (arm)
Tested by: Gerald Aryeetey <aryeeteygerald_rogers.com> (arm64)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19072

5 years agoEliminate adj_free field from vm_map_entry.
kib [Fri, 29 Mar 2019 16:53:46 +0000 (16:53 +0000)]
Eliminate adj_free field from vm_map_entry.

Drop the adj_free field from vm_map_entry_t. Refine the max_free field
so that p->max_free is the size of the largest gap with one endpoint
in the subtree rooted at p. Change vm_map_findspace so that, first,
the address-based splay is restricted to tree nodes with large-enough
max_free value, to avoid searching for the right starting point in a
subtree where all the gaps are too small. Second, when the address
search leads to a tree search for the first large-enough gap, that gap
is the subject of a splay-search that brings the gap to the top of the
tree, so that an immediate insertion will take constant time.

Break up the splay code into separate components, one for searching
and breaking up the tree and another for reassembling it. Use these
components, and not splay itself, for linking and unlinking. Drop the
after-where parameter to link, as it is computed as a side-effect of
the splay search.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: markj
Tested by: pho
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D17794

5 years agocxgbe/t4_tom: Catch up with r344433, which removed tcb_autorcvbuf_inc.
np [Fri, 29 Mar 2019 16:43:24 +0000 (16:43 +0000)]
cxgbe/t4_tom: Catch up with r344433, which removed tcb_autorcvbuf_inc.

The declaration in tcp_var.h is still around so t4_tom continued to
compile but wouldn't load.  A separate commit will fix tcp_var.h

Reported By: Dustin Marquess (dmarquess at gmail)

Sponsored by: Chelsio Communications

5 years agoFix restoring to graphics modes in VGLEnd().
bde [Fri, 29 Mar 2019 16:30:19 +0000 (16:30 +0000)]
Fix restoring to graphics modes in VGLEnd().

Correct restoring was only attempted for mode 258 (800x600x4 P).  (This
was the only useful graphics mode supported in the kernel until 10-15
years ago, and is still the only one explicitly documented in the man
page).  The comment says that it is the geometry (subscreen size) that
is restored, but it seems to only be necessary to restore the font
size, with the geometry only needed since it is set by the same ioctl.
The font size was not restored for this mode, but was forced to 16.

For other graphics modes, the font size was clobbered to 0.  This
confuses but doesn't crash the kernel (font size 0 gives null text).
This confuses and crashes vidcontrol.  The only way to recover was to
use vidcontrol to set the mode to any text mode on the way back to the
original graphics mode.

vidcontrol gets this wrong in the opposite way when backing out of
changes after an error.  It restores the font size correctly, but
forces the geometry to the full screen size.

5 years agoReduce the precision of "MB/s" by one, making room for displaying
trasz [Fri, 29 Mar 2019 16:05:30 +0000 (16:05 +0000)]
Reduce the precision of "MB/s" by one, making room for displaying
transfer rates larger 99MB/s.

MFC after: 2 weeks

5 years agoFix endless loops for handling SIGBUS and SIGSEGV.
bde [Fri, 29 Mar 2019 15:57:08 +0000 (15:57 +0000)]
Fix endless loops for handling SIGBUS and SIGSEGV.

r80270 has the usual wrong fix for unsafe signal handling -- just set
a flag and return to let an event loop check the flag and do safe
handling.  This never works for signals like SIGBUS and SIGSEGV that
repeat and works poorly for others unless the application has an event
loop designed to support this.

For these signals, clean up unsafely as before, except for arranging that
nested signals are fatal and forcing a nested signal if the cleanup doesn't
cause one.

5 years agoFix races in mouse signal handling almost properly using the INTOFF/INTON
bde [Fri, 29 Mar 2019 15:20:48 +0000 (15:20 +0000)]
Fix races in mouse signal handling almost properly using the INTOFF/INTON
method as in /bin/sh.

We still do technically undefined things in the signal handler, but it
is safe in practice to access state that is protected by INTOFF/INTON.

In a recent commit, I sprinkled VGLMouseFrozen++/-- operations in
places that need INTOFF/INTON.  This prevented clobbering of pixels
under the mouse, but left mouse signals deferred for too long.  It is
necessary to call the signal handler when the count goes to 0.  Old
versions did this in the unfreeze function, but didn't block actual
signals, so the signal handler raced itself.  The sprinkled operations
reduced the races, but when then worked to block a race they left
signals deferred for too long.

Use INTOFF/INTON to fix complete loss of mouse signals while reading
the mouse status.  Clobbering of the state was prevented by SIG_IGN'ing
mouse signals, but that has a high overhead and broke more than it
fixed by losing mouse signals completely.  sigprocmask() works to block
signals without losing them completely, but its overhead is also too
high.

libvgl's mouse signal handling is often worse than none.  Applications
can't block waiting for a mouse or keyboard or other event, but have
to busy-wait.  The SIG_IGN's lost about half of all mouse events while
busy-waiting for mouse events.

5 years agortld: attempt to fix reloc_non_plt TLS allocation on MIPS
emaste [Fri, 29 Mar 2019 15:07:00 +0000 (15:07 +0000)]
rtld: attempt to fix reloc_non_plt TLS allocation on MIPS

allocate_tls_offset returns true on success.  The same issue existed
on arm and was fixed in r345693.

PR: 236880
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

5 years agortld: attempt to fix reloc_nonplt_object TLS allocation
emaste [Fri, 29 Mar 2019 14:35:23 +0000 (14:35 +0000)]
rtld: attempt to fix reloc_nonplt_object TLS allocation

allocate_tls_offset returns true on success.  This still needs more
testing and review, but this change is consistent with other archs.

PR: 236880
Reported by: Andrew Gierth <andrew@tao11.riddles.org.uk>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agofix the GENERIC-NODEBUG build after r345675
asomers [Fri, 29 Mar 2019 14:07:30 +0000 (14:07 +0000)]
fix the GENERIC-NODEBUG build after r345675

Submitted by: cy
Reported by: cy, Michael Butler <imb@protected-networks.net>
MFC after: 2 weeks
X-MFC-With: 345675

5 years agoSkip test if feature security_capabilities is not available
olivier [Fri, 29 Mar 2019 08:43:21 +0000 (08:43 +0000)]
Skip test if feature security_capabilities is not available

PR: 236863
Approved by: asomers
MFC after: 1 month
Sponsored by: Netflix

5 years agoNOTES: Use non-default value for BOOT_TAG
kevans [Fri, 29 Mar 2019 04:00:46 +0000 (04:00 +0000)]
NOTES: Use non-default value for BOOT_TAG

Reported by: jhb
MFC after: 1 week (except non-empty value in stable/11)

5 years agopowerpc64: Fix kernel ldscript to only emit one PT_LOAD segment
jhibbits [Fri, 29 Mar 2019 03:01:21 +0000 (03:01 +0000)]
powerpc64: Fix kernel ldscript to only emit one PT_LOAD segment

Summary:
kexec-lite cannot currently handle multiple PT_LOAD segments.  In some
cases the compiler generates multiple PT_LOAD segments for an unknown
reason, causing boot to fail from kexec-lite.

Submitted by: Brandon Bergren (older version)
Differential Revision: https://reviews.freebsd.org/D19574

5 years agoAdd man page for VOP_FDATASYNC(9)
asomers [Fri, 29 Mar 2019 02:44:20 +0000 (02:44 +0000)]
Add man page for VOP_FDATASYNC(9)

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19678

5 years agopowerpc64: Use medium code model in asm files for TOC references
jhibbits [Fri, 29 Mar 2019 02:38:30 +0000 (02:38 +0000)]
powerpc64: Use medium code model in asm files for TOC references

Summary:
With a sufficiently large TOC, it's possible to index out of range, as
the immediate load instructions only permit 16-bit indices, allowing up
to 64kB range (signed) from the base pointer.  Allow +/- 2GB range, with
the medium code model TOC accesses in asm.

Patch originally by Brandon Bergren.  The issue appears to impact ELFv2
more than ELFv1.

Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D19708

5 years agofusefs: convert debug printfs into dtrace probes
asomers [Fri, 29 Mar 2019 02:13:06 +0000 (02:13 +0000)]
fusefs: convert debug printfs into dtrace probes

fuse(4) was heavily instrumented with debug printf statements that could
only be enabled with compile-time flags. They fell into three basic groups:

1. Totally redundant with dtrace FBT probes. These I deleted.
2. Print textual information, usually error messages. These I converted to
   SDT probes of the form fuse:fuse:FILE:trace. They work just like the old
   printf statements except they can be enabled at runtime with dtrace. They
   can be filtered by FILE and/or by priority.
3. More complicated probes that print detailed information. These I
   converted into ad-hoc SDT probes.

Also, de-inline fuse_internal_cache_attrs.  It's big enough to be a regular
function, and this way it gets a dtrace FBT probe.

This commit is a merge of r345304, r344914, r344703, and r344664 from
projects/fuse2.

Reviewed by: cem
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19667

5 years agopowerpc: Remove now-obsolete P9H MMU name
jhibbits [Fri, 29 Mar 2019 02:11:48 +0000 (02:11 +0000)]
powerpc: Remove now-obsolete P9H MMU name

5 years agoFactor out retrieving the interpreter path from the main ELF
trasz [Thu, 28 Mar 2019 21:43:01 +0000 (21:43 +0000)]
Factor out retrieving the interpreter path from the main ELF
loader routine.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19715

5 years agocxgbe(4): Count and clear interrupts generated at the software's request.
np [Thu, 28 Mar 2019 21:22:28 +0000 (21:22 +0000)]
cxgbe(4): Count and clear interrupts generated at the software's request.

An interrupt can be requested by setting the F_SWINT bit in PL_PF_CTL.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoUse a dedicated malloc type for lagg(4)'s structures.
jhb [Thu, 28 Mar 2019 21:00:54 +0000 (21:00 +0000)]
Use a dedicated malloc type for lagg(4)'s structures.

Reviewed by: gallatin
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19719

5 years agoiflib: return ENETDOWN when the network device is down
erj [Thu, 28 Mar 2019 20:46:45 +0000 (20:46 +0000)]
iflib: return ENETDOWN when the network device is down

From Jake:
iflib_if_transmit returns ENOBUFS when the device is down, or when the
link isn't active.

This was changed in r308792 from return (0), so that the function
correctly reports an error that it was unable to transmit.

However, using ENOBUFS can cause some network applications to produce
the following or similar errors:

"ping: sendto: No buffer space available"

This is a bit confusing as the real cause of the issue is that the
network device is down.

Replace the ENOBUFS return with ENETDOWN to indicate more clearly that
the reason for the failure to send is due to the network device is
offline.

This will cause the error message to be reported as

"ping: sendto: Network is down"

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@, sbruno@, bz@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19652

5 years agoiflib: hold the CTX lock in iflib_pseudo_register
erj [Thu, 28 Mar 2019 20:43:47 +0000 (20:43 +0000)]
iflib: hold the CTX lock in iflib_pseudo_register

From Jake:
The iflib_device_register function takes the CTX lock before calling
IFDI_ATTACH_PRE, and releases it upon finishing the registration.

Mirror this process in iflib_pseudo_register, so that we always hold the
CTX lock during the attach process when registering a pseudo interface
or a regular interface.

This was caught by code inspection while attempting to analyze where the
CTX lock was held.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@, erj@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19604

5 years agoDo not map small IOCTL buffers to KVA, but copy.
mav [Thu, 28 Mar 2019 20:41:02 +0000 (20:41 +0000)]
Do not map small IOCTL buffers to KVA, but copy.

CAM IOCTL interfaces traditionally mapped user-space data buffers to KVA.
It was nice originally, but now it takes too much to handle respective
TLB shootdowns, while small kernel memory allocations up to 64KB backed
by UMA and accompanied by copyin()/copyout() can be much cheaper.

For large buffers mapping still may have sense, and unmapped I/O would
be even better, but the last unfortunately is more tricky, since unmapped
I/O API is too specific to struct bio now.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoRemove nested epochs from lagg(4).
jhb [Thu, 28 Mar 2019 20:25:36 +0000 (20:25 +0000)]
Remove nested epochs from lagg(4).

lagg_bcast_start appeared to have a bug in that was using the last
lagg port structure after exiting the epoch that was keeping that
structure alive.  However, upon further inspection, the epoch was
already entered by the caller (lagg_transmit), so the epoch enter/exit
in lagg_bcast_start was actually unnecessary.

This commit generally removes uses of the net epoch via LAGG_RLOCK to
protect the list of ports when the list of ports was already protected
by an existing LAGG_RLOCK in a caller, or the LAGG_XLOCK.

It also adds a missing epoch enter/exit in lagg_snd_tag_alloc while
accessing the lagg port structures.  An ifp is still accessed via an
unsafe reference after the epoch is exited, but that is true in the
current code and will be fixed in a future change.

Reviewed by: gallatin
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19718

5 years agoMake the "KB/s" field one character shorter (by reducing the precision)
trasz [Thu, 28 Mar 2019 20:16:19 +0000 (20:16 +0000)]
Make the "KB/s" field one character shorter (by reducing the precision)
and use the space to make the "tps" one character longer.

It makes the iostat(8) output a bit less messed up.

Reviewed by: allanjude
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19710

5 years agoDistinguish between lseek errors and read errores.
delphij [Thu, 28 Mar 2019 18:20:47 +0000 (18:20 +0000)]
Distinguish between lseek errors and read errores.

MFC after: 2 weeks

5 years agoreadelf: add newline after dumping dynamic FLAGS / FLAGS_1
emaste [Thu, 28 Mar 2019 17:30:47 +0000 (17:30 +0000)]
readelf: add newline after dumping dynamic FLAGS / FLAGS_1

All three dump_flags() callers need a newline after printing the flags.

Sponsored by: The FreeBSD Foundation

5 years agoSpam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS
ngie [Thu, 28 Mar 2019 17:22:31 +0000 (17:22 +0000)]
Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS

This makes it easier for googletest users to leverage googletest, instead of
forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in
unnecessary duplication).

I will be following this up with a more proper fix in src.libnames.mk, as
src.libnames.mk should be automatically adding this directory to
CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result
in mismatches between base-provided private library's and ports-provided
library's headers.

While here, tweak the comment to clarify what the intent is behind spamming
CXXFLAGS.

MFC after: 5 weeks
MFC with: r345203
Reported by: asomers
Reviewed by: asomers
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D19731

5 years agoSkip this test if if_tap module is not available
olivier [Thu, 28 Mar 2019 16:17:33 +0000 (16:17 +0000)]
Skip this test if if_tap module is not available

PR: 236842
Approved by: asomers
MFC after: 1 month
Sponsored by: Netflix

5 years agoFix VGLLine() in depths > 8.
bde [Thu, 28 Mar 2019 14:21:22 +0000 (14:21 +0000)]
Fix VGLLine() in depths > 8.

It started truncating its color arg to 8 bits using plot() in r229415.
The version in r229415 is also more than 3 times slower in segmented
modes, by doing more syscalls to move the window.

5 years agoRevert other accidentally committed part of r345625
emaste [Thu, 28 Mar 2019 13:27:34 +0000 (13:27 +0000)]
Revert other accidentally committed part of r345625

5 years agoFix VGLGetXY(), VGLSetXY() and VGLClear() for MEMBUFs in depths > 8.
bde [Thu, 28 Mar 2019 12:28:29 +0000 (12:28 +0000)]
Fix VGLGetXY(), VGLSetXY() and VGLClear() for MEMBUFs in depths > 8.

This depends on PixelBytes being properly initialized, which it is for
all bitmaps constructed by libvgl except mouse cursor bitmaps.

5 years agoRevert change accidentally committed along with r345625
emaste [Thu, 28 Mar 2019 10:56:27 +0000 (10:56 +0000)]
Revert change accidentally committed along with r345625

Reported by: Oliver Pinter <oliver.pinter@hardenedbsd.org>

5 years agoOops, r345496 got the pointer args backwards for bcopy() in VGLClear for
bde [Thu, 28 Mar 2019 09:51:37 +0000 (09:51 +0000)]
Oops, r345496 got the pointer args backwards for bcopy() in VGLClear for
segmented modes.

Also fix some style bugs in the 2 changed lines.  libvgl uses a very non-KNF
style with 2-column indentation with no tabs except for regressions.

5 years agoAdd new USB PCI ID.
hselasky [Thu, 28 Mar 2019 09:00:56 +0000 (09:00 +0000)]
Add new USB PCI ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix `make` in sys/modules
lwhsu [Thu, 28 Mar 2019 08:59:11 +0000 (08:59 +0000)]
Fix `make` in sys/modules

Sponsored by: The FreeBSD Foundation

5 years agoAdd dependent header files
lwhsu [Thu, 28 Mar 2019 08:30:45 +0000 (08:30 +0000)]
Add dependent header files

Reported by: https://ci.freebsd.org/job/FreeBSD-head-mips-build/6702/console

5 years agodtc(1): Update to 1a79f5f26631
kevans [Thu, 28 Mar 2019 03:48:51 +0000 (03:48 +0000)]
dtc(1): Update to 1a79f5f26631

Highlights:
- Bugfix for order in which /delete-node/ and /delete-property/ are
  processed [0]
- /omit-if-no-ref/ support has been added (used only by U-Boot at this
  point, in theory)
- GPL dtc compat version bumped to 1.4.7
- Various small fixes and compatibility improvements

Reported by: strejda [0]
MFC after: 1 week

5 years agoif_bridge(4): ensure all traffic passing over the bridge is accounted for
kevans [Thu, 28 Mar 2019 03:31:51 +0000 (03:31 +0000)]
if_bridge(4): ensure all traffic passing over the bridge is accounted for

Consider a bridge0 with em0 and em1 members. Traffic rx'd by em0 and
transmitted by bridge0 through em1 gets accounted for in IPACKETS/IBYTES
and bridge0 bpf -- assuming it's not unicast traffic destined for em1.
Unicast traffic destined for em1 traffic is not accounted for by any
mechanism, and isn't pushed through bridge0's bpf machinery as any other
packets that pass over the bridge do.

Fix this and simplify GRAB_OUR_PACKETS by bailing out early if it was rx'd
by the interface that it was addressed for. Everything else there is
relevant for any traffic that came in from one member that's being directed
at another member of the bridge.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19614

5 years agorevert r341429 "disable BIND_NOW in libc, libthr, and rtld"
emaste [Thu, 28 Mar 2019 02:12:32 +0000 (02:12 +0000)]
revert r341429 "disable BIND_NOW in libc, libthr, and rtld"

r345620 by kib@ fixed the rtld issue that caused a crash at startup
during resolution of libc's ifuncs with BIND_NOW.

PR: 233333
Sponsored by: The FreeBSD Foundation

5 years agortld: disable relro enforcement for irelative relocation processing.
kib [Wed, 27 Mar 2019 22:35:28 +0000 (22:35 +0000)]
rtld: disable relro enforcement for irelative relocation processing.

This fixes yet another breakage for relro + bind now.

Reported by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoTeach jedec_dimm(4) to be more forgiving of non-fatal errors.
rpokala [Wed, 27 Mar 2019 21:50:01 +0000 (21:50 +0000)]
Teach jedec_dimm(4) to be more forgiving of non-fatal errors.

It looks like some DIMMs claim to have a TSOD, but actually don't. Some
claim they weren't able to change the SPD page, but they did. Neither of
those should be fatal errors.

PR: 235944
Submitted by: Greg V <greg@unrelenting.technology>
Reported by: Greg V <greg@unrelenting.technology>
Reviewed by: cem
MFC after: 1 weeks
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D19681

5 years agoUse the BUS_DMA_NOWRITE flag to expose and create the read-only VT-d
tychon [Wed, 27 Mar 2019 20:15:51 +0000 (20:15 +0000)]
Use the BUS_DMA_NOWRITE flag to expose and create the read-only VT-d
IOMMU mappings.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19729

5 years agoFix pidfile_open(3) to handle relative paths with multiple components.
markj [Wed, 27 Mar 2019 19:40:18 +0000 (19:40 +0000)]
Fix pidfile_open(3) to handle relative paths with multiple components.

r322369's use of basename(3) was incorrect and worked by accident so
long as the pidfile path was absolute or consisted of a single
component.  Fix the basename() usage and add a regression test.

Reported by: 0mp
Reviewed by: cem
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19728

5 years agoStop using -fdebug-prefix-map to map the object directory.
markj [Wed, 27 Mar 2019 19:34:19 +0000 (19:34 +0000)]
Stop using -fdebug-prefix-map to map the object directory.

We were doing so as a workaround for the problem addressed by r345593, so
it's no longer necessary.

Reviewed by: jhb
Discussed with: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19705

5 years agoPrepend DW_AT_comp_dir to relative line number directory table entries.
markj [Wed, 27 Mar 2019 19:32:21 +0000 (19:32 +0000)]
Prepend DW_AT_comp_dir to relative line number directory table entries.

Relative directories may appear in the line number program for a CPU if
files were included via a relative path, for instance with "-I.".
Previously, dwarf_srclines(3) and dwarf_srcfiles(3) would return the
relative path, so addr2line, for instance, would do the same.  However,
we can get an absolute path by prepending the compilation directory, so
change libdwarf to do that to improve compatibility with GNU binutils
and since it is more useful in general.

Reviewed by: jhb
Discussed with: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19705

5 years agoFix accessing pixels under the mouse cursor:
bde [Wed, 27 Mar 2019 18:03:34 +0000 (18:03 +0000)]
Fix accessing pixels under the mouse cursor:

Reading of single pixels didn't look under the cursor.

Copying of 1x1 bitmaps didn't look under the cursor for either reading
or writing.

Copying of larger bitmaps looked under the cursor for at most the
destination.

Copying of larger bitmaps looked under a garbage cursor (for the Display
bitmap) when the destination is a MEMBUF.  The results are not used, so
this only wasted time and flickered the cursor.

Writing of single pixels looked under a garbage cursor for MEMBUF
destinations, as above except this clobbered the current cursor and
didn't update the MEMBUF.  Writing of single pixels is not implemented
yet in depths > 8.  Otherwise, writing of single pixels worked.  It was
the only working case for accessing pixels under the cursor.

Clearing of MEMBUFs wasted time freezing the cursor in the Display bitmap.

The fixes abuse the top bits in the color arg to the cursor freezing
function to control the function.  Also clear the top 8 bits so that
applications can't clobber the control bits or create 256 aliases for
every 24-bit pixel value in depth 32.

Races fixed:

Showing and hiding the cursor only tried to avoid races with the mouse
event signal handler for internal operations.  There are still many
shorter races from not using volatile or sig_atomic_t for the variable
to control this.  This variable also controls freezes, and has more
complicated states than before.

The internal operation of unfreezing the cursor opened a race window
by unsetting the signal/freeze variable before showing the cursor.

5 years agopkgbase: Use uname as ABI_FILE
manu [Wed, 27 Mar 2019 17:55:39 +0000 (17:55 +0000)]
pkgbase: Use uname as ABI_FILE

Add some more missed in r345159

MFC after: 1 week

5 years agorevert r302146: makeroot: zero out subsecond component of time= keywords
emaste [Wed, 27 Mar 2019 17:28:23 +0000 (17:28 +0000)]
revert r302146: makeroot: zero out subsecond component of time= keywords

After r345281 by mhorne subsecond components are supported.

PR: 194703
Sponsored by: The FreeBSD Foundation

5 years agoGrab timer frequency from FDT.
br [Wed, 27 Mar 2019 16:26:03 +0000 (16:26 +0000)]
Grab timer frequency from FDT.

RISC-V timer has no dedicated DTS node and we have to get timer
frequency from cpus node.

Tested on Government Furnished Equipment (GFE) cores synthesized
on Xilinx VCU118.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19727

5 years agoAdd workaround for a QoS-related bug in VMWare Workstation.
des [Wed, 27 Mar 2019 15:17:29 +0000 (15:17 +0000)]
Add workaround for a QoS-related bug in VMWare Workstation.

Submitted by: yuripv
Differential Revision: https://reviews.freebsd.org/D18636

5 years agoMerge r345574 from vendor-crypto:
emaste [Wed, 27 Mar 2019 14:35:38 +0000 (14:35 +0000)]
Merge r345574 from vendor-crypto:

upstream: when checking that filenames sent by the server side

match what the client requested, be prepared to handle shell-style brace
alternations, e.g. "{foo,bar}".

"looks good to me" millert@ + in snaps for the last week courtesy
deraadt@

OpenBSD-Commit-ID: 3b1ce7639b0b25b2248e3a30f561a548f6815f3e

Discussed with: des
Obtained from: OpenSSH-portable 3d896c157c722bc47adca51a58dca859225b5874

5 years agoAdd missing break statements. Coverity CID 1400446.
scottl [Wed, 27 Mar 2019 12:25:46 +0000 (12:25 +0000)]
Add missing break statements.  Coverity CID 1400446.

Reported by: mav

5 years agoFix copying of bitmaps in depths > 8. This fix is complete, except different
bde [Wed, 27 Mar 2019 08:02:55 +0000 (08:02 +0000)]
Fix copying of bitmaps in depths > 8.  This fix is complete, except different
depths for the source and target are not supported.  The bits for higher
numbered planes (mostly for red) were either not copied or were copied to
lower numbered planes for nearby pixels.

Quick fix for creation of mouse cursor bitmaps in all depths.   This fix is
only complete for the default lightwhite cursor with a black frame.

Even the lightwhite and black colors are hard to find.  The templates
use 0xff for lightwhite, but that means brightblue in the simplest mode
(Truecolor depth 24).  Other modes are even more complicated -- they are
singly or doubly indirect throught palette(s) and changing of the palettes
by applications is supported.

Details:

Replicate the template value for Truecolor modes to fill out the target
depth (and more for depths not a multiple of 8).  Do this for every
drawing of the cursor so that it sort of works for mouse cursor bitmaps
set by applications.

Use 0xf for lightwhite in most other modes.  Only do this for the
default cursor so that it doesn't affect mouse cursor bitmaps set by
applications.  0xf mostly works because it was originally for CGA
lightwhite and is emulated using 1 or 2 indirections on EGA and VGA.
0x3f (EGA white) and 0xff (VGA black) direct palette indexes mostly
don't work since backwards compatibility inhibits or prevents them
representing lightwhite.  But 0x3f (EGA white) must be used for mode
37 (VGA_MODEX) (320x240x8 V) since this mode is closer to EGA than VGA.

5 years agox86: Use XSAVEOPT for fpusave(), when available
cem [Tue, 26 Mar 2019 22:45:41 +0000 (22:45 +0000)]
x86: Use XSAVEOPT for fpusave(), when available

Remove redundant npxsave_core definition while here.

Suggested by: Anton Rang
Reviewed by: kib, Anton Rang <rang AT acm.org>
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19665