]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r338947:
ae [Wed, 3 Oct 2018 12:47:54 +0000 (12:47 +0000)]
MFC r338947:
  Add "src-ip" or "dst-ip" keyword to the output, when we are printing the
  rest of rule options.

  Reported by: lev

5 years agoMFC r338955:
kib [Wed, 3 Oct 2018 11:34:28 +0000 (11:34 +0000)]
MFC r338955:
When doing lm_add(), check for duplicates.

5 years agoMFC r337169: MFV r337167: 9442 decrease indirect block size of spacemaps
mav [Wed, 3 Oct 2018 03:14:40 +0000 (03:14 +0000)]
MFC r337169: MFV r337167: 9442 decrease indirect block size of spacemaps

Updates to indirect blocks of spacemaps can contribute significantly to
write inflation.  Therefore we want to reduce the indirect block size of
spacemaps from 128K to 16K.

illumos/illumos-gate@221813c13b43ef48330b03725e00edee85108cf1

Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Albert Lee <trisk@forkgnu.org>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Author:     Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r337163: MFV r337161: 9512 zfs remap poolname@snapname coredumps
mav [Wed, 3 Oct 2018 03:13:53 +0000 (03:13 +0000)]
MFC r337163: MFV r337161: 9512 zfs remap poolname@snapname coredumps

Only filesystems and volumes are valid "zfs remap" parameters: when passed
a snapshot name zfs_remap_indirects() does not handle the EINVAL returned
from libzfs_core, which results in failing an assertion and consequently
crashing.

illumos/illumos-gate@0b2e8253986c5c761129b58cfdac46d204903de1

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Wren Kennedy <john.kennedy@delphix.com>
Reviewed by: Sara Hartse <sara.hartse@delphix.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author:     loli10K <ezomori.nozomu@gmail.com>

5 years agoMFC r337160:
mav [Wed, 3 Oct 2018 02:52:47 +0000 (02:52 +0000)]
MFC r337160:
Do not blindly include illumos kernel headers instead of user-space.
It is not needed now, and I doubt it much helped at all, creating more
confusions then good.

5 years agoMFC r337063: MFV r316926:
mav [Wed, 3 Oct 2018 02:51:13 +0000 (02:51 +0000)]
MFC r337063: MFV r316926:
7955 libshare needs to initialize only those datasets being modified by the consumer

illumos/illumos-gate@8a981c3356b194b3b5c0ae9276a9cc31cd2f93a3
https://github.com/illumos/illumos-gate/commit/8a981c3356b194b3b5c0ae9276a9cc31cd2f93a3

https://www.illumos.org/issues/7955
  Libshare currently initializes all available filesystems when doing any
  libshare operation. This requires iterating through all the filesystem
  multiple times, which is a huge performance problem for sharing and
  unsharing operations.

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Daniel Hoffman <dj.hoffman@delphix.com>

For FreeBSD this is practically a NOP, just a diff reduction.

5 years agoMFC r337030: MFV r337029:
mav [Wed, 3 Oct 2018 02:50:07 +0000 (02:50 +0000)]
MFC r337030: MFV r337029:
9426 metaslab size can exceed offset addressable by spacemap

metaslab size can exceed offset addressable by spacemap. The vdev can
address up to 2^63 * SPA_MAXBLOCKSIZE (512). A metaslab can address up to
2^47 * 2^vdev_ashift. Therefore we may need to increase the number of
metaslabs so that the maximum metaslab size is capped at the amount that
can be addressed by the spacemap. This should happen in
vdev_metaslab_set_size().

illumos/illumos-gate@b4bf0cf0458759c67920a031021a9d96cd683cfe

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <matt@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author:     Don Brady <don.brady@delphix.com>

5 years agoMFC r337028: MFV r337027:
mav [Wed, 3 Oct 2018 02:49:24 +0000 (02:49 +0000)]
MFC r337028: MFV r337027:
9328 zap code can take advantage of c99
9329 panic in zap_leaf_lookup() due to concurrent zapification

illumos/illumos-gate@bf26014c5541b6119f34e0d95294b7f2eb105ac2

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author:     Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r337025: MFV r337022:
mav [Wed, 3 Oct 2018 02:48:31 +0000 (02:48 +0000)]
MFC r337025: MFV r337022:
9403 assertion failed in arc_buf_destroy() when concurrently reading block with checksum error

This assertion (VERIFY) failure was reported when reading a block. Turns out
the problem is that if we get an i/o error (ECKSUM in this case), and there
are multiple concurrent ARC reads of the same block (from different clones),
then the ARC will put multiple buf's on the same ANON hdr, which isn't
supposed to happen, and then causes a panic when we try to arc_buf_destroy()
the buf.

illumos/illumos-gate@fa98e487a9619b7902f218663be219e787a57dad

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author:     Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r337021: MFV r337020:9443 panic when scrub a v10 pool
mav [Wed, 3 Oct 2018 02:19:17 +0000 (02:19 +0000)]
MFC r337021: MFV r337020:9443 panic when scrub a v10 pool

illumos/illumos-gate@bb1f424574ac8e08069d0ba993c2a41ffe796794

Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Author:     Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r337017: MFV r337014:
mav [Wed, 3 Oct 2018 02:18:16 +0000 (02:18 +0000)]
MFC r337017: MFV r337014:
9421 zdb should detect and print out the number of "leaked" objects
9422 zfs diff and zdb should explicitly mark objects that are on the deleted queue

illumos/illumos-gate@20b5dafb425396adaebd0267d29e1026fc4dc413

Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author:     Paul Dagnelie <pcd@delphix.com>

5 years agoMFC r337007: MFV r336991, r337001:
mav [Wed, 3 Oct 2018 02:16:22 +0000 (02:16 +0000)]
MFC r337007: MFV r336991, r337001:
9102 zfs should be able to initialize storage devices

The first access to a disk block can incur a performance penalty on some
platforms (e.g. AWS's EBS, VMware VMDKs). Therefore it is recommended that
volumes be "thick provisioned", where supported by the platform (VMware).
Thick provisioning is time consuming and often is ignored. If the thick
provision step is omitted, customers will see suboptimal performance until
we have written to all parts of the LUN. ZFS should be able to initialize
any unused storage to remove any first-write penalty that exists.

illumos/illumos-gate@094e47e980b0796b94b1b8f51f462a64d246e516

Reviewed by: John Wren Kennedy <john.kennedy@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author:     George Wilson <george.wilson@delphix.com>

5 years agoMFC r336961:
mav [Wed, 3 Oct 2018 02:14:38 +0000 (02:14 +0000)]
MFC r336961:
MFV r336960: 9256 zfs send space estimation off by > 10% on some datasets

illumos/illummos-gate@df477c0afa111b5205c872dab36dbfde391656de

Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author:     Paul Dagnelie <pcd@delphix.com>

5 years agoMFC r336959: MFV r336958: 9337 zfs get all is slow due to uncached metadata
mav [Wed, 3 Oct 2018 02:13:42 +0000 (02:13 +0000)]
MFC r336959: MFV r336958: 9337 zfs get all is slow due to uncached metadata

This project's goal is to make read-heavy channel programs and zfs(1m)
administrative commands faster by caching all the metadata that they will
need in the dbuf layer. This will prevent the data from being evicted, so
that any future call to i.e. zfs get all won't have to go to disk (very
much).

illumos/illumos-gate@adb52d9262f45a04318fc6e188fe2b7f59d989a5

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Thomas Caputi <tcaputi@datto.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author:     Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r336956: MFV r336955: 9236 nuke spa_dbgmsg
mav [Wed, 3 Oct 2018 02:13:04 +0000 (02:13 +0000)]
MFC r336956: MFV r336955: 9236 nuke spa_dbgmsg

We should use zfs_dbgmsg instead of spa_dbgmsg.  Or at least,
metaslab_condense() should call zfs_dbgmsg because it's important and rare
enough to always log. It's possible that the message in zio_dva_allocate()
would be too high-frequency for zfs_dbgmsg.

illumos/illumos-gate@21f7c81cc1156e9202ce3412d3ecaa697c3b2222

Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r336954:
mav [Wed, 3 Oct 2018 02:12:24 +0000 (02:12 +0000)]
MFC r336954:
MFV r336952: 9192 explicitly pass good_writes to vdev_uberblock/label_sync

Currently vdev_label_sync and vdev_uberblock_sync take a zio_t and assume
that its io_private is a pointer to the good_writes count. They should
instead accept this argument explicitly.

illumos/illumos-gate@a3b5583021b7b45676bf1f0cc68adf7a97900b56

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r336951: MFV r336950: 9290 device removal reduces redundancy of mirrors
mav [Wed, 3 Oct 2018 02:11:05 +0000 (02:11 +0000)]
MFC r336951: MFV r336950: 9290 device removal reduces redundancy of mirrors

Mirrors are supposed to provide redundancy in the face of whole-disk failure
and silent damage (e.g. some data on disk is not right, but ZFS hasn't
detected the whole device as being broken). However, the current device
removal implementation bypasses some of the mirror's redundancy.

illumos/illumos-gate@3a4b1be953ee5601bab748afa07c26ed4996cde6

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prashanth Sreenivasa <pks@delphix.com>
Reviewed by: Sara Hartse <sara.hartse@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Tim Chase <tim@chase2k.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

5 years agoMFC r336949:
mav [Wed, 3 Oct 2018 02:10:23 +0000 (02:10 +0000)]
MFC r336949:
MFV r336948: 9112 Improve allocation performance on high-end systems

On high-end systems running async sequential write workloads, especially
NUMA systems with flash or NVMe storage, one significant performance
bottleneck is selecting a metaslab to do allocations from. This process
can be parallelized, providing significant performance increases for
these workloads.

illumos/illumos-gate@f78cdc34af236a6199dd9e21376f4a46348c0d56

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Alexander Motin <mav@FreeBSD.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Paul Dagnelie <pcd@delphix.com>

5 years agoMFC r336947: MFV r336946: 9238 ZFS Spacemap Encoding V2
mav [Wed, 3 Oct 2018 02:09:36 +0000 (02:09 +0000)]
MFC r336947: MFV r336946: 9238 ZFS Spacemap Encoding V2

The current space map encoding has the following disadvantages:
[1] Assuming 512 sector size each entry can represent at most 16MB for a segment.
This makes the encoding very inefficient for large regions of space.
[2] As vdev-wide space maps have started to be used by new features (i.e.
device removal, zpool checkpoint) we've started imposing limits in the
vdevs that can be used with them based on the maximum addressable offset
(currently 64PB for a top-level vdev).

The new remains backwards compatible with the old one. The introduced
two-word entry format, besides extending the limits imposed by the single-entry
layout, also includes a vdev field and some extra padding after its prefix.

The extra padding after the prefix should is reserved for future usage (e.g.
new prefixes for future encodings or new fields for flags). The new vdev field
not only makes the space maps more self-descriptive, but also opens the doors
for pool-wide space maps.

One final important note is that the number of bits used for vdevs is reduced
to 24 bits for blkptrs. That was decided as we don't know of any setups that
use more than 16M vdevs for the time being and
we wanted to fit the vdev field in the space map. In addition that gives us
some extra bits in dva_t.

illumos/illumos-gate@17f11284b49b98353b5119463254074fd9bc0a28

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@zfsmail.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>

5 years agoMFC r336945: MFV r336944: 9286 want refreservation=auto
mav [Wed, 3 Oct 2018 02:08:32 +0000 (02:08 +0000)]
MFC r336945: MFV r336944: 9286 want refreservation=auto

When a ZFS volume is created with zfs create -V (but without -s), the
refreservation property is set to a value that is volsize plus the maximum
size of metadata. If refreservation is ever set to another value, it is
impossible to set it back to the automatically determined value. There are
other cases where refreservation may be wrong. These include receiving a
volume that was sent without properties and zfs clone.

We need:

zfs set refreservation=auto <volume>
zfs clone -o refreservation=auto <volume>

Each one would use the same function used by zfs create -V to determine the
proper value for refreservation.

illumos/illumos-gate@1c10ae76c0cb31326c320e7cef1d3f24a1f47125

Reviewed by: Allan Jude <allanjude@freebsd.org>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Mike Gerdts <mike.gerdts@joyent.com>

5 years agoMFC r336943:
mav [Wed, 3 Oct 2018 02:07:24 +0000 (02:07 +0000)]
MFC r336943:
MFV r336942: 9189 Add debug to vdev_label_read_config when txg check fails

illumos/illumos-gate@b6bf6e1540f30bd97b8d6e2c21d95e17841e0f23

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prashanth Sreenivasa <pks@delphix.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

5 years agoMFC r338682: lld: add -z interpose support
emaste [Tue, 2 Oct 2018 22:51:24 +0000 (22:51 +0000)]
MFC r338682: lld: add -z interpose support

-z interpose sets the DF_1_INTERPOSE flag, marking the object as an
interposer.

PR: 230604
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

5 years agoMFC r338251:
markj [Tue, 2 Oct 2018 21:20:45 +0000 (21:20 +0000)]
MFC r338251:
Add an lld option to emit PC-relative relocations for ifunc calls.

5 years agoMFC r328810 (by emaste):
markj [Tue, 2 Oct 2018 21:19:42 +0000 (21:19 +0000)]
MFC r328810 (by emaste):
ld.lld.1: miscellaneous style improvements

MFC r329002 (by emaste):
Update ld.lld.1 based on the version committed upstream

MFC r329003 (by emaste):
ld.lld.1: explain long options may use one or two dashes

5 years agoMFC r336875:
asomers [Tue, 2 Oct 2018 18:12:32 +0000 (18:12 +0000)]
MFC r336875:

audit(4): add tests for sysctl(3) and sysarch(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16116

5 years agoMFC r336728:
asomers [Tue, 2 Oct 2018 17:57:16 +0000 (17:57 +0000)]
MFC r336728:

Introduce test program for auditpipe(4)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16395

5 years agoMFC r336613:
asomers [Tue, 2 Oct 2018 17:42:50 +0000 (17:42 +0000)]
MFC r336613:

auditd(8): Log a better error when no hostname is set in audit_control

Cherry-pick from https://github.com/openbsm/openbsm/commit/01ba03b

Reviewed by: cem
Obtained from: OpenBSM
Pull Request: https://github.com/openbsm/openbsm/pull/38

5 years agoMFC r335792, r336564, r336579
asomers [Tue, 2 Oct 2018 17:38:58 +0000 (17:38 +0000)]
MFC r335792, r336564, r336579

r335792:
audit(4): add tests for several more administrative syscalls

Includes ntp_adjtime, auditctl, acct, auditon, and clock_settime.  Includes
quotactl, mount, nmount, swapon, and swapoff in failure mode only.  Success
tests for those syscalls will follow.  Also includes reboot(2) in failure
mode only.  That one can't be tested in success mode.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15898

r336564:
Separate the audit(4) tests for auditon(2)'s individual commands

auditon(2) is an ioctl-like syscall with several different variants, each of
which has a distinct audit event.  Write separate audit(4) tests for each
variant.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16255

r336579:
audit(4): add more test cases for auditon(2)

auditon(2) is an ioctl-like syscall with several different variants, each of
which has a distinct audit event.  This commit tests the remaining variants
that weren't tested in r336564.

Submitted by: aniketp
X-MFC-With: 336564
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16381

5 years agoMFC r335319, r335354, r335374
asomers [Tue, 2 Oct 2018 17:27:10 +0000 (17:27 +0000)]
MFC r335319, r335354, r335374

r335319:
audit(4): add tests for send, recv, sendto, and recvfrom

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15869

r335354:
audit(4): add tests for ioctl(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15872

r335374:
audit(4): add tests for utimes(2) and friends, mprotect, and undelete

Includes utimes(2), futimes(2), lutimes(2), futimesat(2), mprotect(2), and
undelete(2).  undelete, for now, is tested only in failure mode.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15893

5 years agoMFC r335261, r335275, r335284-r335285, r335294, r335318, r335320, r335703
asomers [Tue, 2 Oct 2018 17:07:10 +0000 (17:07 +0000)]
MFC r335261, r335275, r335284-r335285, r335294, r335318, r335320, r335703

r335261:
audit(4): add tests for pathconf(2) and friends

pathconf, lpathconf, and fpathconf are included

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15842

r335275:
audit(4): add tests for chflags and friends

chflags, fchflags, and lchflags (but not chflagsat) are included.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15854

r335284:
audit(4): add tests for extattr_get_file(2) and friends

This commit includes extattr_{get_file, get_fd, get_link, list_file,
list_fd, list_link}.  It does not include any syscalls that modify, set, or
delete extended attributes, as those are in a different audit class.

Submitted by: aniketpt
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15859

r335285:
audit(4): Add tests for a few syscalls in the ad class

The ad audit class is for administrative commands.  This commit adds test
for settimeofday, adjtime, and getfh.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15861

r335294:
audit(4): add tests for connect, connectat, and accept

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15853

r335318:
audit(4): add tests for extattr_set_file and friends

Includes extattr_{set_file, _set_fd, _set_link, _delete_file, _delete_fd,
_delete_link}

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15867

r335320:
audit(4): Add tests for {get/set}auid, {get/set}audit, {get/set}audit_addr

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15871

r335703:
audit(4): fix Coverity issues

Fix several incorrect buffer size arguments and a file descriptor leak.

Submitted by: aniketp
Reported by: Coverity
CID: 1393489 1393501 1393509 1393510 1393514 1393515 1393516
CID: 1393517 1393518 1393519
X-MFC-With: 335284
X-MFC-With: 335318
X-MFC-With: 335320
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16000

5 years agoMFC many audit(4) tests.
asomers [Tue, 2 Oct 2018 16:23:33 +0000 (16:23 +0000)]
MFC many audit(4) tests.

MFC r334471, r334487, r334496, r334592, r334668, r334933, r335067, r335105,
r335136, r335140, r335145, r335207-r335208, r335215, and r335255-r335256.

r334471:
audit(4): Add tests for the fr class of syscalls

readlink and readlinkat are the only syscalls in this class.  open and
openat are as well, but they'll be handled in a different file.  Also, tidy
up the copyright headers of recently added files in this area.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15636

r334487:
audit(4): Add tests for the fw class of syscalls.

truncate and ftruncate are the only syscalls in this class, apart from
certain variations of open and openat, which will be handled in a different
file.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15640

r334496:
audit(4): add tests for the fd audit class

The only syscalls in this class are rmdir, unlink, unlinkat, rename, and
renameat.  Also, set is_exclusive for all audit(4) tests, because they can
start and stop auditd.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15647

r334592:
audit(4): add tests for the cl audit class

The only syscalls in this class are close, closefrom, munmap, and revoke.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15650

r334668:
audit(4): add tests for open(2) and openat(2)

These syscalls are atypical, because each one corresponds to several
different audit events, and they each pass several different audit class
filters.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15657

r334933:
audit(4): add tests for stat(2) and friends

This revision adds auditability tests for stat, lstat, fstat, and fstatat,
all from the fa audit class.  More tests from that audit class will follow.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15709

r335067:
audit(4): Fix file descriptor leaks in ATF tests

Submitted by: aniketp
Reported by: Coverity
CID: 1393343 1393346 1392695 1392781 1391709 1392078 1392413
CID: 1392014 1392521 1393344 1393345 1393347 1393348 1393349
CID: 1393354 1393355 1393356 1393357 1393358 1393360 1393362
CID: 1393368 1393369 1393370 1393371 1393372 1393373 1393376
CID: 1393380 1393384 1393387 1393388 1393389
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15782

r335105:
audit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)

Submitted by: aniketp
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15750

r335136:
audit(4): add tests for flock, fcntl, and fsync

Submitted by: aniketp
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15795

r335140:
audit(4): fix typo from r335136

Typo in Makefile accidentally disabled some older tests

X-MFC-With: 335136

r335145:
audit(4): add tests for fhopen, fhstat, and fhstatfs

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15798

r335207:
audit(4): add tests for access(2), chmod(2), and friends

access(2), eaccess(2), faccessat(2), chmod(2), fchmod(2), lchmod(2), and
fchmodat(2).

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15805
Differential Revision: https://reviews.freebsd.org/D15808

r335208:
audit(4): improve formatting in tests/sys/audit/open.c

[skip ci]

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15797

r335215:
audit(4): Add a few tests for network-related syscalls

Add tests for socket(2), socketpair(2), and setsockopt(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15803

r335255:
audit(4): add tests for bind(2), bindat(2), and listen(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15843

r335256:
audit(4): add tests for chown(2) and friends

Includes chown, fchown, lchown, and fchownat

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15825

5 years agoMFC r334360, r334362, r334388, r334395
asomers [Tue, 2 Oct 2018 15:18:48 +0000 (15:18 +0000)]
MFC r334360, r334362, r334388, r334395

r334360:
Add initial set of tests for audit(4)

This change includes the framework for testing the auditability of various
syscalls, and includes changes for the first 12.  The tests will start
auditd(8) if needed, though they'll be much faster if it's already running.
The syscalls tested in this commit include mkdir(2), mkdirat(2), mknod(2),
mknodat(2), mkfifo(2), mkfifoat(2), link(2), linkat(2), symlink(2),
symlinkat(2), rename(2), and renameat(2).

Submitted by: aniketp
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15286

r334362 by emaste:
Temporarily disconnect audit tests

Audit tests added in r334360 broke the build on a number of archs.
Remove the subdir from the top level tests/sys/Makefile until they're
fixed.

r334388:
Fix OpenBSM with GCC with -Wredundant-decls

Upstream change ed47534 consciously added some redundant functional
declarations, and I'm not sure why. AFAICT they were never required. On
FreeBSD, they break the build with GCC (but not Clang) for any program
including libbsm.h with WARNS=6.

Fix by cherry-picking upstream change
https://github.com/openbsm/openbsm/commit/0553c27

Reported by: emaste
Reviewed by: cem
Obtained from: OpenBSM
Pull Request: https://github.com/openbsm/openbsm/pull/31

r334395:
Revert r334362

Reconnect tests/sys/audit now that the GCC issue is fixed by 334388

X-MFC-With: 334362, 334360, 334388

5 years agoMFC r338932:
kib [Tue, 2 Oct 2018 09:51:25 +0000 (09:51 +0000)]
MFC r338932:
Fix some uses of dmaplimit.

5 years agoDocument EN-18:09 through EN-18:12.
gjb [Mon, 1 Oct 2018 18:15:25 +0000 (18:15 +0000)]
Document EN-18:09 through EN-18:12.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r337222:
asomers [Mon, 1 Oct 2018 17:36:58 +0000 (17:36 +0000)]
MFC r337222:

Fix LOCAL_PEERCRED with socketpair(2)

Enable the LOCAL_PEERCRED socket option for unix domain stream sockets
created with socketpair(2). Previously, it only worked with unix domain
stream sockets created with socket(2)/listen(2)/connect(2)/accept(2).

PR: 176419
Reported by: Nicholas Wilson <nicholas@nicholaswilson.me.uk>
Differential Revision: https://reviews.freebsd.org/D16350

5 years agoMFC r309554 and r309631 which breaks down overly long monolithic
sobomax [Mon, 1 Oct 2018 17:26:41 +0000 (17:26 +0000)]
MFC r309554 and r309631 which breaks down overly long monolithic
souce file and reduces duplication by auto-generating functions
that only differ in the value of the SCM_XXX constant used.

This also fixes unintentional breakage introduced in earlier
MFC in r338617 that happens to rely on some of those changes.

Reported by: asomers
Pointy-hat goes to: sobomax

5 years agoMFC r338216:
asomers [Mon, 1 Oct 2018 16:04:07 +0000 (16:04 +0000)]
MFC r338216:

tftpd: Fix data corruption bug with netascii

Transferring files in netascii format requires, among other things,
translating all CR characters to a CR,NUL pair. tftpd does this correctly
except when the CR occurs as the last octet of a packet. In that case, it
erroneously drops the NUL which should be part of the following packet. The
bug was caused by using 0 as a sentinel value in a variable that could
legitimately hold 0. Fix it by switching the sentinel value to -1.

PR: 178055
Reported by: Richard <rsitze@gmail.com>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D16853

5 years agoMFC r337973:
asomers [Mon, 1 Oct 2018 16:01:21 +0000 (16:01 +0000)]
MFC r337973:

Add Modbus Application Protocol to /etc/services

IANA reassigned ports 502 and 802 on 2014-06-10

PR: 213276
Submitted by: Mark.Martinec@ijs.si

5 years agoMFC r337911:
asomers [Mon, 1 Oct 2018 15:59:06 +0000 (15:59 +0000)]
MFC r337911:

Fix the sys/opencrypto/runtests test when aesni(4) is already loaded

Apparently kldstat requires the full module name, including busname

Reported by: Jenkins

5 years agoMFC r337779:
asomers [Mon, 1 Oct 2018 15:57:49 +0000 (15:57 +0000)]
MFC r337779:

tftp: Close a resource leak when putting files

Reported by: Coverity
CID: 1394842

5 years agoMFC r337482:
asomers [Mon, 1 Oct 2018 15:56:42 +0000 (15:56 +0000)]
MFC r337482:

Bring VOP_LOOKUP(9) up to date

* Remove the cn_hash field (removed by r51906)
* Add the cn_lkflags field (added by r144285)
* Remove duplicate definition of cnp.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16629

5 years agoMFC r336871, r336874
asomers [Mon, 1 Oct 2018 15:49:43 +0000 (15:49 +0000)]
MFC r336871, r336874

r336871:
getrusage(2): fix return value under 32-bit emulation

According to the man page, getrusage(2) should return EFAULT if the rusage
argument lies outside of the process's address space. But due to an
oversight in r100384, that's never been the case during 32-bit emulation.
Fix it.

PR: 230153
Reported by: tests(7)
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D16500

r336874:
freebsd32_getrusage(2): skip freebsd32_rusage_out on error

PR: 230153
Reported by: kib
X-MFC-With: 336871
Differential Revision: https://reviews.freebsd.org/D16500

5 years agoMFC r336605:
asomers [Mon, 1 Oct 2018 15:47:34 +0000 (15:47 +0000)]
MFC r336605:

Fix multiple Coverity warnings in tftpd(8)

* Initialize uninitialized variable (CID 1006502)
* strcpy => strlcpy (CID 100679210067911006790)
* Check function return values (CID 100944210094411009440)
* Delete dead code in receive_packet (not reported by Coverity)
* Remove redundant alarm(3) in receive_packet (not reported by Coverity)

Reported by: Coverity
CID: 1006502100679210067911006790100944210094411009440
Differential Revision: https://reviews.freebsd.org/D11287

5 years agoMFC r336594:
asomers [Mon, 1 Oct 2018 15:45:20 +0000 (15:45 +0000)]
MFC r336594:

Fix tmpfs detection in the sys/fs/tmpfs tests

This code was originally written for NetBSD.  r306031 tried to adapt it to
FreeBSD, but didn't correctly handle the case that tmpfs was available, but
not already loaded.  Fix the logic to load the module if necessary.  The
tmpfs tests shouldn't be skipped anymore.

Also, fix a comment that was dislocated by r306031.

Reported by: Jenkins

5 years agoMFC r336587:
asomers [Mon, 1 Oct 2018 15:43:56 +0000 (15:43 +0000)]
MFC r336587:

tftpd(8): when completing an WRQ, flush the file before acknowleding receipt

tftpd(8) should flush a newly written file to disk before ACKing the final DATA
packet.  Otherwise there is a narrow race window when a subsequent read may not
see the file.  This is somewhat related to r330710, but the race window is much
smaller.  Hopefully this will fix the intermittent tests in Jenkins.

Reported by: Jenkins

5 years agoMFC r336582:
asomers [Mon, 1 Oct 2018 15:40:06 +0000 (15:40 +0000)]
MFC r336582:

makefs(8): add test case for PR 229929

Fix two failing makefs test cases by adding "-M 1m", which was already used
for every other FFS test case.  Add a new test case for the underlying
issue: with no -M, -m, or -s options, makefs can underestimate image size.

PR: 229929
Reported by: Jenkins

5 years agoMFC r315411 (mmel):
oshogbo [Mon, 1 Oct 2018 14:39:59 +0000 (14:39 +0000)]
MFC r315411 (mmel):
  Unbreak traceroute on system built without CAPSICUM

5 years agoMFC r313168 (by pkelsey):
ae [Mon, 1 Oct 2018 09:40:41 +0000 (09:40 +0000)]
MFC r313168 (by pkelsey):
  Fix VIMAGE-related bugs in TFO.  The autokey callout vnet context was
  not being initialized, and the per-vnet fastopen context was only
  being initialized for the default vnet.

  PR: 216613

5 years agoMFC r338890:
ae [Mon, 1 Oct 2018 08:49:47 +0000 (08:49 +0000)]
MFC r338890:
  Update ifr_name before invoking IPSECSREQID ioctl, this fixes the case,
  when `ifconfig ipsec create reqid N` command invoked without interface
  unit number. The "name" global variable is updated after interface
  cloning in the ifclonecreate() and contains actual interface name.

  Reported by: lev

5 years agoMFC r336165:
smh [Mon, 1 Oct 2018 07:49:16 +0000 (07:49 +0000)]
MFC r336165:

Removed pointless NULL check in rip_pcblist.

Sponsored by: Multiplay

5 years agoMFC r334844, r336180, r336458
sef [Mon, 1 Oct 2018 04:08:47 +0000 (04:08 +0000)]
MFC r334844, r336180, r336458

r334844

This originated from ZFS On Linux, as
https://github.com/zfsonlinux/zfs/commit/d4a72f23863382bdf6d0ae33196f5b5decbc48fd

During scans (scrubs or resilvers), it sorts the blocks in each transaction
group by block offset; the result can be a significant improvement. (On my
test system just now, which I put some effort to introduce fragmentation into
the pool since I set it up yesterday, a scrub went from 1h2m to 33.5m with the
changes.) I've seen similar rations on production systems.

r336180

Fix up some missed and mis-merges from the sequential scan code
(r334844). Most of the changes involve moving some code around to
reduce conflicts with future merges.  One of the missing changes
included a notification on scrub cancellation.

r336458

Fix a couple of typos in r334844 noticed by Richard Kojedzinszky

Approved by: mav
Sponsored by: iXsystems, Inc

5 years agoMFC r338913: Fix use-after-free in RAID0 error reporting of GEOM_RAID.
mav [Mon, 1 Oct 2018 04:02:00 +0000 (04:02 +0000)]
MFC r338913: Fix use-after-free in RAID0 error reporting of GEOM_RAID.

5 years agoMFC r338655:
gonzo [Sun, 30 Sep 2018 23:18:42 +0000 (23:18 +0000)]
MFC r338655:

[ig4] Update list of supported hardware

Reflect the fact that ig4(4) is not an Intel-specific device but
a driver for Synopsys DesignWare I2C controller that now ships in
AMD systems too.

Approved by: re (kib), rpokala

5 years agoMFC r338654, r338701
gonzo [Sun, 30 Sep 2018 23:17:33 +0000 (23:17 +0000)]
MFC r338654, r338701

r338654:
[ig4] Add PCI IDs for I2C controller on Intel Kaby Lake systems

PR: 221777
Approved by: re (kib)
Submitted by: marc.priggemeyer@gmail.com

r338701:
[ig4] Fix device description for Kaby Lake systems

Kaby Lake I2C controller is Intel Sunrise Point-H not Intel Sunrise Point-LP.

Submitted by: Dmitry Luhtionov
Approved by: re (kib)

5 years agoMFC r338111, r338215
gonzo [Sun, 30 Sep 2018 23:15:44 +0000 (23:15 +0000)]
MFC r338111, r338215

r338111:
[ig4] add ACPI Device HID for AMD platforms

Added ACPI Device HID AMDI0010 for the designware I2C controllers in
future AMD platforms. Also, when verifying component version check for
minimal value instead of exact match.

PR: 230641
Submitted by: Rajesh <rajfbsd@gmail.com>
Reviewed by: cem, gonzo
Differential Revision: https://reviews.freebsd.org/D16670

r338215:
[ig4] Fix I/O timeout issue with Designware I2C controller on AMD platforms

Due to hardware limitation AMD I2C controller can't trigger pending
interrupt if interrupt status has been changed after clearing
interrupt status bits.  So, I2C will lose the interrupt and IO will be
timed out. Implements a workaround to disable I2C controller interrupt
and re-enable I2C interrupt before existing interrupt handler.

Submitted by: rajfbsd@gmail.com
Differential Revision: https://reviews.freebsd.org/D16720

5 years agoMFC r336050-r336051, r336142, r336326, r337719
gonzo [Sun, 30 Sep 2018 23:14:07 +0000 (23:14 +0000)]
MFC r336050-r336051, r336142, r336326, r337719

r336050:
ig4(4): add support for Apollo Lake I2C controllers

Add PCI ids for I2C controllers on Apollo Lake platform. Also convert
switch/case probe logic into a table.

Reviewed by: avg
Differential Revision: https://reviews.freebsd.org/D16120

r336051:
ig4(4): Fix Apollo lake entries platform identifier

Identify Apollo Lake controllers as IG4_APL and not as a IG4_SKYLAKE

Reported by: rpokala@

r336142:
ig4(4): add devmatch(8) PNP info

Now that we have all devices ids in a table add MODULE_PNP_INFO macro
to let devmatch autoload module

r336326:
Remove MODULE_PNP_INFO for ig4(4) driver

ig4(4) does not support suspend/resume but present on the hardware where
such functionality is critical, like laptops. Remove PNP info to avoid
breaking suspend/resume on the systems where ig4(4) load is not explicitly
requested by the user.

PR:             229791
Reported by:    Ali Abdallah

r337719:
[ig4] Fix initialization sequence for newer ig4 chips

Newer chips may require assert/deassert after power down for proper
startup. Check respective flag in DEVIDLE_CTRL and perform operation
if neccesssary.

PR: 221777
Submitted by: marc.priggemeyer@gmail.com
Obtained from: DragonFly BSD
Tested on: Thinkpad T470

5 years agoMFC r336310:
oshogbo [Sun, 30 Sep 2018 12:25:38 +0000 (12:25 +0000)]
MFC r336310:
  Let geli deal with lost devices without crashing.

  PR:           162036
  Submitted by: Fabian Keil <fk@fabiankeil.de>
  Obtained from:        ElectroBSD
  Discussed with: pjd@

5 years agoMFC r338942:
slavash [Sun, 30 Sep 2018 08:41:14 +0000 (08:41 +0000)]
MFC r338942:
Add PCIV_INVALID definition

From PCI Spec rev 2.2, 6.2.1. Device Identification:
Vendor ID This field identifies the manufacturer of the device. Valid
vendor identifiers are allocated by the PCI SIG to ensure uniqueness.
0FFFFh is an invalid value for Vendor ID.

Approved by:    kib (mentor)
Sponsored by:   Mellanox Technologies

5 years agoMFC r338892:
kib [Sat, 29 Sep 2018 06:54:52 +0000 (06:54 +0000)]
MFC r338892:
Correct panic messages.

5 years agoMFC r336017,r338799
sef [Sat, 29 Sep 2018 00:44:23 +0000 (00:44 +0000)]
MFC r336017,r338799

r336017
This exposes ZFS user and group quotas via the normal
quatactl(2) mechanism.  (Read-only at this point, however.)
In particular, this is to allow rpc.rquotad query quotas
for NFS mounts, allowing users to see their quotas on the
hosts using the datasets.

The changes specifically:

* Add new RPC entry points for querying quotas.
* Changes the library routines to allow non-UFS quotas.
* Changes rquotad to check for quotas on mounted filesystems,
rather than being limited to entries in /etc/fstab
* Lastly, adds a VFS entry-point for ZFS to query quotas.

Note that this makes one unavoidable behavioural change: if quotas
are enabled, then they can be queried, as opposed to the current
method of checking for quotas being specified in fstab.  (With
ZFS, if there are user or group quotas, they're used, always.)

r338799
Author: kib

Fix ZFS VFS op quotactl to follow busy protocol.

Approved by: mav
Sponsored by: iXsystems, inc

5 years agoMFC r338827:
mm [Fri, 28 Sep 2018 22:01:53 +0000 (22:01 +0000)]
MFC r338827:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1019: Add allocation check for the zip_entry struct
  Oss-Fuzz #10192: Handle whitespace-only ACL fields correctly

5 years agoMFC 337673: Add an overview section to bus_dma.9.
jhb [Fri, 28 Sep 2018 17:40:06 +0000 (17:40 +0000)]
MFC 337673: Add an overview section to bus_dma.9.

Describe the role of tags and mapping objects as abstractions.
Describe static vs dynamic transaction types and give a brief overview
of the set of functions and object life cycles used for static vs
dynamic.

While here, fix a few other typos and expand a bit on parent tags.

5 years agoMFC r338473: sh: Fix formal overflow in pointer arithmetic
jilles [Fri, 28 Sep 2018 12:29:53 +0000 (12:29 +0000)]
MFC r338473: sh: Fix formal overflow in pointer arithmetic

The intention is to lower the value of the pointer, which according to ubsan
cannot be done by adding an unsigned quantity.

Reported by: kevans

5 years agoMFC r338857:
ae [Fri, 28 Sep 2018 10:02:47 +0000 (10:02 +0000)]
MFC r338857:
  Fix possible NULL pointer dereference in ffec_alloc_mbufcl().

  PR: 231514

5 years agoCheck to ensure the buffer returned is not NULL.
gordon [Thu, 27 Sep 2018 18:54:41 +0000 (18:54 +0000)]
Check to ensure the buffer returned is not NULL.

Direct commit to the branch as this behavior is only seeing in stable/11.

Reported by: Thomas Barabosch, Fraunhofer FKIE
Reviewed by: wes@
Approved by: so
Security: FreeBSD-EN-18:10.syscall
Security: CVE-2018-17154

5 years agoThere are various cases where we modify the inp_vflag and inp_inc.inc_flags
gordon [Thu, 27 Sep 2018 18:50:10 +0000 (18:50 +0000)]
There are various cases where we modify the inp_vflag and inp_inc.inc_flags
fields during a syscall, but don't restore those fields if the operation
fails.  This can leave the inp structure in an inconsistent state and cause
various problems.

Restore the inp_vflag and inp_inc.inc_flags fields when the underlying
operation fails and the inp could be in an inconsistent state.

This is a direct commit to the branch as the code is different enough in
the other branches to make it difficult to resolve a merge.

Submitted by:   jtl@
Reported by:    Jakub Jirasek, Secunia Research at Flexera
Reviewed by:    jhb@
Approved by:    so
Security:       FreeBSD-EN-18:11.listen
Security:       CVE-2018-6925

5 years agoMFC r338982.
gordon [Thu, 27 Sep 2018 18:42:40 +0000 (18:42 +0000)]
MFC r338982.

Clear stack allocated data structure to prevent kernel memory leak.

Reported by: Thomas Barabosch, Fraunhofer FKIE
Reviewed by: wes@
Approved by: so
Security: FreeBSD-EN-18:12.mem
Security: CVE-2018-17155

5 years agoMFC r334810 (by benno), r338205, r338206:
mav [Thu, 27 Sep 2018 17:22:40 +0000 (17:22 +0000)]
MFC r334810 (by benno), r338205, r338206:
r334810:
Break recursion involving getnewvnode and zfs_rmnode.

When we're at our vnode limit, getnewvnode will call into the vnode LRU
cache to free up vnodes. If the vnode we try to recycle is a ZFS vnode we
end up, eventually, in zfs_rmnode. If the ZFS vnode we're recycling
represents something with extended attributes, zfs_rmnode will call
zfs_zget which will attempt to allocate another vnode. If the next vnode we
try to recycle is also a ZFS vnode representing something with extended
attributes we can recurse further. This ends up being unbounded and can end
up overflowing the stack.

In order to avoid this, restructure zfs_rmnode to simply add the extended
attribute directory's object ID to the unlinked set, thus not requiring the
allocation of a vnode. We then schedule a task that calls zfs_unlinked_drain
which will do the work of properly marking the vnodes for unlinking.
zfs_unlinked_drain is also called on mount so these will be cleaned up
there.

r338205:
Create separate taskqueue to call zfs_unlinked_drain().

r334810 introduced zfs_unlinked_drain() dispatch to taskqueue on every
deletion of a file with extended attributes.  Using system_taskq for that
with its multiple threads in case of multiple files deletion caused all
available CPU threads to uselessly spin on busy locks, completely blocking
the system.

Use of single dedicated taskqueue is the only easy solution I've found,
while in would be great if we could specify that some task should be
executed only once at a time, but never in parallel, while many tasks
could use different threads same time.

r338206:
Add dmu_tx_assign() error handling in zfs_unlinked_drain().

The error handling got lost during r334810, while according to the report
error there may happen in case of dataset being over quota.  In such case
just leave the node in the unlinked list to be freed sometimes later.

5 years agoMFC r333307 (by sbruno):
mav [Thu, 27 Sep 2018 17:11:11 +0000 (17:11 +0000)]
MFC r333307 (by sbruno):
Cleanup sundry clang warnings for code that is not upstream in illumos.
https://github.com/illumos/illumos-gate/edit/master/usr/src/lib/libzfs/common/libzfs_sendrecv.c

Patch our version of it to quiesce warnings until someone decides to sync
up our code:

libzfs_sendrecv.c:2555:30: warning: format specifies type 'unsigned long'
  but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                sprintf(guidname, "%lu", thisguid);
                                                   ~~~   ^~~~~~~~
                                                   %llu
libzfs_sendrecv.c:2612:29: warning: format specifies type 'unsigned long'
  but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                        sprintf(guidname, "%lu", parent_fromsnap_guid);
                                           ~~~   ^~~~~~~~~~~~~~~~~~~~
                                           %llu
libzfs_sendrecv.c:2645:29: warning: format specifies type 'unsigned long'
  but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                        sprintf(guidname, "%lu", parent_fromsnap_guid);
                                           ~~~   ^~~~~~~~~~~~~~~~~~~~
                                           %llu

5 years agoMFC r333081 (by eadler):
mav [Thu, 27 Sep 2018 14:57:20 +0000 (14:57 +0000)]
MFC r333081 (by eadler):
zpool(8): correct list of default properties in 'list'.

The default provides output in the following form:
```
NAME       SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP
HEALTH  ALTROOT
```

this corrects the man page.

Also submitted upstream as
https://github.com/openzfs/openzfs/pull/632/files (with slightly
different changes needed)

5 years agoMFC r338798:
kib [Wed, 26 Sep 2018 14:26:29 +0000 (14:26 +0000)]
MFC r338798:
Fix state of dquot-less vnodes after failed quotaoff.

5 years agoMFC r333146:
jpaetzel [Tue, 25 Sep 2018 23:59:45 +0000 (23:59 +0000)]
MFC r333146:

  Add ability to perform a firmware reset during driver initialization.

  Required by Lancer Gen 5 hardware.

  Submitted by:   Ram Kishore Vegesna <ram.vegesna@broadcom.com>
  Obtained from:  Broadcom

5 years agoMFC r306219:
jpaetzel [Tue, 25 Sep 2018 23:48:43 +0000 (23:48 +0000)]
MFC r306219:

  Update oce to version 11.0.50.0

  Submitted by:   Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

5 years agoMFC r303811:
jpaetzel [Tue, 25 Sep 2018 23:33:30 +0000 (23:33 +0000)]
MFC r303811:

  Extract out the various local definitions of ETHER_IS_BROADCAST() and
  turn them into a shared definition.

  Set M_MCAST/M_BCAST appropriately upon packet reception in net80211, just
  before they are delivered up to the ethernet stack.

  Submitted by:   rstone

5 years agoBump __FreeBSD_version after r338871 introduced new media types
erj [Tue, 25 Sep 2018 19:53:19 +0000 (19:53 +0000)]
Bump __FreeBSD_version after r338871 introduced new media types
and a TCP checksum fix for ixl(4)

This is a direct commit.

Sponsored by: Intel Corporation

5 years agoPartial MFC of r338542:
delphij [Tue, 25 Sep 2018 05:18:20 +0000 (05:18 +0000)]
Partial MFC of r338542:

random(4): Squash non-error timeout code from tsleep(9).

PR: 231181
Submitted by: cem
Reported by: lev
Reviewed by: vangyzen, markm, delphij
Approved by: secteam (delphij)
Differential Revision: https://reviews.freebsd.org/D17049

5 years agoMFC r338573: Add vt(4) INDEX.fonts
emaste [Mon, 24 Sep 2018 18:41:32 +0000 (18:41 +0000)]
MFC r338573: Add vt(4) INDEX.fonts

PR: 231237
Submitted by: Martin <martin.jakob@gmx.com> (original version)

5 years agoMFC r338724:
markj [Mon, 24 Sep 2018 14:48:27 +0000 (14:48 +0000)]
MFC r338724:
Fix an nvpair leak in vdev_geom_read_config().

PR: 230704

5 years agoMFC r338733:
kib [Mon, 24 Sep 2018 10:03:37 +0000 (10:03 +0000)]
MFC r338733:
Do not upgrade the vnode lock to call getinoquota().

5 years agoMFC r338711:
kib [Mon, 24 Sep 2018 09:57:47 +0000 (09:57 +0000)]
MFC r338711:
Make the PTI violation check to follow style of the SMAP check.

5 years agoMFC r338699:
kib [Sun, 23 Sep 2018 09:53:09 +0000 (09:53 +0000)]
MFC r338699:
Remove unneeded new line from the panic string.

5 years agoMFC r338801:
kib [Sat, 22 Sep 2018 16:19:21 +0000 (16:19 +0000)]
MFC r338801:
amd64 pmap: remove tautological assert.

5 years agoRevert MFC of r334231 in r338871.
erj [Fri, 21 Sep 2018 23:54:01 +0000 (23:54 +0000)]
Revert MFC of r334231 in r338871.

It did not apply cleanly and was causing build errors.

5 years agoMFC r334231, r334779, r335322, and r338208 to stable/11 from head
erj [Fri, 21 Sep 2018 23:31:04 +0000 (23:31 +0000)]
MFC r334231, r334779, r335322, and r338208 to stable/11 from head

These include:
r334231: iflib: Add new shared flag: IFLIB_ADMIN_ALWAYS_RUN
r334779: iflib: Record TCP checksum info in iflib when TCP checksum is requested
r335322: iflib: Style fixes
r338208: if_media: Add new 2.5G/5G/25G/40G/50G/100G/200G/400G media types

Sponsored by: Intel Corporation

5 years agoInclude stdbool.h so that we can use bool in linker.h.
markj [Fri, 21 Sep 2018 21:15:43 +0000 (21:15 +0000)]
Include stdbool.h so that we can use bool in linker.h.

As asf(8) is gone in head, this is a direct commit to stable/11.

5 years agoMFC r338211:
markj [Fri, 21 Sep 2018 20:40:37 +0000 (20:40 +0000)]
MFC r338211:
Prepare the kernel linker to handle PC-relative ifunc relocations.

5 years agoMFC r338754:
gjb [Fri, 21 Sep 2018 15:58:08 +0000 (15:58 +0000)]
MFC r338754:
 Update the pkg-stage.sh script used to populate packages on the
 dvd1.iso installation medium from including KDE4 to KDE5, as the
 KDE4-based ports have been marked as deprecated in the Ports
 Collection.

Sponsored by: The FreeBSD Foundation

5 years agoMFC 337270: Install the 32-bit compat sanitizer libraries.
jhb [Thu, 20 Sep 2018 16:43:58 +0000 (16:43 +0000)]
MFC 337270: Install the 32-bit compat sanitizer libraries.

The lib32 build was already building the i386 version of
the clang sanitizers (libclang_rt) but they were not being
installed.  This enables the installation.

MK_TOOLCHAIN=no was originally added to the install make
environment to disable includes so that NO_INCS could be
removed.  The MK_TOOLCHAIN in bsd.incs.mk was subsequently
renamed to MK_INCLUDES, but bsd.lib.mk doesn't even include
bsd.incs.mk when LIBRARIES_ONLY is defined which the install
make environment for compat libs now defines.  However,
setting MK_TOOLCHAIN=no forced MK_CLANG=no which disabled
libclang_rt during the install32 phase.  Remove MK_TOOLCHAIN=no
since LIBRARIES_ONLY is now sufficient.

Since the libcompat environment overrides both LIBDIR and
SHLIBDIR, libclang_rt/Makefile.inc has to set both variables
to force the libraries to be installed to the location
expected by the compiler.

5 years agoMFC r338600:
mm [Wed, 19 Sep 2018 09:41:33 +0000 (09:41 +0000)]
MFC r338600:
Update libarchive to 3.3.3

As all important changes have already been merged from libarchive git
this is just a version number bump, documentation update and some
polishing for cpio tests. Other source code changes are not relevant to
FreeBSD.

Relnotes: yes

5 years agoMFC r338679:
hselasky [Wed, 19 Sep 2018 08:11:44 +0000 (08:11 +0000)]
MFC r338679:
Improve LibUSB debugging by simultaneously allowing both function
and transfer prints. Make sure the debug level comes from the
correct USB context.

Found by: Ludovic Rousseau <ludovic.rousseau+freebsd@gmail.com>
PR: 231264
Sponsored by: Mellanox Technologies

5 years agoMFC r338616:
hselasky [Wed, 19 Sep 2018 07:56:19 +0000 (07:56 +0000)]
MFC r338616:
Fix issues about cancelling USB transfers in LibUSB when the USB device has
been detached. When a USB device has been detached the kernel file handle
stops responding to commands. USB applications which continue to run after
the USB device has been detached, depend on LibUSB generated events to tear
down its pending USB transfers. Add code to handle the needed cleanup when
processing the USB transfer(s) fails and prevent new USB transfer(s) from
being submitted.

Found by: Ludovic Rousseau <ludovic.rousseau+freebsd@gmail.com>
PR: 231076
Sponsored by: Mellanox Technologies

5 years agoMFC r309748 (by glebius):
dim [Tue, 18 Sep 2018 20:46:55 +0000 (20:46 +0000)]
MFC r309748 (by glebius):

Treat R_X86_64_PLT32 relocs as R_X86_64_PC32.

If we load a binary that is designed to be a library, it produces
relocatable code via assembler directives in the assembly itself
(rather than compiler options).  This emits R_X86_64_PLT32 relocations,
which are not handled by the kernel linker.

Submitted by: gallatin
Reviewed by: kib
PR: 231451

5 years agoMFC r338697:
dim [Tue, 18 Sep 2018 07:29:01 +0000 (07:29 +0000)]
MFC r338697:

Pull in r325478 from upstream clang trunk (by Ivan A. Kosarev):

  [CodeGen] Initialize large arrays by copying from a global

  Currently, clang compiles explicit initializers for array elements
  into series of store instructions. For large arrays of built-in types
  this results in bloated output code and significant amount of time
  spent on the instruction selection phase. This patch fixes the issue
  by initializing such arrays with global constants that store the
  binary image of the initializer.

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

This should fix a compiler hang (and excessive memory usage) while
building the science/rmg port.

Reported by: yuri@tsoft.com
See also: https://bugs.llvm.org/show_bug.cgi?id=38798

5 years agorevert r338726 (getdirentries capsicum addition)
emaste [Mon, 17 Sep 2018 18:46:30 +0000 (18:46 +0000)]
revert r338726 (getdirentries capsicum addition)

Compat getdirentries was added with the ino64 project and is not needed
in stable/11.  I MFC'd r335900 accidentally as a side effect of some
other WIP.

PR: 228671

5 years agoMFC 335913:
jhb [Mon, 17 Sep 2018 18:45:16 +0000 (18:45 +0000)]
MFC 335913:
Use 'e' instead of 'i' constraints with 64-bit atomic operations on amd64.

The ADD, AND, OR, and SUB instructions take at most a 32-bit
sign-extended immediate operand.  64-bit constants that do not fit into
that constraint need to be loaded into a register.  The 'i' constraint
tells the compiler it can pass any integer constant to the assembler,
whereas the 'e' constrain only permits constants that fit into a 32-bit
sign-extended value.  This fixes using
atomic_add/clear/set/subtract_long/64 with constants that do not fit into
a 32-bit sign-extended immediate.

5 years agoMFC r335900 (oshogbo): capsicum: add getdirentries to the freebsd32 compact
emaste [Mon, 17 Sep 2018 18:36:29 +0000 (18:36 +0000)]
MFC r335900 (oshogbo): capsicum: add getdirentries to the freebsd32 compact

There is a getdirentries syscall in freebsd32 and it's
capability ready so allow calling it in the capability mode.

PR: 228671

5 years agoMFC r338689:
dim [Mon, 17 Sep 2018 14:53:03 +0000 (14:53 +0000)]
MFC r338689:

Pull in r335365 from upstream llvm trunk (by Krzysztof Parzyszek):

  Initialize LiveRegs once in BranchFolder::mergeCommonTails

This should fix '(TRI && "LivePhysRegs is not initialized."' assertions
when building the lang/qt5-qml port in certain configurations.

Reported by: Piotr Kubaj <pkubaj@anongoth.pl>
PR: 231355

5 years agoMFC r338613:
hselasky [Mon, 17 Sep 2018 11:24:16 +0000 (11:24 +0000)]
MFC r338613:
Fix for backends which doesn't support capsicum.

Not all libpcap backends use the BPF compatible set
of IOCTLs. For example the mlx5 backend uses libibverbs
which is currently not capsicum compatible.

Disable sandboxing for such backends.

Discussed with: emaste@
Sponsored by: Mellanox Technologies

5 years agoMFC r337992, r338125:
pfg [Mon, 17 Sep 2018 02:51:08 +0000 (02:51 +0000)]
MFC r337992, r338125:
POSIX compliance improvements in the pthread(3) functions.

This basically adds makes use of the C99 restrict keyword, and also
adds some 'const's to four threading functions: pthread_mutexattr_gettype(),
pthread_mutexattr_getprioceiling(), pthread_mutexattr_getprotocol(), and
pthread_mutex_getprioceiling. The changes are in accordance to POSIX/SUSv4-2018.

Hinted by: DragonFlyBSD

Relnotes: yes

5 years agoRevert r338695: it depends on r334032, which was not MFCed.
markj [Sat, 15 Sep 2018 18:47:07 +0000 (18:47 +0000)]
Revert r338695: it depends on r334032, which was not MFCed.

PR: 231064