| 00228bec | 15-Sep-2019 |
Alan Somers <[email protected]> |
MFC the new fusefs driver
MFC r350665, r350990, r350992, r351039, r351042, r351061, r351066, r351113, r351560, r351961, r351963, r352021, r352025, r352230
r350665: fusefs: merge from projects/fuse2
MFC the new fusefs driver
MFC r350665, r350990, r350992, r351039, r351042, r351061, r351066, r351113, r351560, r351961, r351963, r352021, r352025, r352230
r350665: fusefs: merge from projects/fuse2
This commit imports the new fusefs driver. It raises the protocol level from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and adds many new features. New features include:
* Optional kernel-side permissions checks (-o default_permissions) * Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK * Allow interrupting FUSE operations * Support named pipes and unix-domain sockets in fusefs file systems * Forward UTIME_NOW during utimensat(2) to the daemon * kqueue support for /dev/fuse * Allow updating mounts with "mount -u" * Allow exporting fusefs file systems over NFS * Server-initiated invalidation of the name cache or data cache * Respect RLIMIT_FSIZE * Try to support servers as old as protocol 7.4
Performance enhancements include:
* Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags * Cache file attributes * Cache lookup entries, both positive and negative * Server-selectable cache modes: writethrough, writeback, or uncached * Write clustering * Readahead * Use counter(9) for statistical reporting
PR: 199934 216391 233783 234581 235773 235774 235775 PR: 236226 236231 236236 236291 236329 236381 236405 PR: 236327 236466 236472 236473 236474 236530 236557 PR: 236560 236844 237052 237181 237588 238565 Reviewed by: bcr (man pages) Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit review on project branch) Relnotes: yes Sponsored by: The FreeBSD Foundation Pull Request: https://reviews.freebsd.org/D21110
r350990: fusefs: add SVN Keywords to the test files
Reported by: SVN pre-commit hooks MFC-With: r350665 Sponsored by: The FreeBSD Foundation
r350992: fusefs: skip some tests when unsafe aio is disabled
MFC-With: r350665 Sponsored by: The FreeBSD Foundation
r351039: fusefs: fix intermittency in the default_permissions.Unlink.ok test
The test needs to expect a FUSE_FORGET operation. Most of the time the test would pass anyway, because by chance FUSE_FORGET would arrive after the unmount.
MFC-With: 350665 Sponsored by: The FreeBSD Foundation
r351042: fusefs: Fix the size of fuse_getattr_in
In FUSE protocol 7.9, the size of the FUSE_GETATTR request has increased. However, the fusefs driver is currently not sending the additional fields. In our implementation, the additional fields are always zero, so I there haven't been any test failures until now. But fusefs-lkl requires the request's length to be correct.
Fix this bug, and also enhance the test suite to catch similar bugs.
PR: 239830 MFC-With: 350665 Sponsored by: The FreeBSD Foundation
r351061: fusefs: fix the 32-bit build after 351042
Reported by: jhb MFC-With: 351042 Sponsored by: The FreeBSD Foundation
r351066: fusefs: fix conditional from r351061
The entirety of r351061 was a copy/paste error. I'm sorry I've been comitting so hastily.
Reported by: rpokala Reviewed by: rpokala MFC-With: 351061 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21265
r351113: fusefs: don't send the namespace during listextattr
The FUSE_LISTXATTR operation always returns the full list of a file's extended attributes, in all namespaces. There's no way to filter the list server-side. However, currently FreeBSD's fusefs driver sends a namespace string with the FUSE_LISTXATTR request. That behavior was probably copied from fuse_vnop_getextattr, which has an attribute name argument. It's been there ever since extended attribute support was added in r324620. This commit removes it.
Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21280
r351560: fusefs: Fix some bugs regarding the size of the LISTXATTR list
* A small error in r338152 let to the returned size always being exactly eight bytes too large.
* The FUSE_LISTXATTR operation works like Linux's listxattr(2): if the caller does not provide enough space, then the server should return ERANGE rather than return a truncated list. That's true even though in FUSE's case the kernel doesn't provide space to the client at all; it simply requests a maximum size for the list. We previously weren't handling the case where the server returns ERANGE even though the kernel requested as much size as the server had told us it needs; that can happen due to a race.
* We also need to ensure that a pathological server that always returns ERANGE no matter what size we request in FUSE_LISTXATTR won't cause an infinite loop in the kernel. As of this commit, it will instead cause an infinite loop that exits and enters the kernel on each iteration, allowing signals to be processed.
Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21287
r351961: Coverity fixes in fusefs(5)
CID 1404532 fixes a signed vs unsigned comparison error in fuse_vnop_bmap. It could potentially have resulted in VOP_BMAP reporting too many consecutive blocks.
CID 1404364 is much worse. It was an array access by an untrusted, user-provided variable. It could potentially have resulted in a malicious file system crashing the kernel or worse.
Reported by: Coverity Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21466
r351963: fusefs: coverity cleanup in the tests
Address the following defects reported by Coverity:
* Structurally dead code (CID 1404366): set m_quit before FAIL, not after
* Unchecked return value of sysctlbyname (CID 1404321)
* Unchecked return value of stat(2) (CID 1404471)
* Unchecked return value of open(2) (CID 1404402, 1404529)
* Unchecked return value of dup(2) (CID 1404478)
* Buffer overflows. These are all false positives caused by the fact that Coverity thinks I'm using a buffer to store strings, when in fact I'm really just using it to store a byte array that happens to be initialized with a string. I'm changing the type from char to uint8_t in the hopes that it will placate Coverity. (CID 1404338, 1404350, 1404367, 1404376, 1404379, 1404381, 1404388, 1404403, 1404425, 1404433, 1404434, 1404474, 1404480, 1404484, 1404503, 1404505)
* False positive file descriptor leak. I'm going to try to fix this with Coverity modeling, but I'll also change an EXPECT to ASSERT so we don't perform meaningless assertions after the failure. (CID 1404320, 1404324, 1404440, 1404445).
* Unannotated file descriptor leak. This will be followed up by a Coverity modeling change. (CID 1404326, 1404334, 1404336, 1404357, 1404361, 1404372, 1404391, 1404395, 1404409, 1404430, 1404448, 1404451, 1404455, 1404457, 1404458, 1404460)
* Uninitialized variables in C++ constructors (CID 1404327, 1404346). In the case of m_maxphys, this actually led to part of the FUSE_INIT's response being set to stack garbage during the WriteCluster::clustering test.
* Uninitialized sun_len field in struct sockaddr_un (CID 1404330, 1404371, 1404429).
Reported by: Coverity Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21457
r352021: fusefs: suppress some Coverity resource leak CIDs in the tests
The fusefs tests deliberately leak file descriptors. To do otherwise would add extra complications to the tests' mock FUSE server. This annotation should hopefully convince Coverity to shut up about the leaks.
Reviewed by: uqs Sponsored by: The FreeBSD Foundation
r352025: mount_fusefs: fix a segfault on memory allocation failure
Reported by: Coverity Coverity CID: 1354188 Sponsored by: The FreeBSD Foundation
r352230: fusefs: Fix iosize for FUSE_WRITE in 7.8 compat mode
When communicating with a FUSE server that implements version 7.8 (or older) of the FUSE protocol, the FUSE_WRITE request structure is 16 bytes shorter than normal. The protocol version check wasn't applied universally, leading to an extra 16 bytes being sent to such servers. The extra bytes were allocated and bzero()d, so there was no information disclosure.
Reviewed by: emaste MFC-With: r350665 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21557
show more ...
|
| b7588f70 | 03-Jun-2019 |
John Baldwin <[email protected]> |
MFC 348206,348231,348454: GELI crypto deprecation warnings.
348206: Add deprecation warnings for weaker algorithms to geli(4).
- Triple DES has been formally deprecated in Kerberos (RFC 8429) and
MFC 348206,348231,348454: GELI crypto deprecation warnings.
348206: Add deprecation warnings for weaker algorithms to geli(4).
- Triple DES has been formally deprecated in Kerberos (RFC 8429) and is soon to be deprecated in IPsec (RFC 8221). - Blowfish is deprecated. FreeBSD doesn't support its successor (Twofish). - MD5 is generally considered a weak digest that has known attacks.
geli refuses to create new volumes using these algorithms via 'geli init'. It also warns when attaching to existing volumes or creating temporary volumes via 'geli onetime' . The plan is to fully remove support for these algorithms in FreeBSD 13.
Note that none of these algorithms have ever been the default algorithm used by geli(8). Users would have had to explicitly select these algorithms when creating volumes in the past.
348231: Correct the argument passed to g_eli_algo2str()
348454: Remove tests for the deprecated algorithms in r348206
The tests are failing because the return value and output have changed, but before test code structure adjusted, removing these test cases help people be able to focus on more important cases.
Relnotes: yes
show more ...
|
| 51850e1e | 23-May-2019 |
John Baldwin <[email protected]> |
MFC 346617: Test the AES-CCM test vectors from the NIST Known Answer Tests.
The CCM test vectors use a slightly different file format in that there are global key-value pairs as well as section key-
MFC 346617: Test the AES-CCM test vectors from the NIST Known Answer Tests.
The CCM test vectors use a slightly different file format in that there are global key-value pairs as well as section key-value pairs that need to be used in each test. In addition, the sections can set multiple key-value pairs in the section name. The CCM KAT parser class is an iterator that returns a dictionary once per test where the dictionary contains all of the relevant key-value pairs for a given test (global, section name, section, test-specific).
Note that all of the CCM decrypt tests use nonce and tag lengths that are not supported by OCF (OCF only supports a 12 byte nonce and 16 byte tag), so none of the decryption vectors are actually tested.
show more ...
|
| 8a478e8e | 23-May-2019 |
John Baldwin <[email protected]> |
MFC 346614: Skip tests with missing test vectors instead of failing.
This copes more gracefully when older version of the nist-kat package are intalled that don't have newer test vectors such as CCM
MFC 346614: Skip tests with missing test vectors instead of failing.
This copes more gracefully when older version of the nist-kat package are intalled that don't have newer test vectors such as CCM or plain SHA.
If the nist-kat package is not installed at all, this still fails with an error.
show more ...
|
| e787ffab | 23-May-2019 |
Enji Cooper <[email protected]> |
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576:
r345203:
Initial googlemock/googletest integration into the build/FreeBSD test suite
This initial integration t
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576:
r345203:
Initial googlemock/googletest integration into the build/FreeBSD test suite
This initial integration takes googlemock/googletest release 1.8.1, integrates the library, tests, and sample unit tests into the build.
googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`. `MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when built with a C++11 capable toolchain.
Google tests can be specified via the `GTESTS` variable, which, in comparison with the other test drivers, is more simplified/streamlined, as Googletest only supports C++ tests; not raw C or shell tests (C tests can be written in C++ using the standard embedding methods).
No dependent libraries are assumed for the tests. One must specify `gmock`, `gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.
More information about googlemock and googletest can be found on the Googletest [project page](https://github.com/google/googletest), and the [GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md) and [GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs) docs.
These tests are originally integrated into the build as plain driver tests, but will be natively integrated into Kyua in a later version.
Known issues/Errata: * [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)
r345205:
Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite
This change integrates the unit tests for zfsd into the test suite using the integration method described in r345203.
This change removes the `LOCALBASE` includes added for the port version of googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS` defines, which are included in the `GTEST_CXXFLAGS` variable, as part of r345203.
r345353 (by asomers):
googletest: backport GTEST_SKIP to googletest 1.8.1
This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and 59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to our included version of googletest, which is based on 1.8.1. It adds the GTEST_SKIP feature, which is very useful for a project like FreeBSD where some tests depend on particular system configurations.
Obtained from: github.com/google/googletest
r345645:
Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS
This makes it easier for googletest users to leverage googletest, instead of forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in unnecessary duplication).
I will be following this up with a more proper fix in src.libnames.mk, as src.libnames.mk should be automatically adding this directory to CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result in mismatches between base-provided private library's and ports-provided library's headers.
While here, tweak the comment to clarify what the intent is behind spamming CXXFLAGS.
r345708:
Standardize `-std=c++* as `CXXSTD`
CXXSTD was added as the C++ analogue to CSTD.
CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`, otherwise for older versions of g++.
This change standardizes the CXXSTD variable, originally added to googletest.test.inc.mk as part of r345203.
As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.
Notes:
This value is not sanity checked in bsd.sys.mk, however, given the two most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is likely to work with both toolchains. This method will be refined in the future to support more variants of C++, as not all versions of clang++ and g++ (for instance) support C++14, C++17, etc.
Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD. Example:
Before this commit: ``` CXXFLAGS+= -std=c++14 ```
After this commit: ``` CXXSTD= c++14 ```
Relnotes: yes Tested with: make tinderbox
r345709:
Allow users to override CSTD/CXXSTD on a per-prog basis
The current logic for CSTD/CXXSTD requires homogenity as far as the supported C/C++ standards, which is a sensible default. However, when dealing with differing versions of C++, some code may compile with C++11, but not C++17 (for instance). So in order to avoid having people convert over their code to the new standard, give the users the ability to specify the standard on a per-program basis.
This will allow a user to override the supporting standard for a set of programs, mixing C++11 with C++14 (for instance).
Approved by: emaste (mentor)
r345735:
Allow programs to set `NO_SHARED` on a per-PROG basis
This is particularly useful when installing programs for tests that need to be linked statically, e.g., mini-me from capsicum-test, which is linked statically to avoid the dynamic library lookup in the upstream project.
r345770:
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 <[email protected]> ```
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
r346574:
Rework CXXSTD setting via r345708
This change allows the user to once again override the C++ standard, restoring high-level pre-r345708 behavior.
This also unbreaks building lib/ofed/libibnetdisc/Makefile with a non-C++11 capable compiler, e.g., g++ 4.2.1, as the library supported being built with older C++ standards.
r346576:
Fix up CXXSTD support originally added in r345708
r345708 worked for the base system, but unfortunately, caused a lot of disruption for third-party packages that relied on C++, since bsd.sys.mk is used by applications outside the base system. The defaults picked didn't match the compiler's defaults and broke some builds that didn't specify a standard, as well as some that overrode the value by setting `-std=gnu++14` (for example) manually.
This change takes a more relaxed approach to appending `-std=${CXXSTD}` to CXXFLAGS, by only doing so when the value is specified, as opposed to overriding the standard set by an end-user. This avoids the need for having to bake NOP default into bsd.sys.mk for supported compiler-toolchain versions.
In order to make this change possible, add CXXSTD to Makefile snippets which relied on the default value (c++11) added in r345708.
show more ...
|