]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agofusefs: WIP supporting -o default_permissions
asomers [Wed, 10 Apr 2019 17:31:00 +0000 (17:31 +0000)]
fusefs: WIP supporting -o default_permissions

Normally all permission checking is done in the fuse server.  But when -o
default_permissions is used, it should be done in the kernel instead.  This
commit adds appropriate permission checks through fusefs when -o
default_permissions is used.  However, sticky bit checks aren't working yet.
I'll handle those in a follow-up commit.

There are no checks for file flags, because those aren't supported by our
version of the FUSE protocol.  Nor is there any support for ACLs, though
that could be added if there were any demand.

PR: 216391
Reported by: hiyorin@gmail.com
Sponsored by: The FreeBSD Foundation

5 years agofusefs: skip the Read.keep_cache test when cache is disabled
asomers [Tue, 9 Apr 2019 21:38:20 +0000 (21:38 +0000)]
fusefs: skip the Read.keep_cache test when cache is disabled

This should've been part of r345892

PR: 236560
Sponsored by: The FreeBSD Foundation

5 years agofusefs: cache negative lookups
asomers [Tue, 9 Apr 2019 21:22:02 +0000 (21:22 +0000)]
fusefs: cache negative lookups

The FUSE protocol includes a way for a server to tell the client that a
negative lookup response is cacheable for a certain amount of time.

PR: 236226
Sponsored by: The FreeBSD Foundation

5 years agofusefs: implement entry cache timeouts
asomers [Tue, 9 Apr 2019 17:23:34 +0000 (17:23 +0000)]
fusefs: implement entry cache timeouts

Follow-up to r346046.  These two commits implement fuse cache timeouts for
both entries and attributes.  They also remove the vfs.fusefs.lookup_cache
enable sysctl, which is no longer needed now that cache timeouts are
honored.

PR: 235773
Sponsored by: The FreeBSD Foundation

5 years agofusefs: implement attribute cache timeouts
asomers [Tue, 9 Apr 2019 00:47:38 +0000 (00:47 +0000)]
fusefs: implement attribute cache timeouts

The FUSE protocol allows the server to specify the timeout period for the
client's attribute and entry caches.  This commit implements the timeout
period for the attribute cache.  The entry cache's timeout period is
currently disabled because it panics, and is guarded by the
vfs.fusefs.lookup_cache_expire sysctl.

PR: 235773
Reported by: cem
Sponsored by: The FreeBSD Foundation

5 years agofusefs: cache file attributes
asomers [Mon, 8 Apr 2019 18:45:41 +0000 (18:45 +0000)]
fusefs: cache file attributes

FUSE_LOOKUP, FUSE_GETATTR, FUSE_SETATTR, FUSE_MKDIR, FUSE_LINK,
FUSE_SYMLINK, FUSE_MKNOD, and FUSE_CREATE all return file attributes with a
cache validity period.  fusefs will now cache the attributes, if the server
returns a non-zero cache validity period.

This change does _not_ implement finite attr cache timeouts.  That will
follow as part of PR 235773.

PR: 235775
Reported by: cem
Sponsored by: The FreeBSD Foundation

5 years agofusefs: implement VOP_ACCESS
asomers [Fri, 5 Apr 2019 18:37:48 +0000 (18:37 +0000)]
fusefs: implement VOP_ACCESS

VOP_ACCESS was never fully implemented in fusefs.  This change:
* Removes the FACCESS_DO_ACCESS flag, which pretty much disabled the whole
  vop.
* Removes a quixotic special case for VEXEC on regular files.  I don't know
  why that was in there.
* Removes another confusing special case for VADMIN.
* Removes the FACCESS_NOCHECKSPY flag.  It seemed to be a performance
  optimization, but I'm unconvinced that it was a net positive.
* Updates test cases.

This change does NOT implement -o default_permissions.  That will be handled
separately.

PR: 236291
Sponsored by: The FreeBSD Foundation

5 years agofusefs: enforce -onoallow_other even beneath the mountpoint
asomers [Fri, 5 Apr 2019 17:21:23 +0000 (17:21 +0000)]
fusefs: enforce -onoallow_other even beneath the mountpoint

When -o allow_other is not in use, fusefs is supposed to prevent access to
the filesystem by any user other than the one who owns the daemon.  Our
fusefs implementation was only enforcing that restriction at the mountpoint
itself.  That was usually good enough because lookup usually descends from
the mountpoint.  However, there are cases when it doesn't, such as when
using openat relative to a file beneath the mountpoint.

PR: 237052
Sponsored by: The FreeBSD Foundation

5 years agofusefs: correctly return EROFS from VOP_ACCESS
asomers [Fri, 5 Apr 2019 15:33:43 +0000 (15:33 +0000)]
fusefs: correctly return EROFS from VOP_ACCESS

Sponsored by: The FreeBSD Foundation

5 years agofusefs: reenable some fsyncdir tests
asomers [Fri, 5 Apr 2019 15:04:25 +0000 (15:04 +0000)]
fusefs: reenable some fsyncdir tests

These tests were actually fixed by r345398, r345390 and r345392, but I
neglected to reenable them.  Too bad googletest doesn't have the notion of
an Expected Failure like ATF does.

PR: 236474, 236473
Sponsored by: The FreeBSD Foundation

5 years agoFix the branch build
ngie [Fri, 5 Apr 2019 03:35:40 +0000 (03:35 +0000)]
Fix the branch build

Copy gtest_skip_in_environment_setup_test.cc (added in r345770) from ^/head .

5 years agoAdd mpr, mps, mpt to NOTES file
imp [Fri, 5 Apr 2019 02:54:02 +0000 (02:54 +0000)]
Add mpr, mps, mpt to NOTES file

Add these to all the architectures that these are in the GENERIC
kernel.

5 years agoFix build.
delphij [Fri, 5 Apr 2019 02:37:10 +0000 (02:37 +0000)]
Fix build.

MFC after: 2 weeks
X-MFC-With: r345900

5 years agoImplement checking of `.' and `..' entries of subdirectory.
delphij [Fri, 5 Apr 2019 02:21:16 +0000 (02:21 +0000)]
Implement checking of `.' and `..' entries of subdirectory.

Reviewed by: pfg
Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/b6ee08aadb580341a4d80943741b80de16a88b5d%5E%21/
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19824

5 years agoAdd an entry to UPDATING for r345895, which affects the use of nfsuserd daemons
rmacklem [Thu, 4 Apr 2019 23:40:30 +0000 (23:40 +0000)]
Add an entry to UPDATING for r345895, which affects the use of nfsuserd daemons
built from head sources between July 6, 2017 and Aug. 22, 2018.

5 years agoRestore lfcl when LOSTDIR's chain was corrupted and overwritten
delphij [Thu, 4 Apr 2019 23:34:03 +0000 (23:34 +0000)]
Restore lfcl when LOSTDIR's chain was corrupted and overwritten
with invalid value.

Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/4d6d6f8a3674ad67f970e2ae908d34f64e4854cf%5E%21/
MFC after: 2 weeks

5 years agosort(1): randomcoll: Skip the memory allocation entirely
cem [Thu, 4 Apr 2019 23:32:27 +0000 (23:32 +0000)]
sort(1): randomcoll: Skip the memory allocation entirely

There's no reason to order based on strcmp of ASCII digests instead of
memcmp of the raw digests.

While here, remove collision fallback.  If you collide two MD5s, they're
probably the same string anyway.  If robustness against MD5 collisions is
desired, maybe we shouldn't use MD5.

None of the behavior of sort -R is specified by POSIX, so we're free to
implement this however we like.  E.g., using a 128-bit counter and block cipher
to generate unique indices for each line of input.

PR: 230792 (2/many)
Relnotes: This will change the sort order for a given dataset with a
given seed.  Other similarly breaking changes are planned.
Sponsored by: Dell EMC Isilon

5 years agoRevert r320698, since the related userland changes were reverted by r338192.
rmacklem [Thu, 4 Apr 2019 23:30:27 +0000 (23:30 +0000)]
Revert r320698, since the related userland changes were reverted by r338192.

r338192 reverted the changes to nfsuserd so that it could use an AF_LOCAL
socket, since it resulted in a vnode locking panic().
Post r338192 nfsuserd daemons use the old AF_INET socket for upcalls and
do not use these kernel changes.
I left them in for a while, so that nfsuserd daemons built from head sources
between r320757 (Jul. 6, 2017) and r338192 (Aug. 22, 2018) would need them
by default.
This only affects head, since the changes were never MFC'd.
I will add an UPDATING entry, since an nfsuserd daemon built from head
sources between r320757 and r338192 will not run unless the "-use-udpsock"
option is specified. (This command line option is only in the affected
revisions of the nfsuserd daemon.)

I suspect few will be affected by this, since most who run systems built
from head sources (not stable or releases) will have rebuilt their nfsuserd
daemon from sources post r338192 (Aug. 22, 2018)

This is being reverted in preparation for an update to include AF_INET6
support to the code.

5 years agoRestore the ability of checking and fixing next free
delphij [Thu, 4 Apr 2019 23:16:36 +0000 (23:16 +0000)]
Restore the ability of checking and fixing next free
cluster in FSINFO that was lost in r203872.

Obtained from: NetBSD
MFC after: 2 weeks

5 years agoAdd requiered programs (cc and c++) for some lib/atf regression tests
olivier [Thu, 4 Apr 2019 20:34:17 +0000 (20:34 +0000)]
Add requiered programs (cc and c++) for some lib/atf regression tests

PR: 236889
Reviewed by: ngie
Approved by: emaste (on IRC)
MFC after: 1 month
Sponsored by: Netflix

5 years agofusefs: properly handle FOPEN_KEEP_CACHE
asomers [Thu, 4 Apr 2019 20:30:14 +0000 (20:30 +0000)]
fusefs: properly handle FOPEN_KEEP_CACHE

If a fuse file system returne FOPEN_KEEP_CACHE in the open or create
response, then the client is supposed to _not_ clear its caches for that
file.  I don't know why clearing the caches would be the default given that
there's a separate flag to bypass the cache altogether, but that's the way
it is.  fusefs(5) will now honor this flag.

Our behavior is slightly different than Linux's because we reuse file
handles.  That means that open(2) wont't clear the cache if there's a
reusable file handle, even if the file server wouldn't have sent
FOPEN_KEEP_CACHE had we opened a new file handle like Linux does.

PR: 236560
Sponsored by: The FreeBSD Foundation

5 years agosort(1): randomcoll: Don't sort on ENOMEM
cem [Thu, 4 Apr 2019 20:27:13 +0000 (20:27 +0000)]
sort(1): randomcoll: Don't sort on ENOMEM

PR: 230792 (1/many)
Sponsored by: Dell EMC Isilon

5 years agofusefs: fix some uninitialized memory references
asomers [Thu, 4 Apr 2019 20:24:58 +0000 (20:24 +0000)]
fusefs: fix some uninitialized memory references

This bug was long present, but was exacerbated by r345876.

The problem is that fiov_refresh was bzero()ing a buffer _before_ it
reallocated that buffer.  That's obviously the wrong order.  I fixed the
order in r345876, which exposed the main problem.  Previously, the first 160
bytes of the buffer were getting bzero()ed when it was first allocated in
fiov_init.  Subsequently, as that buffer got recycled between callers, the
portion used by the _previous_ caller was getting bzero()ed by the current
caller in fiov_refresh.  The problem was never visible simply because no
caller was trying to use more than 160 bytes.

Now the buffer gets properly bzero()ed both at initialization time and any
time it gets enlarged or reallocated.

Sponsored by: The FreeBSD Foundation

5 years agoif_muge: use NULL not 0 for DRIVER_MODULE pointer args
emaste [Thu, 4 Apr 2019 19:59:31 +0000 (19:59 +0000)]
if_muge: use NULL not 0 for DRIVER_MODULE pointer args

Sponsored by: The FreeBSD Foundation

5 years agoUse IN_foo() macros from sys/netinet/in.h inplace of handcrafted code
rgrimes [Thu, 4 Apr 2019 19:01:13 +0000 (19:01 +0000)]
Use IN_foo() macros from sys/netinet/in.h inplace of handcrafted code

There are a few places that use hand crafted versions of the macros
from sys/netinet/in.h making it difficult to actually alter the
values in use by these macros.  Correct that by replacing handcrafted
code with proper macro usage.

Reviewed by: karels, kristof
Approved by: bde (mentor)
MFC after: 3 weeks
Sponsored by: John Gilmore
Differential Revision: https://reviews.freebsd.org/D19317

5 years agoRewrite intro(4) man page.
ygy [Thu, 4 Apr 2019 18:52:03 +0000 (18:52 +0000)]
Rewrite intro(4) man page.

- Remove issues that no longer apply thanks to devfs
- Add language pointing out devfs's role and referencing its config
- Add a "historical notes" section and move discussion of block vs character devs to it, including pointing out the removal of block devs
- Modernize some examples

MFC after: 1 week
PR: 236970
Submitted by: andrew@tao173.riddles.org.uk
Reviewed by: 0mp
Differential Revision: https://reviews.freebsd.org/D19799

5 years agoMFHead@r345880
asomers [Thu, 4 Apr 2019 18:26:32 +0000 (18:26 +0000)]
MFHead@r345880

5 years agofusefs: correctly handle short writes
asomers [Thu, 4 Apr 2019 16:51:34 +0000 (16:51 +0000)]
fusefs: correctly handle short writes

If a FUSE daemon returns FOPEN_DIRECT_IO when a file is opened, then it's
allowed to write less data than was requested during a FUSE_WRITE operation
on that file handle.  fusefs should simply return a short write to userland.

The old code attempted to resend the unsent data.  Not only was that
incorrect behavior, but it did it in an ineffective way, by attempting to
"rewind" the uio and uiomove the unsent data again.

This commit correctly handles short writes by returning directly to
userland if FOPEN_DIRECT_IO was set.  If it wasn't set (making the short
write technically a protocol violation), then we resend the unsent data.
But instead of rewinding the uio, just resend the data that's already in the
kernel.

That necessitated a few changes to fuse_ipc.c to reduce the amount of bzero
activity.  fusefs may be marginally faster as a result.

PR: 236381
Sponsored by: The FreeBSD Foundation

5 years agostrings: capsicumize it
oshogbo [Thu, 4 Apr 2019 16:32:27 +0000 (16:32 +0000)]
strings: capsicumize it

Reviewed by: cem
Discussed with: emaste
Differential Revision: https://reviews.freebsd.org/D18038

5 years agoAdd cap_fileargs.h to -legacy if needed.
oshogbo [Thu, 4 Apr 2019 04:14:20 +0000 (04:14 +0000)]
Add cap_fileargs.h to -legacy if needed.

Reviewed by: arichardson
Differential Revision: https://reviews.freebsd.org/D19685

5 years agoFix malloc stats for the RPCSEC_GSS server code when DEBUG is enabled.
rmacklem [Thu, 4 Apr 2019 01:23:06 +0000 (01:23 +0000)]
Fix malloc stats for the RPCSEC_GSS server code when DEBUG is enabled.

The code enabled when "DEBUG" is defined uses mem_alloc(), which is a
malloc(.., M_RPC, M_WAITOK | M_ZERO), but then calls gss_release_buffer()
which does a free(.., M_GSSAPI) to free the memory.
This patch fixes the problem by replacing mem_alloc() with a
malloc(.., M_GSSAPI, M_WAITOK | M_ZERO).
This bug affects almost no one, since the sources are not normally built
with "DEBUG" defined.

Submitted by: peter@ifm.liu.se
MFC after: 2 weeks

5 years agoReplace read_random(9) with more appropriate arc4rand(9) KPIs
cem [Thu, 4 Apr 2019 01:02:50 +0000 (01:02 +0000)]
Replace read_random(9) with more appropriate arc4rand(9) KPIs

Reviewed by: ae, delphij
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19760

5 years agoImplement tests for online expansion:
pjd [Thu, 4 Apr 2019 00:05:36 +0000 (00:05 +0000)]
Implement tests for online expansion:
- init, init -R
- onetime, onetime -R
- 512 and 4k sectors
- encryption only
- encryption and authentication
- configure -r/-R for detached providers
- configure -r/-R for attached providers
- all keys allocated (10, 20 and 30MB provider sizes)
- keys allocated on demand (10, 20 and 30PB provider sizes)
- reading and writing to provider after expansion (10-30MB only)
- checking if metadata in old location is cleared.

Obtained from: Fudo Security

5 years agoUpdate configure tests after addition of the online expansion.
pjd [Wed, 3 Apr 2019 23:58:58 +0000 (23:58 +0000)]
Update configure tests after addition of the online expansion.

Obtained from: Fudo Security

5 years agoImplement automatic online expansion of GELI providers - if the underlying
pjd [Wed, 3 Apr 2019 23:57:37 +0000 (23:57 +0000)]
Implement automatic online expansion of GELI providers - if the underlying
provider grows, GELI will expand automatically and will move the metadata
to the new location of the last sector.

This functionality is turned on by default. It can be turned off with the
-R flag, but it is not recommended - if the underlying provider grows and
automatic expansion is turned off, it won't be possible to attach this
provider again, as the metadata is no longer located in the last sector.

If the automatic expansion is turned off and the underlying provider grows,
GELI will only log a message with the previous size of the provider, so
recovery can be easier.

Obtained from: Fudo Security

5 years ago- Add missing -T (notrim) option to the label subcommand.
pjd [Wed, 3 Apr 2019 23:50:52 +0000 (23:50 +0000)]
- Add missing -T (notrim) option to the label subcommand.
- Add missing -T option in the onetime subcommand comment.

Obtained from: Fudo Security

5 years agoImport libxo-1.0.2
phil [Wed, 3 Apr 2019 21:55:39 +0000 (21:55 +0000)]
Import libxo-1.0.2

from 1.0.0:
    Add "continuation" flag, to allow multiple "xo" invocations in a single line of output (#58)
    Add --top-wrap to make top-level JSON wrappers
    Add --{open,close}-{list,instace} options
    Add xo_xml_leader(), to detect use of some bogus XML tags. It's still bad form, but it's a little safer now
    Avoid call to xo_write before xo_flush, since the latter calls the former
    Check return code from xo_flush_h properly (<0) (FreeBSD Bug 236935)
    For JSON output, avoid newline before a container's close brace (#62)
    Merge branch 'text_only' of https://github.com/zvr/libxo into zvr-text_only
    Use XO_USE_INT_RETURN_CODES, not USE_INT_RETURN_CODES
    add docs for --continuation
    add docs for --not-first
    call xo_state_set_flags before values and close containers; add XOIF_MADE_OUTPUT flag to track state; make proper empty JSON objects in xo_finish
    color_map code has to be #ifdef'd out, since the struct definition
    correct xo_flush_func_t (doesn't use xo_ssize_t)
    make depth change for --top-wrap only for JSON
    fix to handle --top-wrap in "xo" by being more consistent with handling trailing newlines
    fix to handle text-only version #64 (from zvr)
    fix xo_buf_has_room for round up to the next XO_BUFSIZ, not just add XO_BUFSIZ to the size (FreeBSD Bug 236937)
    update docs for new "xo" options
    update functions to use xo_ssize_t
    update test cases
from 1.0.1:
    Add EINTEGRITY to .pot files under test/gettext/ (fix from FreeBSD)
from 1.0.2:
    handle failure from xo_vnsprintf; don't add -1 to "rc"

PR: 236937, 236935
Submitted by: phil
Reported by: Alfonso S. Siciliano <alfix86@gmail.com>
MFC after: 2 weeks

5 years agoAdd support for cross-building cloudware images.
cperciva [Wed, 3 Apr 2019 21:54:47 +0000 (21:54 +0000)]
Add support for cross-building cloudware images.

If MACHINE_ARCH doesn't match TARGET_ARCH, and we're not in the special
case of building i386 images on an amd64 host, we need to pull in the
qemu-user-static package; this allows us to run some commands inside
the VM disk image chroot, most notably to install packages.

Reviewed by: gjb
MFC after: 2 weeks
Sponsored by: FreeBSD/EC2 patreon (https://www.patreon.com/cperciva)

5 years agoTag libxo 1.0.2
phil [Wed, 3 Apr 2019 21:48:09 +0000 (21:48 +0000)]
Tag libxo 1.0.2

5 years agoImport libxo 1.0.2
phil [Wed, 3 Apr 2019 21:47:19 +0000 (21:47 +0000)]
Import libxo 1.0.2

5 years agocpsw: use `phy-handle` in FDT to find PHY address
emaste [Wed, 3 Apr 2019 21:01:53 +0000 (21:01 +0000)]
cpsw: use `phy-handle` in FDT to find PHY address

In r337703 DTS files were updated to Linux 4.18, including Linux commit
4d8b032d3c03f4e9788a18bbb51b10e6c9e8a56b which removed the `phy_id`
property from am335x-bone-common (as the property was deprecated).

Use `phy-handle` via fdt_get_phyaddr, keeping the existing code as a
fallback for old DTBs.

PR: 236624
Submitted by: manu, Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: Gerald Aryeetey
Reviewed by: manu
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19814

5 years agofusefs: fix a panic in VOP_READDIR
asomers [Wed, 3 Apr 2019 20:57:43 +0000 (20:57 +0000)]
fusefs: fix a panic in VOP_READDIR

The original fusefs import, r238402, contained a bug in fuse_vnop_close that
could close a directory's file handle while there were still other open file
descriptors.  The code looks deliberate, but there is no explanation for it.
This necessitated a workaround in fuse_vnop_readdir that would open a new
file handle if, "for some mysterious reason", that vnode didn't have any
open file handles.  r345781 had the effect of causing the workaround to
panic, making the problem more visible.

This commit removes the workaround and the original bug, which also fixes
the panic.

Sponsored by: The FreeBSD Foundation

5 years agorctl: fix sysctl kern.racct.enable use after r341182
mjg [Wed, 3 Apr 2019 20:37:14 +0000 (20:37 +0000)]
rctl: fix sysctl kern.racct.enable use after r341182

The value was changed from int to bool. Since the new type
is smaller, the rest of the variable in the caller was left
unitialized.

PR: 236714
Reported by: trasz
Diagnosed by: markj
Sponsored by: The FreeBSD Foundation

5 years agofusefs: send FUSE_FLUSH during VOP_CLOSE
asomers [Wed, 3 Apr 2019 19:59:45 +0000 (19:59 +0000)]
fusefs: send FUSE_FLUSH during VOP_CLOSE

The FUSE protocol says that FUSE_FLUSH should be send every time a file
descriptor is closed.  That's not quite possible in FreeBSD because multiple
file descriptors can share a single struct file, and closef doesn't call
fo_close until the last close.  However, we can still send FUSE_FLUSH on
every VOP_CLOSE, which is probably good enough.

There are two purposes for FUSE_FLUSH.  One is to allow file systems to
return EIO if they have an error when writing data that's cached
server-side.  The other is to release POSIX file locks (which fusefs(5) does
not yet support).

PR: 236405, 236327
Sponsored by: The FreeBSD Foundation

5 years agoUndo my previous erroneous commit changing the tcp_output kassert.
rrs [Wed, 3 Apr 2019 19:35:07 +0000 (19:35 +0000)]
Undo my previous erroneous commit changing the tcp_output kassert.
Hmm now the question is where did the tcp_log_id change go :o

5 years agoFix typos in r345849.
mav [Wed, 3 Apr 2019 18:35:13 +0000 (18:35 +0000)]
Fix typos in r345849.

MFC after: 1 week

5 years agoList few more ATA commands.
mav [Wed, 3 Apr 2019 18:27:54 +0000 (18:27 +0000)]
List few more ATA commands.

MFC after: 1 week

5 years agolibbe(3): Add a serial to the generated snapshot names
kevans [Wed, 3 Apr 2019 17:04:38 +0000 (17:04 +0000)]
libbe(3): Add a serial to the generated snapshot names

To use bectl in an example, when one creates a new boot environment with
either `bectl create <be>` or `bectl create -e <otherbe> <be>`, libbe will
take a snapshot of the original boot environment to clone. Previously, this
used %F-%T date format as the snapshot name, but this has some limitations-
attempting to create multiple boot environments in quick succession may
collide if done within the same second.

Tack a serial onto it to reduce the chances of a collision... we could still
collide if multiple processes/threads are creating boot environments at the
same time, but this is likely not a big concern as this has only been
reported as occurring in freebsd-ci setup.

MFC after: 3 days

5 years agomsdosfs: zero tail of the last block on truncation for VREG vnodes as well.
kib [Wed, 3 Apr 2019 17:02:18 +0000 (17:02 +0000)]
msdosfs: zero tail of the last block on truncation for VREG vnodes as well.

Despite the call to vtruncbuf() from detrunc(), which results in
zeroing part of the partial page after EOF, there still is a
possibility to retain the stale data which is revived on file
enlargement.  If the filesystem block size is greater than the page
size, partial block might keep other after-EOF pages wired and they
get reused then.  Fix it by zeroing whole part of the partial buffer
after EOF, not relying on vnode_pager_setsize().

PR: 236977
Reported by: asomers
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agobectl.8: Bump date after r345845
0mp [Wed, 3 Apr 2019 13:59:35 +0000 (13:59 +0000)]
bectl.8: Bump date after r345845

Approved by: kevans

5 years agobectl.8: Clean up & clarify the create subcommand
0mp [Wed, 3 Apr 2019 13:46:43 +0000 (13:46 +0000)]
bectl.8: Clean up & clarify the create subcommand

- Improve formatting
- Use consistent variable names
- Improve the description of the create subcommand (1)

PR: 235850 (1)
Submitted by: kevans (1)
Reported by: ler (1)
Reviewed by: kevans
Approved by: src (kevans)
Differential Revision: https://reviews.freebsd.org/D19666

5 years agoFollow the declared behaviour that specifies server string format in
ae [Wed, 3 Apr 2019 12:47:49 +0000 (12:47 +0000)]
Follow the declared behaviour that specifies server string format in
bsnmpclient(3).

snmp_parse_server() function accepts string where some fields can be
omitted: [trans::][community@][server][:port]

"trans" field can be "udp", "udp6", "dgram" and "stream".
"community" can be empty string, if it is omitted, the default value
will be used. For read_community it is "public", for write_comminity
it is "private". "server" field can be hostname, IPv4 address or IPv6
address. IPv6 address should be specified in brackets "[]".
If port is omitted, the default value "snmp" will be used for "udp"
and "udp6" transports. So, now for bsnmpget(1) and bsnmwalk(1) it is
not required to specify all fields in argument of '-s' option. E.g.

  # bsnmpget -s 127.1 sysName.0
  # bsnmpget -s "udp::127.1" sysName.0
  # bsnmpget -s "udp::public@127.1" sysName.0
  # bsnmpget -s "udp::public@127.1:161" sysName.0
  # bsnmpget -s "udp::[::1]" sysName.0
  # bsnmpget -s "udp6::[::1]" sysName.0
  # bsnmpget -s "[fe80::1%lo0]" sysName.0

PR: 236664
Reported by: olivier
MFC after: 1 month

5 years agoAdd a cv_wait to the TPM2.0 harvesting function
mw [Wed, 3 Apr 2019 08:22:58 +0000 (08:22 +0000)]
Add a cv_wait to the TPM2.0 harvesting function

Harvesting has to compete for the TPM chip with userspace.
Before this change the callout could hijack an unread buffer
causing a userspace call to the TPM to fail.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: delphij
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D19712

5 years agoAssert that q can't be NULL. 'empty' is always non-NULL when DIREMPTY
delphij [Wed, 3 Apr 2019 07:09:28 +0000 (07:09 +0000)]
Assert that q can't be NULL.  'empty' is always non-NULL when DIREMPTY
is set earlier.

MFC after: 1 month

5 years agopowerpc: Allow emulating optional FPU instructions on CPUs with an FPU
jhibbits [Wed, 3 Apr 2019 04:01:08 +0000 (04:01 +0000)]
powerpc: Allow emulating optional FPU instructions on CPUs with an FPU

The e5500 has an FPU, but lacks the optional fsqrt instruction.  This
instruction gets emulated in the kernel, but the emulation uses stale data,
from the last switch out, and does not return the result of the operation
immediately.  Fix both of these conditions by saving and restoring the FPRs
around the emulation point.

MFC after: 1 week
MFC with: r345829

5 years agoCreate kernel module to parse Veriexec manifest based on envs
mw [Wed, 3 Apr 2019 03:57:37 +0000 (03:57 +0000)]
Create kernel module to parse Veriexec manifest based on envs

The current approach of injecting manifest into mac_veriexec is to
verify the integrity of it in userspace (veriexec (8)) and pass its
entries into kernel using a char device (/dev/veriexec).
This requires verifying root partition integrity in loader,
for example by using memory disk and checking its hash.
Otherwise if rootfs is compromised an attacker could inject their own data.

This patch introduces an option to parse manifest in kernel based on envs.
The loader sets manifest path and digest.
EVENTHANDLER is used to launch the module right after the rootfs is mounted.
It has to be done this way, since one might want to verify integrity of the init file.
This means that manifest is required to be present on the root partition.
Note that the envs have to be set right before boot to make sure that no one can spoof them.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: sjg
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D19281

5 years agopowerpc: Apply r178139 from sparc64 to powerpc's fpu_sqrt
jhibbits [Wed, 3 Apr 2019 03:54:30 +0000 (03:54 +0000)]
powerpc: Apply r178139 from sparc64 to powerpc's fpu_sqrt

This fix was committed less than 2 months after the code was forked into the
powerpc kernel.  Though powerpc doesn't use quad-precision floating point,
or need it for emulation, the changes do look like correctness fixes
overall.

This was found while trying to get fsqrt emulation working on e5500, which
does have a real FPU, but lacks the fsqrt instruction.  This is not the
complete fix, the rest is to be committed separately.

MFC after: 1 week

5 years agoAdd a comment to the r345818 patch to explain why cl_refs is initialized to 2.
rmacklem [Wed, 3 Apr 2019 03:50:16 +0000 (03:50 +0000)]
Add a comment to the r345818 patch to explain why cl_refs is initialized to 2.

PR: 235582
MFC after: 2 weeks

5 years agofusefs: during ftruncate, discard cached data past truncation point
asomers [Wed, 3 Apr 2019 02:29:56 +0000 (02:29 +0000)]
fusefs: during ftruncate, discard cached data past truncation point

During truncate, fusefs was discarding entire cached blocks, but it wasn't
zeroing out the unused portion of a final partial block.  This resulted in
reads returning stale data.

PR: 233783
Reported by: fsx
Sponsored by: The FreeBSD Foundation

5 years agoFix a race in the RPCSEC_GSS server code that caused crashes.
rmacklem [Tue, 2 Apr 2019 23:51:08 +0000 (23:51 +0000)]
Fix a race in the RPCSEC_GSS server code that caused crashes.

When a new client structure was allocated, it was added to the list
so that it was visible to other threads before the expiry time was
initialized, with only a single reference count.
The caller would increment the reference count, but it was possible
for another thread to decrement the reference count to zero and free
the structure before the caller incremented the reference count.
This could occur because the expiry time was still set to zero when
the new client structure was inserted in the list and the list was
unlocked.

This patch fixes the race by initializing the reference count to two
and initializing all fields, including the expiry time, before inserting
it in the list.

Tested by: peter@ifm.liu.se
PR: 235582
MFC after: 2 weeks

5 years agoBuild NVMe CAM transport unrelated to NVMe SIM.
mav [Tue, 2 Apr 2019 20:27:56 +0000 (20:27 +0000)]
Build NVMe CAM transport unrelated to NVMe SIM.

Before this I suppose it was impossible load CAM-based NVMe as module.
Plus this appeared to be needed to build r345815 without NVMe driver.

MFC after: 2 weeks

5 years agoCorrect SMC definition in asmc(4) man page.
ygy [Tue, 2 Apr 2019 20:03:03 +0000 (20:03 +0000)]
Correct SMC definition in asmc(4) man page.

MFC after: 3 days
PR: 236954
Submitted by: fbsdbugs4@sentry.org

5 years agoMake cam_error_print() decode NVMe commands.
mav [Tue, 2 Apr 2019 19:37:52 +0000 (19:37 +0000)]
Make cam_error_print() decode NVMe commands.

MFC after: 2 weeks

5 years agofusefs: fix a just-introduced panic in readdir
asomers [Tue, 2 Apr 2019 19:20:55 +0000 (19:20 +0000)]
fusefs: fix a just-introduced panic in readdir

r345808 changed the interface of fuse_filehandle_open, but failed to update
one caller.

Sponsored by: The FreeBSD Foundation

5 years agoioat(4) should use bus_dma(9) for the operation source and destination
tychon [Tue, 2 Apr 2019 19:08:06 +0000 (19:08 +0000)]
ioat(4) should use bus_dma(9) for the operation source and destination
addresses

Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19725

5 years agoioatcontrol(8) could exercise 8k-aligned copy with page-break, crc and
tychon [Tue, 2 Apr 2019 19:06:25 +0000 (19:06 +0000)]
ioatcontrol(8) could exercise 8k-aligned copy with page-break, crc and
crc-copy modes.

Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19780

5 years agoDMAR driver assumes all physical addresses are backed by a fully
tychon [Tue, 2 Apr 2019 18:50:49 +0000 (18:50 +0000)]
DMAR driver assumes all physical addresses are backed by a fully
initialized struct vm_page.

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

5 years agocxgbe(4): Add a flag to indicate that bits in interrupt cause but not in
np [Tue, 2 Apr 2019 18:50:33 +0000 (18:50 +0000)]
cxgbe(4): Add a flag to indicate that bits in interrupt cause but not in
interrupt enable are not fatal.

The firmware sets up all the interrupt enables based on run time
configuration, which means the information in the enables is more
accurate than what's compiled into the driver.  This change also allows
the fatal bits to be updated without any changes in the driver in some
cases.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agofusefs: check return value of wait(2) in fork tests
asomers [Tue, 2 Apr 2019 18:44:01 +0000 (18:44 +0000)]
fusefs: check return value of wait(2) in fork tests

Reported by: ngie
Sponsored by: The FreeBSD Foundation

5 years agofusefs: cleanup and refactor some recent commits
asomers [Tue, 2 Apr 2019 18:09:40 +0000 (18:09 +0000)]
fusefs: cleanup and refactor some recent commits

This commit cleans up after recent commits, especially 345766, 345768, and
345781.  There is no functional change.  The most important change is to add
comments documenting why we can't send flags like O_APPEND in
FUSE_WRITE_OPEN.

PR: 236340
Sponsored by: The FreeBSD Foundation

5 years agoFix regression in top(1) after r344381, causing informational messages
dim [Tue, 2 Apr 2019 18:01:54 +0000 (18:01 +0000)]
Fix regression in top(1) after r344381, causing informational messages
to no longer be displayed.  This was because the reimplementation of
setup_buffer() did not copy the previous contents into any reallocated
buffer.

Reported by: James Wright <james.wright@jigsawdezign.com>
PR: 236947
MFC after: 3 days

5 years agoPull in r357362 from upstream clang trunk (by David Chisnall):
dim [Tue, 2 Apr 2019 17:51:28 +0000 (17:51 +0000)]
Pull in r357362 from upstream clang trunk (by David Chisnall):

  [objc-gnustep] Use .init_array not .ctors when requested.

  This doesn't make a difference most of the time but FreeBSD/ARM
  doesn't run anything in the .ctors array.

This should help with updating the libobjc2 port for armv7.

Requested by: theraven
Upstream PR: https://github.com/gnustep/libobjc2/issues/83
MFC after: 3 days

5 years agoUnify SCSI_STATUS_BUSY retry handling with other cases.
mav [Tue, 2 Apr 2019 14:46:10 +0000 (14:46 +0000)]
Unify SCSI_STATUS_BUSY retry handling with other cases.

 - Do not retry if periph was invalidated.
 - Do not decrement retry_count if already zero.
 - Report action_string when applicable.

MFC after: 2 weeks

5 years agosystat -zarc to display disk activities like -vm
mr [Tue, 2 Apr 2019 14:01:03 +0000 (14:01 +0000)]
systat -zarc to display disk activities like -vm

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Thanks to SiFive, Inc. for the board provided.

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

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

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

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

MFC after: 2 weeks

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

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

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

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

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

5 years agoRespond to ngie's comments in D19752
asomers [Mon, 1 Apr 2019 23:37:21 +0000 (23:37 +0000)]
Respond to ngie's comments in D19752

Better Makefile syntax.

Note that this commit is to the project branch, but the review concerns the
merge to head.

Sponsored by: The FreeBSD Foundation

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

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

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

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

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

5 years agofusefs: send FUSE_OPEN for every open(2) with unique credentials
asomers [Mon, 1 Apr 2019 20:42:15 +0000 (20:42 +0000)]
fusefs: send FUSE_OPEN for every open(2) with unique credentials

By default, FUSE performs authorization in the server.  That means that it's
insecure for the client to reuse FUSE file handles between different users,
groups, or processes.  Linux handles this problem by creating a different
FUSE file handle for every file descriptor.  FreeBSD can't, due to
differences in our VFS design.

This commit adds credential information to each fuse_filehandle.  During
open(2), fusefs will now only reuse a file handle if it matches the exact
same access mode, pid, uid, and gid of the calling process.

PR: 236844
Sponsored by: The FreeBSD Foundation

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

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

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

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

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

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

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

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

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

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

The old stack already does this.

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

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

Per the upstream pull-request [1]:

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

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

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

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

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

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

  This change addresses #2189.

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

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

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

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

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

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

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

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

5 years agofusefs: allow opening files O_EXEC
asomers [Mon, 1 Apr 2019 16:36:02 +0000 (16:36 +0000)]
fusefs: allow opening files O_EXEC

O_EXEC is useful for fexecve(2) and fchdir(2).  Treat it as another fufh
type alongside the existing RDONLY, WRONLY, and RDWR.  Prior to r345742 this
would've caused a memory and performance penalty.

PR: 236329
Sponsored by: The FreeBSD Foundation

5 years agofusefs: fix an inverted error check in my last commit
asomers [Mon, 1 Apr 2019 16:15:29 +0000 (16:15 +0000)]
fusefs: fix an inverted error check in my last commit

This should be merged alongside 345766

Sponsored by: The FreeBSD Foundation

5 years agofusefs: replace obsolete array idioms
asomers [Mon, 1 Apr 2019 14:23:43 +0000 (14:23 +0000)]
fusefs: replace obsolete array idioms

r345742 replaced fusefs's fufh array with a fufh list.  But it left a few
array idioms in place.  This commit replaces those idioms with more
efficient list idioms.  One location is in fuse_filehandle_close, which now
takes a pointer argument.  Three other locations are places that had to loop
over all of a vnode's fuse filehandles.

Sponsored by: The FreeBSD Foundation

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

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

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

PR: 236930
MFC after: 1 week

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

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

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

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

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

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

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

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

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

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

MFC after: 1 week