]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAdd cam_iosched_set_latfcn to set a latency callback for high latency.
Warner Losh [Thu, 15 Nov 2018 16:02:45 +0000 (16:02 +0000)]
Add cam_iosched_set_latfcn to set a latency callback for high latency.

It's often useful to have a callback when an I/O takes more than a
threshold amount of time. This adds the infrastructure for periph
devices to register one.

One use-case is as a debugging aide when you need a semi-realtime
indication of an I/O outlier so you can trigger bus capture gear for
vendor analysis.

Sponsored by: Netflix, Inc

5 years agoIntroduce scsi_ata_setfeatures() as a convenient way to make
Warner Losh [Thu, 15 Nov 2018 16:02:34 +0000 (16:02 +0000)]
Introduce scsi_ata_setfeatures() as a convenient way to make
a passthru ATA SETFEATURES command.

Sponsored by: Netflix, Inc

5 years agoDo proper conversion to/from sbt.
Warner Losh [Thu, 15 Nov 2018 16:02:24 +0000 (16:02 +0000)]
Do proper conversion to/from sbt.

Doh! sbttoX and Xtosbt were backwards. While they ran, they produced
bogus results.

Pointy hat to: imp@

5 years agoWhen converting ns,us,ms to sbt, return the ceil() of the result
Warner Losh [Thu, 15 Nov 2018 16:02:13 +0000 (16:02 +0000)]
When converting ns,us,ms to sbt, return the ceil() of the result
rather than the floor(). Returning the floor means that
sbttoX(Xtosbt(y)) != y for almost all values of y.  In practice, this
results in a difference of at most 1 in the lsb of the sbintime_t.
This difference is meaningless for all current users of these
functions, but is important for the newly introduced sysctl conversion
routines which implicitly rely on the transformation being idempotent.

Sponsored by: Netflix, Inc

5 years agoRemove trailing white space in advance of other changes.
Warner Losh [Wed, 14 Nov 2018 23:15:50 +0000 (23:15 +0000)]
Remove trailing white space in advance of other changes.

5 years agoClear RX completion queue state veriables in iflib_stop()
Stephen Hurd [Wed, 14 Nov 2018 20:36:18 +0000 (20:36 +0000)]
Clear RX completion queue state veriables in iflib_stop()

iflib_stop() was not resetting the rxq completion queue state variables.
This meant that for any driver that has receive completion queues, after a
reinit, iflib would start asking what's available on the rx side starting at
whatever the completion queue index was prior to the stop, instead of at 0.

Submitted by: pkelsey
Reported by: pkelsey
MFC after: 3 days
Sponsored by: Limelight Networks

5 years agoInitialize compatibility epoch tracker for thread0. Fixes
Gleb Smirnoff [Wed, 14 Nov 2018 19:10:35 +0000 (19:10 +0000)]
Initialize compatibility epoch tracker for thread0. Fixes
panics for drivers that call if_maddr_lock() during startup.

Reported by: cy

5 years agomountd has no way to configure the listen queue depth; rather than add a new
Sean Eric Fagan [Wed, 14 Nov 2018 19:06:43 +0000 (19:06 +0000)]
mountd has no way to configure the listen queue depth; rather than add a new
option, we pass -1 down to listen, which causes it to use the
kern.ipc.soacceptqueue sysctl.

Approved by: mav
MFC after: 2 weeks
Sponsored by: iXsystems Inc

5 years agoRevert r332735 and fix MSI-X to properly fail allocations when full.
John Baldwin [Wed, 14 Nov 2018 18:45:33 +0000 (18:45 +0000)]
Revert r332735 and fix MSI-X to properly fail allocations when full.

The off-by-one errors in 332735 weren't actual errors and were
preventing the last MSI interrupt source from being used.  Instead,
the issue is that when all MSI interrupt sources were allocated, the
loop in msix_alloc() would terminate with 'msi' still set to non-null.
The only check for 'i' overflowing was in the 'msi' == NULL case, so
msix_alloc() would try to reuse the last MSI interrupt source instead
of failing.

Fix by moving the check for all sources being in use to just after the
loop.

Reviewed by: kib, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17976

5 years agoFix typo introduced in r340439 - s/ETN/ETC/
Renato Botelho [Wed, 14 Nov 2018 18:38:27 +0000 (18:38 +0000)]
Fix typo introduced in r340439 - s/ETN/ETC/

Reported by: jhb, yuripv
Approved by: eugen
MFC after: 3 days
X-MFC-With: 340439
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoFix /etc/ntp permissions. According to mtree it must be 0700
Renato Botelho [Wed, 14 Nov 2018 16:19:15 +0000 (16:19 +0000)]
Fix /etc/ntp permissions. According to mtree it must be 0700

Reviewed by: imp
Approved by: imp
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D17973

5 years agoHook mac_ntpd.4 up to the build.
Mark Johnston [Wed, 14 Nov 2018 16:18:13 +0000 (16:18 +0000)]
Hook mac_ntpd.4 up to the build.

PR: 232757
Submitted by: Yasuhiro KIMURA <yasu@utahime.org>
MFC after: 3 days

5 years agoFix the path to malloc_domain.9.
Mark Johnston [Wed, 14 Nov 2018 16:15:36 +0000 (16:15 +0000)]
Fix the path to malloc_domain.9.

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

5 years agovtnet: fix netmap support
Vincenzo Maffione [Wed, 14 Nov 2018 15:39:48 +0000 (15:39 +0000)]
vtnet: fix netmap support

netmap(4) support for vtnet(4) was incomplete and had multiple bugs.
This commit fixes those bugs to bring netmap on vtnet in a functional state.

Changelist:
  - handle errors returned by virtqueue_enqueue() properly (they were
    previously ignored)
  - make sure netmap XOR rest of the kernel access each virtqueue.
  - compute the number of netmap slots for TX and RX separately, according to
    whether indirect descriptors are used or not for a given virtqueue.
  - make sure sglist are freed according to their type (mbufs or netmap
    buffers)
  - add support for mulitiqueue and netmap host (aka sw) rings.
  - intercept VQ interrupts directly instead of intercepting them in txq_eof
    and rxq_eof. This simplifies the code and makes it easier to make sure
    taskqueues are not running for a VQ while it is in netmap mode.
  - implement vntet_netmap_config() to cope with changes in the number of queues.

Reviewed by: bryanv
Approved by: gnn (mentor)
MFC after: 3 days
Sponsored by: Sunny Valley Networks
Differential Revision: https://reviews.freebsd.org/D17916

5 years agoPrevent POLA violation with TSO/CSUM offload
Stephen Hurd [Wed, 14 Nov 2018 15:23:39 +0000 (15:23 +0000)]
Prevent POLA violation with TSO/CSUM offload

Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding
CSUM_IP6?_TCP / CSUM_IP flags are also set.

Rather than requireing drivers to bake-in an understanding that TSO implies
checksum offloads, make it explicit.

This change requires us to move the IFLIB_NEED_ZERO_CSUM implementation to
ensure it's zeroed for TSO.

Reported by: Jacob Keller <jacob.e.keller@intel.com>
MFC after: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17801

5 years agoFix leaks caused by ifc_nhwtxqs never being initialized
Stephen Hurd [Wed, 14 Nov 2018 15:16:45 +0000 (15:16 +0000)]
Fix leaks caused by ifc_nhwtxqs never being initialized

r333502 removed initialization of ifc_nhwtxqs, and it's not clear
there's a need to copy it into the struct iflib_ctx at all. Use
ctx->ifc_sctx->isc_ntxqs instead.

Further, iflib_stop() did not clear the last ring in the case where
isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use
ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl.

Reported by: pkelsey
Reviewed by: pkelsey
MFC after: 3 days
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17979

5 years agosmbutil(1): Improve mdoc formatting.
Mateusz Piotrowski [Wed, 14 Nov 2018 15:15:07 +0000 (15:15 +0000)]
smbutil(1): Improve mdoc formatting.

Also, make the path to the example configuration file absolute.

Reviewed by: bcr
Approved by: krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17985

5 years agoAdd the driver for the SPI controller on ARMADA38X.
Luiz Otavio O Souza [Wed, 14 Nov 2018 14:26:32 +0000 (14:26 +0000)]
Add the driver for the SPI controller on ARMADA38X.

Tested on Clearfog (Pro) and SG-3100.

Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoAdd d_off support for multiple filesystems.
Konstantin Belousov [Wed, 14 Nov 2018 14:18:35 +0000 (14:18 +0000)]
Add d_off support for multiple filesystems.

The d_off field has been added to the dirent structure recently.
Currently filesystems don't support this feature.  Support has been
added and tested for zfs, ufs, ext2fs, fdescfs, msdosfs and unionfs.
A stub implementation is available for cd9660, nandfs, udf and
pseudofs but hasn't been tested.

Motivation for this feature: our usecase is for a userspace nfs server
(nfs-ganesha) with zfs.  At the moment we cache direntry offsets by
calling lseek once per entry, with this patch we can get the offset
directly from getdirentries(2) calls which provides a significant
speedup.

Submitted by: Jack Halford <jack@gandi.net>
Reviewed by: mckusick, pfg, rmacklem (previous versions)
Sponsored by: Gandi.net
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17917

5 years agoPick 57553c3b1a5592dc4c03f3c6831d9b794e523865 from upstream:
Edward Tomasz Napierala [Wed, 14 Nov 2018 13:06:48 +0000 (13:06 +0000)]
Pick 57553c3b1a5592dc4c03f3c6831d9b794e523865 from upstream:

    Avoid touching all pages in extent_recycle for debug build.

    We may have a large number of pages with *zero set (since they are populated on
    demand).  Only check the first page to avoid paging in all of them.

This makes it easy to compare performance with and without 'retain:true'.

Discussed with: jasone
Obtained from: Qi Wang <interwq at gwu dot edu>
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoFix WITHOUT_ICONV build after r340276.
Yuri Pankov [Wed, 14 Nov 2018 09:06:15 +0000 (09:06 +0000)]
Fix WITHOUT_ICONV build after r340276.

Reported by: olivier
Approved by: kib (mentor, implicit)

5 years agoPrepare move of ctm from base to a port (misc/ctm) by:
Stefan Eßer [Wed, 14 Nov 2018 08:45:48 +0000 (08:45 +0000)]
Prepare move of ctm from base to a port (misc/ctm) by:
- Adding a note to UPDATING
- Adding a note to the history section of the manpage ctm.1
- Adding a message printed to STDERR to the ctm program

This version is meant for release in FreeBSD-12.0 and should remain in
FreeBSD-12 over its life-time.

A follow-up commit will remove ctm from -CURRENT after the MFC to 12
has happened.

Approved by: imp, rgrimes, bcr (man-page)
MFC after: 3 days
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D17969

5 years agoamdtemp(4): Fix temperature reporting on AMD 2990WX
Conrad Meyer [Wed, 14 Nov 2018 04:50:29 +0000 (04:50 +0000)]
amdtemp(4): Fix temperature reporting on AMD 2990WX

Update the AMD family 17h temperature reporting based on AMD Tech Doc 56255
OSRR, section 4.2.1.

For CPUS w/CUR_TEMP_RANGE_SEL set, scale the reported temperature into the
range -49..206; i.e., subtract 49°C.

Submitted by: gallatin@
Reported by: bcran@
Reviewed by: me (long ago)
MFC after: 22.57 seconds
Relnotes: yea
Differential Revision: https://reviews.freebsd.org/D16855

5 years agoamdsmn(4)/amdtemp(4): Attach to Ryzen 2 hostbridges
Conrad Meyer [Wed, 14 Nov 2018 03:42:39 +0000 (03:42 +0000)]
amdsmn(4)/amdtemp(4): Attach to Ryzen 2 hostbridges

As reported, tested, and patch supplied by Johannes.

There may be future work to do to support multiple sensors, but for now, any
sensor at all is a strict improvement for Ryzen 2 systems.

PR: 228480
Submitted by: Johannes Lundberg <johalun0 AT gmail.com> (earlier version)
Reported by: deischen@, Johannes, and numerous others
MFC after: 3.72 days

5 years agoUse the main capabilities.conf for freebsd32.
Brooks Davis [Wed, 14 Nov 2018 00:46:02 +0000 (00:46 +0000)]
Use the main capabilities.conf for freebsd32.

Allow the location of capabilities.conf to be configured.

Also allow a per-abi syscall prefix to be configured with the
abi_func_prefix syscalls.conf variable and check syscalls against
entries in capabilities.conf with and without the prefix amended.

Take advantage of these two features to allow use shared capabilities.conf
between the default syscall vector and the freebsd32 compatability
layer.  We've been inconsistent about keeping the two in sync as
evidenced by the bugs fixed in r340294.  This eliminates that problem
going forward.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17932

5 years agoFix build on some architectures after r340413. On amd64 epoch.h
Gleb Smirnoff [Wed, 14 Nov 2018 00:33:03 +0000 (00:33 +0000)]
Fix build on some architectures after r340413. On amd64 epoch.h
appeared to be included implicitly.

5 years agoFix build break from dump incompatibility I introduced in -r340411
Kirk McKusick [Wed, 14 Nov 2018 00:21:52 +0000 (00:21 +0000)]
Fix build break from dump incompatibility I introduced in -r340411

Pointy-hat to: mckusick

5 years agocpucontrol(8): De-duplicate common update logic
Conrad Meyer [Wed, 14 Nov 2018 00:21:49 +0000 (00:21 +0000)]
cpucontrol(8): De-duplicate common update logic

Every µcode-updater must open the cpucontrol devfs node RDWR, open a
firmware file, validate the FW file has a positive length, mmap it, etc.
De-duplicate that identical logic between every individual platform.

Also, constify references to the readonly-mapped firmware files while here.

Sponsored by: Dell EMC Isilon

5 years agoepoch(9) revert r340097 - no longer a need for multiple sections per cpu
Matt Macy [Wed, 14 Nov 2018 00:12:04 +0000 (00:12 +0000)]
epoch(9) revert r340097 - no longer a need for multiple sections per cpu

I spoke with Samy Bahra and recent changes to CK to make ck_epoch_call and
ck_epoch_poll not modify the record have eliminated the need for this.

5 years agostyle(9), mostly adjusting overly long lines.
Gleb Smirnoff [Tue, 13 Nov 2018 23:57:34 +0000 (23:57 +0000)]
style(9), mostly adjusting overly long lines.

5 years agoRemove support for versions prior to FreeBSD 7.0 from twa(4)
Warner Losh [Tue, 13 Nov 2018 23:53:24 +0000 (23:53 +0000)]
Remove support for versions prior to FreeBSD 7.0 from twa(4)

This was for pre-7.0 CAM support. Neither the CAM nor the busdma
changes over the years have not been ifdef'd. The code cannot build
on 6.x anymore. Support for 6.4 ended in 2010, so remove them.

5 years agoWith epoch not inlined, there is no point in using _lite KPI. While here,
Gleb Smirnoff [Tue, 13 Nov 2018 23:45:38 +0000 (23:45 +0000)]
With epoch not inlined, there is no point in using _lite KPI. While here,
remove some unnecessary casts.

5 years agoPlug build break after r340411.
Gleb Smirnoff [Tue, 13 Nov 2018 23:44:27 +0000 (23:44 +0000)]
Plug build break after r340411.

5 years agoThe dualism between epoch_tracker and epoch_thread is fragile and
Gleb Smirnoff [Tue, 13 Nov 2018 23:20:55 +0000 (23:20 +0000)]
The dualism between epoch_tracker and epoch_thread is fragile and
unnecessary. So, expose CK types to kernel and use a single normal
structure for epoch_tracker.

Reviewed by: jtl, gallatin

5 years agoAdd ZFS to amd64 NOTES to catch future breakage of static linking
Matt Macy [Tue, 13 Nov 2018 23:08:46 +0000 (23:08 +0000)]
Add ZFS to amd64 NOTES to catch future breakage of static linking

5 years agoFor compatibility KPI functions like if_addr_rlock() that used to have
Gleb Smirnoff [Tue, 13 Nov 2018 22:58:38 +0000 (22:58 +0000)]
For compatibility KPI functions like if_addr_rlock() that used to have
mutexes but now are converted to epoch(9) use thread-private epoch_tracker.
Embedding tracker into ifnet(9) or ifnet derived structures creates a non
reentrable function, that will fail miserably if called simultaneously from
two different contexts.
A thread private tracker will provide a single tracker that would allow to
call these functions safely. It doesn't allow nested call, but this is not
expected from compatibility KPIs.

Reviewed by: markj

5 years agoUse atomic_load_acq_int() here too to poll done, ala r328521
Warner Losh [Tue, 13 Nov 2018 22:41:20 +0000 (22:41 +0000)]
Use atomic_load_acq_int() here too to poll done, ala r328521

5 years agoIn preparation for adding inode check-hashes, clean up and
Kirk McKusick [Tue, 13 Nov 2018 21:40:56 +0000 (21:40 +0000)]
In preparation for adding inode check-hashes, clean up and
document the libufs interface for fetching and storing inodes.
The undocumented getino / putino interface has been replaced
with a new getinode / putinode interface.

Convert the utilities that had been using the undocumented
interface to use the new documented interface.

No functional change (as for now the libufs library does not
do inode check-hashes).

Reviewed by:  kib
Tested by:    Peter Holm
Sponsored by: Netflix

5 years agolocks: plug warnings about unitialized variables
Mateusz Guzik [Tue, 13 Nov 2018 21:29:56 +0000 (21:29 +0000)]
locks: plug warnings about unitialized variables

They only showed up after I redefined LOCKSTAT_ENABLED to 0.

doing_lockprof in mutex.c is a real (but harmless) bug. Should the
value be non-zero it will do checks for lock profiling which would
otherwise be skipped.

state in rwlock.c is a wart from the compiler, the value can't be
used if lock profiling is not enabled.

Sponsored by: The FreeBSD Foundation

5 years agoMake no assertions about lock state when the scheduler is stopped.
Eric van Gyzen [Tue, 13 Nov 2018 20:48:05 +0000 (20:48 +0000)]
Make no assertions about lock state when the scheduler is stopped.

Change the assert paths in rm, rw, and sx locks to match the lock
and unlock paths.  I did this for mutexes in r306346.

Reported by: Travis Lane <tlane@isilon.com>
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoEnsure that libnv can be used when kern.trap_enotcap=1.
Mark Johnston [Tue, 13 Nov 2018 20:07:55 +0000 (20:07 +0000)]
Ensure that libnv can be used when kern.trap_enotcap=1.

libnv used fcntl(fd, F_GETFL) to test whether fd is a valid file
descriptor.  Aside from being racy, this check requires CAP_FCNTL
rights on fd.  Instead, use fcntl(fd, F_GETFD), which does not require
any capability rights.

Also remove some redundant fd_is_valid() checks to avoid extra system
calls; in many cases we were performing this check immediately before
dup()ing the descriptor.

Reviewed by: cem, oshogbo (previous version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17963

5 years agoIn followup to r340406, remove doc from the EXTRA_DISTRIBUTIONS
Glen Barber [Tue, 13 Nov 2018 19:53:02 +0000 (19:53 +0000)]
In followup to r340406, remove doc from the EXTRA_DISTRIBUTIONS
list and remaining references from the script used to create the
MANIFEST file used by bsdinstall(8).

No MFC is planned at this time.

Sponsored by: The FreeBSD Foundation

5 years agoThe roff ascii.gz documentation installed to /usr/share/doc
Glen Barber [Tue, 13 Nov 2018 19:51:22 +0000 (19:51 +0000)]
The roff ascii.gz documentation installed to /usr/share/doc
was removed in r318881 when roff was removed from the base
system.

This results in the doc.txz distribution set containing a
single directory (./) which is empty.

Remove the "Additional documentation" option from the menu
selection of bsdinstall(8), as the plain-text documentation
installed in /usr/share/doc is installed as part of the
packageworld target.

The doc entry has not been removed from EXTRA_DISTRIBUTIONS
in Makefile.inc1, in case its removal triggers an issue with
freebsd-update(8), which is currently aware of the world/doc
component, so the empty doc.txz continues to be created as
a precaution.

Noticed by: rgrimes
MFC after: 2 days
MFC before: 12.0-RC1
Sponsored by: The FreeBSD Foundation

5 years agoAdd accounting to per-domain UMA full bucket caches.
Mark Johnston [Tue, 13 Nov 2018 19:44:40 +0000 (19:44 +0000)]
Add accounting to per-domain UMA full bucket caches.

In particular, track the current size of the cache and maintain an
estimate of its working set size.  This will be used to decide how
much to shrink various caches when the kernel attempts to reclaim
pages.  As a secondary effect, it makes statistics aggregation (done
by, e.g., vmstat -z) cheaper since sysctl_vm_zone_stats() no longer
needs to iterate over lists of cached buckets.

Discussed with: alc, glebius, jeff
Tested by: pho (previous version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D16666

5 years agoUninline epoch(9) entrance and exit. There is no proof that modern
Gleb Smirnoff [Tue, 13 Nov 2018 19:02:11 +0000 (19:02 +0000)]
Uninline epoch(9) entrance and exit. There is no proof that modern
processors would benefit from avoiding a function call, but bloating
code. In fact, clang created an uninlined real function for many
object files in the network stack.

- Move epoch_private.h into subr_epoch.c. Code copied exactly, avoiding
  any changes, including style(9).
- Remove private copies of critical_enter/exit.

Reviewed by: kib, jtl
Differential Revision: https://reviews.freebsd.org/D17879

5 years agoAllow allocations across meta boundaries.
Mark Johnston [Tue, 13 Nov 2018 18:40:01 +0000 (18:40 +0000)]
Allow allocations across meta boundaries.

Remove restrictions that prevent allocation requests to cross the
boundary between two meta nodes.

Replace the bmu_avail field in meta nodes with a bitmap that identifies
which subtrees have some free memory, and iterate over the nonempty
subtrees only in blst_meta_alloc.  If free memory is scarce, this should
make searching for it faster.

Put the code for handling the next-leaf allocation in a separate
function.  When taking blocks from the next leaf empties the leaf, be
sure to clear the appropriate bit in its parent, and so on, up to the
least-common ancestor of this leaf and the next.

Eliminate special terminator nodes, and rely instead on the fact that
there is a 0-bit at the end of the bitmask at the root of the tree that
will stop a meta_alloc search, or a next-leaf search, before the search
falls off the end of the tree. Make sure that the tree is big enough to
have space for that 0-bit.

Eliminate special all-free indicators.  Lazy initialization of subtrees
stands in the way of having an allocation span a meta-node boundary, so
a subtree of all free blocks is not treated specially.  Subtrees of
all-allocated blocks are still recognized by looking at the bitmask at
the root and finding 0.

Don't print all-allocated subtrees.  Do print the bitmasks for meta
nodes, when tree-printing.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: alc
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12635

5 years agoRISC-V: Implement get_cyclecount(9).
Mark Johnston [Tue, 13 Nov 2018 18:20:27 +0000 (18:20 +0000)]
RISC-V: Implement get_cyclecount(9).

Add the missing implementation for get_cyclecount(9) on RISC-V by
reading the cycle CSR.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Reviewed by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17953

5 years agoRISC-V: Add macros for reading performance counter CSRs.
Mark Johnston [Tue, 13 Nov 2018 18:12:06 +0000 (18:12 +0000)]
RISC-V: Add macros for reading performance counter CSRs.

The RISC-V spec defines several performance counter CSRs such as: cycle,
time, instret, hpmcounter(3...31).  They are defined to be 64-bits wide
on all RISC-V architectures.  On RV64 and RV128 they can be read from a
single CSR.  On RV32, additional CSRs (given the suffix "h") are present
which contain the upper 32 bits of these counters, and must be read as
well.  (See section 2.8 in the User ISA Spec for full details.)

This change adds macros for reading these values safely on any RISC-V
ISA length.  Obviously we aren't supporting anything other than RV64
at the moment, but this ensures we won't need to change how we read
these values if we ever do.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Reviewed by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17952

5 years agoRun __cxa_finalize in shared objects in the destructor path.
Andrew Turner [Tue, 13 Nov 2018 15:28:27 +0000 (15:28 +0000)]
Run __cxa_finalize in shared objects in the destructor path.

When we have .dtors call them before .dtor handling, otherwise call from
a destructor.

PR: 233056
MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoFix part of the SYNOPSIS documenting LIST OF RULES AND PREPROCESSING
Eugene Grosbein [Tue, 13 Nov 2018 13:57:15 +0000 (13:57 +0000)]
Fix part of the SYNOPSIS documenting LIST OF RULES AND PREPROCESSING
that is still referred as last section of the SYNOPSIS later
but was erroneously situated in the section IN-KERNEL NAT.

MFC after: 1 month

5 years agopowerpc64: reduce GENERIC64 diff versus amd64 GENERIC
Kevin Bowling [Tue, 13 Nov 2018 09:19:07 +0000 (09:19 +0000)]
powerpc64: reduce GENERIC64 diff versus amd64 GENERIC

Reviewed by: jhibbits
Approved by: timur (mentor)
Differential Revision: https://reviews.freebsd.org/D17515

5 years agoAdd dynamic_kenv assertion to init_static_kenv
Kyle Evans [Tue, 13 Nov 2018 04:34:30 +0000 (04:34 +0000)]
Add dynamic_kenv assertion to init_static_kenv

Both to formally document the requirement that this not be called after the
dynamic kenv is setup, and to perhaps help static analyzers figure out
what's going on. While calling init_static_kenv this late isn't fatal, there
are some caveats that the caller should be aware of:

- Late calls are effectively a no-op, as far as default FreeBSD is
concerned, as everything will switch to searching the dynamic kenv once it's
available.

- Each of the kern_getenv calls will leak memory, as it's assumed that
these are searching static environment and allocations will not be made.

As such, this usage is not sensible and should be detected.

5 years agoRevert r340385, strings capability mode
Ed Maste [Tue, 13 Nov 2018 01:30:31 +0000 (01:30 +0000)]
Revert r340385, strings capability mode

This needs to be reworked for bootstrapping.

5 years agoFix test-dts{,o} targets
Kyle Evans [Mon, 12 Nov 2018 22:18:11 +0000 (22:18 +0000)]
Fix test-dts{,o} targets

There were two main problems here:

1.) sys/dts/Makefile.inc is not included from various */overlays directories
    by default, only ../Makefile.inc
2.) When shelling out for DTS/DTSO, cwd != .CURDIR, so enumeration always
    failed

These changes allow make test-dts and make test-dtso to function in their
respective directories.

Reviewed by: manu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17961

5 years agoAdd evdev support to amd64 and i386 kernels
Niclas Zeising [Mon, 12 Nov 2018 21:01:28 +0000 (21:01 +0000)]
Add evdev support to amd64 and i386 kernels

Include evdev support and drivers in the amd64 and i386 GENERIC and MINIMAL
kernels.  Evdev is used by X and wayland to handle input devices, and this
change, together with upcomming changes in ports will make us handle input
devices better in graphical UIs.

Reviewed by: wulf, bapt, imp
Approved by: imp
Differential Revision: https://reviews.freebsd.org/D17912

5 years agoretire LINKER_FEATURES filter flag
Ed Maste [Mon, 12 Nov 2018 20:44:22 +0000 (20:44 +0000)]
retire LINKER_FEATURES filter flag

And build libdl unconditionally.  All supported FreeBSD linkers accept
-F / --filter so there is no need to test for support.

Discussed with: kib
Sponsored by: The FreeBSD Foundation

5 years agostrings: enter capability mode when operating on stdin
Ed Maste [Mon, 12 Nov 2018 20:38:43 +0000 (20:38 +0000)]
strings: enter capability mode when operating on stdin

Reviewed by: oshogbo
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

5 years agoApply fix to un-cripple max cpu id on BSP earlier.
Konstantin Belousov [Mon, 12 Nov 2018 19:17:26 +0000 (19:17 +0000)]
Apply fix to un-cripple max cpu id on BSP earlier.

We need to know actual value for the standard extended features before
ifuncs are resolved.

Reported and tested by: madpilot
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoCreate namespace for the symbols added during 13-CURRENT cycle.
Konstantin Belousov [Mon, 12 Nov 2018 19:12:14 +0000 (19:12 +0000)]
Create namespace for the symbols added during 13-CURRENT cycle.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agos/caph_enter_capser/caph_enter_casper/g
Mariusz Zaborski [Mon, 12 Nov 2018 18:43:51 +0000 (18:43 +0000)]
s/caph_enter_capser/caph_enter_casper/g

Reported by: npn

5 years agoFix typo in the comparison.
Mariusz Zaborski [Mon, 12 Nov 2018 18:37:31 +0000 (18:37 +0000)]
Fix typo in the comparison.
This fix build with gcc.

Reported by: jenkins

5 years agos/caph_enter_with_casper/caph_enter_casper/
Mariusz Zaborski [Mon, 12 Nov 2018 18:34:55 +0000 (18:34 +0000)]
s/caph_enter_with_casper/caph_enter_casper/

Reported by: npn

5 years agowc: We should sandbox wc only if Capers is available.
Mariusz Zaborski [Mon, 12 Nov 2018 18:01:36 +0000 (18:01 +0000)]
wc: We should sandbox wc only if Capers is available.

5 years agohead: sandbox using capsicum
Mariusz Zaborski [Mon, 12 Nov 2018 17:59:15 +0000 (17:59 +0000)]
head: sandbox using capsicum

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D14409

5 years agocxgbe/netmap: Fix cxgbe netmap when interface is DOWN
Julien Charbon [Mon, 12 Nov 2018 17:57:12 +0000 (17:57 +0000)]
cxgbe/netmap: Fix cxgbe netmap when interface is DOWN

A kernel panic can occur if the cxgbe interface is DOWN
when activating netmap. This patch prevents the driver
from freeing up cxgbe netmap resources when they have not
been allocated.

Submitted by: Nicolas Witkowski <nwitkowski@verisign.com>
Reviewed by: np
MFC after: 1 week
Sponsored by: Verisign, Inc.
Differential Revision: https://reviews.freebsd.org/D17802

5 years agowc: sandbox wc using capsicum
Mariusz Zaborski [Mon, 12 Nov 2018 17:47:51 +0000 (17:47 +0000)]
wc: sandbox wc using capsicum

Reviewed by: AllanJude, emaste
Differential Revision: https://reviews.freebsd.org/D14409

5 years agolibcasper: introduce cap_fileargs service
Mariusz Zaborski [Mon, 12 Nov 2018 17:40:47 +0000 (17:40 +0000)]
libcasper: introduce cap_fileargs service

cap_fileargs is a Casper service which helps to sandbox applications that need
access to the filesystem namespace. The main purpose of the service is to make
easy to capsicumize applications that works on multiple files passed in argv.

We have a couple example of using it but we still treat this service as an
experimental one.

Reviewed by: emsate (previous version), jonathan (partially)
Discussed with: many
Differential Revision: https://reviews.freebsd.org/D14407

5 years agodtb.mk: Fix passing of ECHO to make_dtb{,o}.sh
Kyle Evans [Mon, 12 Nov 2018 17:10:44 +0000 (17:10 +0000)]
dtb.mk: Fix passing of ECHO to make_dtb{,o}.sh

5 years agoUse ...-freebsd13.0 in -target strings.
Brooks Davis [Mon, 12 Nov 2018 16:55:20 +0000 (16:55 +0000)]
Use ...-freebsd13.0 in -target strings.

Reported by: Mark Millard

5 years agohead: fix style nits
Mariusz Zaborski [Mon, 12 Nov 2018 16:44:26 +0000 (16:44 +0000)]
head: fix style nits

No functional change intended.

Reviewed by: emaste
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14498

5 years agoAllow set ether/vlan PCP operation from the VNET jails.
Konstantin Belousov [Mon, 12 Nov 2018 15:59:32 +0000 (15:59 +0000)]
Allow set ether/vlan PCP operation from the VNET jails.

The vlan interfaces can be created from vnet jails, it seems, so it
sounds logical to allow pcp configuration as well.

Reviewed by: bz, hselasky (previous version)
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17777

5 years agolibcasper: ange the name of limits in cap_dns so the intentions are obvious.
Mariusz Zaborski [Mon, 12 Nov 2018 15:52:45 +0000 (15:52 +0000)]
libcasper: ange the name of limits in cap_dns so the intentions are obvious.

Reported by: pjd
MFC after: 3 weeks

5 years agoFix printing of 64-bit counters on 32-bit ppc platforms.
Michael Tuexen [Mon, 12 Nov 2018 13:26:13 +0000 (13:26 +0000)]
Fix printing of 64-bit counters on 32-bit ppc platforms.

Several statistic counters are uint64_t values and are printed by systat
using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
While there, print variables of size_t using %zd.

MFC after:i 3 days
Differential Revision: https://reviews.freebsd.org/D17838

5 years agoAdd ability to use dynamic external prefix in ipfw_nptv6 module.
Andrey V. Elsukov [Mon, 12 Nov 2018 11:20:59 +0000 (11:20 +0000)]
Add ability to use dynamic external prefix in ipfw_nptv6 module.

Now an interface name can be specified for nptv6 instance instead of
ext_prefix. The module will track if_addr_ext events and when suitable
IPv6 address will be added to specified interface, it will be configured
as external prefix. When address disappears instance becomes unusable,
i.e. it doesn't match any packets.

Reviewed by: 0mp (manpages)
Tested by: Dries Michiels <driesm dot michiels gmail com>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17765

5 years agoMake outfile constant.
Xin LI [Mon, 12 Nov 2018 07:14:34 +0000 (07:14 +0000)]
Make outfile constant.

MFC after: 2 weeks

5 years agonetdump: Fix netdumping with INVARIANTS kernels
Conrad Meyer [Mon, 12 Nov 2018 05:24:20 +0000 (05:24 +0000)]
netdump: Fix netdumping with INVARIANTS kernels

Correct boneheaded assertion I added in r339501.  Mea culpa.

The intent is to notice when an M_WAITOK zone allocation would fail during
netdump, not to prevent all use of mbufs during netdump.

Reviewed by: markj
X-MFC-With: r339501
Differential Revision: https://reviews.freebsd.org/D17957

5 years agoUse blank am_pm and t_fmt_ampm for de_AT and de_DE locales as apparently
Yuri Pankov [Sun, 11 Nov 2018 13:41:32 +0000 (13:41 +0000)]
Use blank am_pm and t_fmt_ampm for de_AT and de_DE locales as apparently
they use 24-hour clock notation.  The visible change is that w(1) now
uses 24-hour clock format as it checks for t_fmt_ampm presence.

PR: 231771
Submitted by: Christoph Schönweiler <public2016@hauptsignal.at>
Reviewed by: bapt
Approved by: kib (mentor, implicit)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17945

5 years agoFirst draft of documentation for AT/O_BENEATH handling of the absolute
Konstantin Belousov [Sun, 11 Nov 2018 01:46:48 +0000 (01:46 +0000)]
First draft of documentation for AT/O_BENEATH handling of the absolute
paths.

It was decided that committing the code and drafting of the man page
update is better than allowing the code to rot until wordsmithing
happens.

Reviewed by: jilles (previous version)
Discussed with: brooks, jilles, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17714

5 years agoUpdate nsswitch.conf(5) man page to make it clear additional sources
Edward Tomasz Napierala [Sun, 11 Nov 2018 00:57:13 +0000 (00:57 +0000)]
Update nsswitch.conf(5) man page to make it clear additional sources
might be provided by third party software.

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

5 years agoFix daily mailq script for Postfix and daily_show_success="NO"
Eric van Gyzen [Sun, 11 Nov 2018 00:39:20 +0000 (00:39 +0000)]
Fix daily mailq script for Postfix and daily_show_success="NO"

Exit with a zero status when Postfix reports "Mail queue is empty" so this
section won't appear in the report at all when daily_show_success="NO".

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoRemove one-use variable.
Konstantin Belousov [Sun, 11 Nov 2018 00:21:28 +0000 (00:21 +0000)]
Remove one-use variable.

This also removes a lot of #ifdefs and cleans up a warning when the
AUDIT kernel option is defined, but neither KDTRACE_HOOKS nor MAC are.

Reported and tested by: danger
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoAllow absolute paths for O_BENEATH.
Konstantin Belousov [Sun, 11 Nov 2018 00:04:36 +0000 (00:04 +0000)]
Allow absolute paths for O_BENEATH.

The path must have a tail which does not escape starting/topping
directory.  The documentation will come shortly, see the man pages
commit message for the reason of separate commit.

Reviewed by: jilles (previous version)
Discussed with: emaste
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17714

5 years agoRandom tweaks to ddb(4) manual page.
Edward Tomasz Napierala [Sat, 10 Nov 2018 23:49:01 +0000 (23:49 +0000)]
Random tweaks to ddb(4) manual page.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDon't call stat(2) on nsswitch.conf(5) every time nsdispatch(3)
Edward Tomasz Napierala [Sat, 10 Nov 2018 23:07:46 +0000 (23:07 +0000)]
Don't call stat(2) on nsswitch.conf(5) every time nsdispatch(3)
and dependent functions (eg getpwname(3)) get called. This can
improve performance of binaries that perform a lot of name
lookups, such as gssd(8). It also matches documented behaviour
of Linux and Solaris.

The old code is left in place, should anyone need it, guarded
by #ifdef NS_REREAD_CONF.

Reviewed by: imp, bcr
MFC after: 2 weeks
Relnotes: yes
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17934

5 years agowmt(4): Add PNP record so it could be picked by devd/devmatch.
Vladimir Kondratyev [Sat, 10 Nov 2018 22:14:09 +0000 (22:14 +0000)]
wmt(4): Add PNP record so it could be picked by devd/devmatch.

Fix uhid(4) conflict with blacklisting of multitouch HID-usages
in uhid(4) probe handler.

Reviewed by: imp
No objections from: hps
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17689

5 years agoUpdate our devicetree to 4.19 for arm and arm64
Emmanuel Vadot [Sat, 10 Nov 2018 21:02:32 +0000 (21:02 +0000)]
Update our devicetree to 4.19 for arm and arm64

MFC after: 2 months

5 years agodts: Update our copy to Linux 4.19
Emmanuel Vadot [Sat, 10 Nov 2018 20:44:37 +0000 (20:44 +0000)]
dts: Update our copy to Linux 4.19

5 years agolibbe(3): Set canmount properly when activating a new BE
Kyle Evans [Sat, 10 Nov 2018 20:42:29 +0000 (20:42 +0000)]
libbe(3): Set canmount properly when activating a new BE

The previously activated BE should have canmount=noauto set on it upon
activation of the new BE, but we previously did not touch canmount on either
old or new BE.

PR: 233113
MFC after: 3 days

5 years agoRe-apply r336984, reverting r339934.
Mark Johnston [Sat, 10 Nov 2018 20:33:08 +0000 (20:33 +0000)]
Re-apply r336984, reverting r339934.

r336984 exposed the bug fixed in r340241, leading to the initial revert
while the bug was being hunted down.  Now that the bug is fixed, we
can revert the revert.

Discussed with: alc
MFC after: 3 days

5 years agorm(1): Formalize non-functional status of -P flag
Conrad Meyer [Sat, 10 Nov 2018 20:26:55 +0000 (20:26 +0000)]
rm(1): Formalize non-functional status of -P flag

-P was introduced in 4.4BSD-Lite2 around 1994.  It overwrote file contents
with a pass of 0xff, 0x00, then 0xff, in a low effort attempt to "really
delete" files.

It has no user-visible effect; at the end of the day, the file is unlinked via
the filesystem.  Furthermore, the utility of overwriting files with patterned
data is extremely limited due to caveats at every layer of the stack[0] and
therefore mostly futile.  At the least, three passes is likely wasteful on
modern hardware[1].  It could also be seen as a violation of the "Unix
Philosophy" to do one thing per tiny, composable program.

Since 1994, FreeBSD has left it alone; OpenBSD replaced it with a single
pass of arc4random(3) output in 2012[2]; and NetBSD implemented partial, but
explicitly incomplete support for U.S. DoD 5220.22-M, "National Industrial
Security Program Operating Manual" in 2004[3].

NetBSD's enhanced comment above rm_overwrite makes a strong case for removing
the flag entirely:

> This is an expensive way to keep people from recovering files from your
> non-snapshotted FFS filesystems using fsdb(8).  Really.  No more.
>
> It is impossible to actually conform to the exact procedure given in
> [NISPOM] if one is overwriting a file, not an entire disk, because the
> procedure requires examination and comparison of the disk's defect lists.
> Any program that claims to securely erase *files* while conforming to the
> standard, then, is not correct.
>
> Furthermore, the presence of track caches, disk and controller write
> caches, and so forth make it extremely difficult to ensure that data have
> actually been written to the disk, particularly when one tries to repeatedly
> overwrite the same sectors in quick succession.  We call fsync(), but
> controllers with nonvolatile cache, as well as IDE disks that just plain lie
> about the stable storage of data, will defeat this.
>
> [NISPOM] requires physical media destruction, rather than any technique of
> the sort attempted here, for secret data.

As a first step towards evental removal, make it a placebo.  It's not like
it was serving any security function.  It is not defined in or mentioned by
POSIX.

If you are security conscious and need to erase your files, use a
woodchipper.  At a minimum, the entire disk needs to be overwritten, not
just one file.

[0]: https://www.ru.nl/publish/pages/909282/draft-paper.pdf
[1]: https://commons.erau.edu/cgi/viewcontent.cgi?article=1131&context=jdfsl
[2]: https://github.com/openbsd/src/commit/7c5c57ba81b5fe8ff2d4899ff643af18c
[3]: https://github.com/NetBSD/src/commit/fdf0a7a25e59af958fca1e2159921562cd

Reviewed by: markj, Daniel O'Connor <darius AT dons.net.au> (previous version)
Differential Revision: https://reviews.freebsd.org/D17906

5 years agobuild(7): clarify buildenv target can be used for non-cross builds
Ed Maste [Sat, 10 Nov 2018 20:26:19 +0000 (20:26 +0000)]
build(7): clarify buildenv target can be used for non-cross builds

make buildenv can be used for building for the same architecture as
the host (perhaps this is a degenerate case of cross-building).
TARGET and TARGET_ARCH do not need to be set in this case.

Reviewed by: bdrewery
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10759

5 years agoUpdate comment about 'universe' disk usage
Eric van Gyzen [Sat, 10 Nov 2018 19:09:48 +0000 (19:09 +0000)]
Update comment about 'universe' disk usage

It's 167 GB now (or 81 GB with ZFS lz4).

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoweekly/340.noid: suppress warning on non-existent jail.conf
Eugene Grosbein [Sat, 10 Nov 2018 17:49:19 +0000 (17:49 +0000)]
weekly/340.noid: suppress warning on non-existent jail.conf

MFC after: 1 month

5 years agoAdd UPDATING entry for newsyslog.conf changes introduced by r340318
Ben Woods [Sat, 10 Nov 2018 16:58:07 +0000 (16:58 +0000)]
Add UPDATING entry for newsyslog.conf changes introduced by r340318

Approved by: cem
Differential Revision: https://reviews.freebsd.org/D17936

5 years agonetmap: pkt-gen: several updates from upstream
Vincenzo Maffione [Sat, 10 Nov 2018 15:10:22 +0000 (15:10 +0000)]
netmap: pkt-gen: several updates from upstream

Various improvements to the netmap pkt-gen program:

 - indentation fixes
 - support for IPV6
 - fixes to checksum computation
 - support for NS_MOREFRAG
 - rate limiting in ping mode

Reviewed by: bcr, 0mp
Approved by: gnn (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17698

5 years agoSigh... Fix another breakage after r340322: spell "sysrc" correctly.
Eugene Grosbein [Sat, 10 Nov 2018 14:35:12 +0000 (14:35 +0000)]
Sigh... Fix another breakage after r340322: spell "sysrc" correctly.

MFC after: 1 month

5 years agoFix breakage after r340322: add missing "-n" to invocation of sysrc.
Eugene Grosbein [Sat, 10 Nov 2018 14:25:37 +0000 (14:25 +0000)]
Fix breakage after r340322: add missing "-n" to invocation of sysrc.

MFH: 1 month

5 years agoPrevent periodic/etc/weekly/340.noid from descending into root directories
Eugene Grosbein [Sat, 10 Nov 2018 14:21:26 +0000 (14:21 +0000)]
Prevent periodic/etc/weekly/340.noid from descending into root directories
of jails. Jails have their own user/group databases and this script
can produce multiple false warnings, not to mention significant extra
load in case of large jailed subtrees. Leave this check for jailed
invocations of the same script.

MFC after: 1 month

5 years agoMove definition of $jail_conf variable to /etc/defaults/rc.conf
Eugene Grosbein [Sat, 10 Nov 2018 14:11:54 +0000 (14:11 +0000)]
Move definition of $jail_conf variable to /etc/defaults/rc.conf
from jail startup script so it can be successfully queried
with the command "sysrc jail_conf".

MFC after: 1 month

5 years agojail(8): introduce new command option -e to exhibit
Eugene Grosbein [Sat, 10 Nov 2018 12:03:57 +0000 (12:03 +0000)]
jail(8): introduce new command option -e to exhibit
a list of configured non-wildcard jails with their parameters,
no matter running or not.

The option -e takes separator argument that is used
to separate printed parameters. It will be used with following
additions to system periodic scripts to differentiate parts
of directory tree belonging jails as opposed to host's.

MFC after: 1 month