diff --git UPDATING UPDATING index 1662c50c8b2e..887efb8dcd9f 100644 --- UPDATING +++ UPDATING @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190320: + The fuse(4) module has been renamed to fusefs(4) for consistency with + other filesystems. You should update any kld_load="fuse" entries in + /etc/rc.conf, fuse_load="YES" entries in /boot/loader.conf, and + "options FUSE" enties in kernel config files. + 20190304: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 8.0.0. Please see the 20141231 entry below for information about diff --git cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c index 9dd147b40bbe..ad483ee99629 100644 --- cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c +++ cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c @@ -35,7 +35,8 @@ int main(int argc, char **argv) { for (;;) { - (void) __syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678); + (void) __syscall(SYS_mmap, NULL, (size_t)1, 2, 3, -1, + (off_t)0x12345678); } return (0); diff --git contrib/googletest/googletest/CMakeLists.txt contrib/googletest/googletest/CMakeLists.txt index 9ee79408c277..e4e99e836fc1 100644 --- contrib/googletest/googletest/CMakeLists.txt +++ contrib/googletest/googletest/CMakeLists.txt @@ -217,6 +217,7 @@ if (gtest_build_tests) test/gtest-typed-test2_test.cc) cxx_test(gtest_unittest gtest_main) cxx_test(gtest-unittest-api_test gtest) + cxx_test(gtest_skip_test gtest_main) ############################################################ # C++ tests built with non-standard compiler flags. diff --git contrib/googletest/googletest/include/gtest/gtest-test-part.h contrib/googletest/googletest/include/gtest/gtest-test-part.h index 1c7b89e08796..7b30aff67a3f 100644 --- contrib/googletest/googletest/include/gtest/gtest-test-part.h +++ contrib/googletest/googletest/include/gtest/gtest-test-part.h @@ -53,7 +53,8 @@ class GTEST_API_ TestPartResult { enum Type { kSuccess, // Succeeded. kNonFatalFailure, // Failed but the test can continue. - kFatalFailure // Failed and the test should be terminated. + kFatalFailure, // Failed and the test should be terminated. + kSkip // Skipped. }; // C'tor. TestPartResult does NOT have a default constructor. @@ -89,18 +90,21 @@ class GTEST_API_ TestPartResult { // Gets the message associated with the test part. const char* message() const { return message_.c_str(); } + // Returns true iff the test part was skipped. + bool skipped() const { return type_ == kSkip; } + // Returns true iff the test part passed. bool passed() const { return type_ == kSuccess; } - // Returns true iff the test part failed. - bool failed() const { return type_ != kSuccess; } - // Returns true iff the test part non-fatally failed. bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } + // Returns true iff the test part failed. + bool failed() const { return fatally_failed() || nonfatally_failed(); } + private: Type type_; diff --git contrib/googletest/googletest/include/gtest/gtest.h contrib/googletest/googletest/include/gtest/gtest.h index 5df4b0a3a712..89214183d257 100644 --- contrib/googletest/googletest/include/gtest/gtest.h +++ contrib/googletest/googletest/include/gtest/gtest.h @@ -440,6 +440,9 @@ class GTEST_API_ Test { // Returns true iff the current test has a non-fatal failure. static bool HasNonfatalFailure(); + // Returns true iff the current test was skipped. + static bool IsSkipped(); + // Returns true iff the current test has a (either fatal or // non-fatal) failure. static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } @@ -574,7 +577,10 @@ class GTEST_API_ TestResult { int test_property_count() const; // Returns true iff the test passed (i.e. no test part failed). - bool Passed() const { return !Failed(); } + bool Passed() const { return !Skipped() && !Failed(); } + + // Returns true iff the test was skipped. + bool Skipped() const; // Returns true iff the test failed. bool Failed() const; @@ -854,6 +860,9 @@ class GTEST_API_ TestCase { // Gets the number of successful tests in this test case. int successful_test_count() const; + // Gets the number of skipped tests in this test case. + int skipped_test_count() const; + // Gets the number of failed tests in this test case. int failed_test_count() const; @@ -936,6 +945,11 @@ class GTEST_API_ TestCase { return test_info->should_run() && test_info->result()->Passed(); } + // Returns true iff test skipped. + static bool TestSkipped(const TestInfo* test_info) { + return test_info->should_run() && test_info->result()->Skipped(); + } + // Returns true iff test failed. static bool TestFailed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Failed(); @@ -1258,6 +1272,9 @@ class GTEST_API_ UnitTest { // Gets the number of successful tests. int successful_test_count() const; + // Gets the number of skipped tests. + int skipped_test_count() const; + // Gets the number of failed tests. int failed_test_count() const; @@ -1835,6 +1852,11 @@ class TestWithParam : public Test, public WithParamInterface<T> { // Macros for indicating success/failure in test code. +// Skips test in runtime. +// Skipping test aborts current function. +// Skipped tests are neither successful nor failed. +#define GTEST_SKIP() GTEST_SKIP_("Skipped") + // ADD_FAILURE unconditionally adds a failure to the current test. // SUCCEED generates a success - it doesn't automatically make the // current test successful, as a test is only successful when it has diff --git contrib/googletest/googletest/include/gtest/internal/gtest-internal.h contrib/googletest/googletest/include/gtest/internal/gtest-internal.h index b762f61fc53c..380a11c4515d 100644 --- contrib/googletest/googletest/include/gtest/internal/gtest-internal.h +++ contrib/googletest/googletest/include/gtest/internal/gtest-internal.h @@ -1208,7 +1208,10 @@ class NativeArray { #define GTEST_SUCCESS_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) -// Suppress MSVC warning 4702 (unreachable code) for the code following +#define GTEST_SKIP_(message) \ + return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip) + +// Suppress MSVC warning 4072 (unreachable code) for the code following // statement if it returns or throws (or doesn't return or throw in some // situations). #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ diff --git contrib/googletest/googletest/src/gtest-internal-inl.h contrib/googletest/googletest/src/gtest-internal-inl.h index 479004149b48..f79b1ad0420d 100644 --- contrib/googletest/googletest/src/gtest-internal-inl.h +++ contrib/googletest/googletest/src/gtest-internal-inl.h @@ -544,6 +544,9 @@ class GTEST_API_ UnitTestImpl { // Gets the number of successful tests. int successful_test_count() const; + // Gets the number of skipped tests. + int skipped_test_count() const; + // Gets the number of failed tests. int failed_test_count() const; diff --git contrib/googletest/googletest/src/gtest-test-part.cc contrib/googletest/googletest/src/gtest-test-part.cc index c88860d92385..2855e3e95e6e 100644 --- contrib/googletest/googletest/src/gtest-test-part.cc +++ contrib/googletest/googletest/src/gtest-test-part.cc @@ -47,12 +47,16 @@ std::string TestPartResult::ExtractSummary(const char* message) { // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os - << result.file_name() << ":" << result.line_number() << ": " - << (result.type() == TestPartResult::kSuccess ? "Success" : - result.type() == TestPartResult::kFatalFailure ? "Fatal failure" : - "Non-fatal failure") << ":\n" - << result.message() << std::endl; + return os << result.file_name() << ":" << result.line_number() << ": " + << (result.type() == TestPartResult::kSuccess + ? "Success" + : result.type() == TestPartResult::kSkip + ? "Skipped" + : result.type() == TestPartResult::kFatalFailure + ? "Fatal failure" + : "Non-fatal failure") + << ":\n" + << result.message() << std::endl; } // Appends a TestPartResult to the array. diff --git contrib/googletest/googletest/src/gtest.cc contrib/googletest/googletest/src/gtest.cc index 96b07c68abb0..e8864d53c203 100644 --- contrib/googletest/googletest/src/gtest.cc +++ contrib/googletest/googletest/src/gtest.cc @@ -796,6 +796,11 @@ int UnitTestImpl::successful_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count); } +// Gets the number of skipped tests. +int UnitTestImpl::skipped_test_count() const { + return SumOverTestCaseList(test_cases_, &TestCase::skipped_test_count); +} + // Gets the number of failed tests. int UnitTestImpl::failed_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count); @@ -2207,6 +2212,16 @@ void TestResult::Clear() { elapsed_time_ = 0; } +// Returns true off the test part was skipped. +static bool TestPartSkipped(const TestPartResult& result) { + return result.skipped(); +} + +// Returns true iff the test was skipped. +bool TestResult::Skipped() const { + return !Failed() && CountIf(test_part_results_, TestPartSkipped) > 0; +} + // Returns true iff the test failed. bool TestResult::Failed() const { for (int i = 0; i < total_part_count(); ++i) { @@ -2511,8 +2526,9 @@ void Test::Run() { internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); - // We will run the test only if SetUp() was successful. - if (!HasFatalFailure()) { + // We will run the test only if SetUp() was successful and didn't call + // GTEST_SKIP(). + if (!HasFatalFailure() && !IsSkipped()) { impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &Test::TestBody, "the test body"); @@ -2537,6 +2553,11 @@ bool Test::HasNonfatalFailure() { HasNonfatalFailure(); } +// Returns true iff the current test was skipped. +bool Test::IsSkipped() { + return internal::GetUnitTestImpl()->current_test_result()->Skipped(); +} + // class TestInfo // Constructs a TestInfo object. It assumes ownership of the test factory @@ -2685,9 +2706,10 @@ void TestInfo::Run() { factory_, &internal::TestFactoryBase::CreateTest, "the test fixture's constructor"); - // Runs the test if the constructor didn't generate a fatal failure. + // Runs the test if the constructor didn't generate a fatal failure or invoke + // GTEST_SKIP(). // Note that the object will not be null - if (!Test::HasFatalFailure()) { + if (!Test::HasFatalFailure() && !Test::IsSkipped()) { // This doesn't throw as all user code that can throw are wrapped into // exception handling code. test->Run(); @@ -2715,6 +2737,11 @@ int TestCase::successful_test_count() const { return CountIf(test_info_list_, TestPassed); } +// Gets the number of successful tests in this test case. +int TestCase::skipped_test_count() const { + return CountIf(test_info_list_, TestSkipped); +} + // Gets the number of failed tests in this test case. int TestCase::failed_test_count() const { return CountIf(test_info_list_, TestFailed); @@ -2866,6 +2893,8 @@ static std::string FormatTestCaseCount(int test_case_count) { // between the two when viewing the test result. static const char * TestPartResultTypeToString(TestPartResult::Type type) { switch (type) { + case TestPartResult::kSkip: + return "Skipped"; case TestPartResult::kSuccess: return "Success"; @@ -3119,6 +3148,7 @@ class PrettyUnitTestResultPrinter : public TestEventListener { private: static void PrintFailedTests(const UnitTest& unit_test); + static void PrintSkippedTests(const UnitTest& unit_test); }; // Fired before each iteration of tests starts. @@ -3187,18 +3217,25 @@ void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) { // Called after an assertion failure. void PrettyUnitTestResultPrinter::OnTestPartResult( const TestPartResult& result) { - // If the test part succeeded, we don't need to do anything. - if (result.type() == TestPartResult::kSuccess) - return; - - // Print failure message from the assertion (e.g. expected this and got that). - PrintTestPartResult(result); - fflush(stdout); + switch (result.type()) { + // If the test part succeeded, or was skipped, + // we don't need to do anything. + case TestPartResult::kSkip: + case TestPartResult::kSuccess: + return; + default: + // Print failure message from the assertion + // (e.g. expected this and got that). + PrintTestPartResult(result); + fflush(stdout); + } } void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { if (test_info.result()->Passed()) { ColoredPrintf(COLOR_GREEN, "[ OK ] "); + } else if (test_info.result()->Skipped()) { + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); } else { ColoredPrintf(COLOR_RED, "[ FAILED ] "); } @@ -3248,7 +3285,7 @@ void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) { } for (int j = 0; j < test_case.total_test_count(); ++j) { const TestInfo& test_info = *test_case.GetTestInfo(j); - if (!test_info.should_run() || test_info.result()->Passed()) { + if (!test_info.should_run() || !test_info.result()->Failed()) { continue; } ColoredPrintf(COLOR_RED, "[ FAILED ] "); @@ -3259,6 +3296,30 @@ void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) { } } +// Internal helper for printing the list of skipped tests. +void PrettyUnitTestResultPrinter::PrintSkippedTests(const UnitTest& unit_test) { + const int skipped_test_count = unit_test.skipped_test_count(); + if (skipped_test_count == 0) { + return; + } + + for (int i = 0; i < unit_test.total_test_case_count(); ++i) { + const TestCase& test_case = *unit_test.GetTestCase(i); + if (!test_case.should_run() || (test_case.skipped_test_count() == 0)) { + continue; + } + for (int j = 0; j < test_case.total_test_count(); ++j) { + const TestInfo& test_info = *test_case.GetTestInfo(j); + if (!test_info.should_run() || !test_info.result()->Skipped()) { + continue; + } + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); + printf("%s.%s", test_case.name(), test_info.name()); + printf("\n"); + } + } +} + void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, int /*iteration*/) { ColoredPrintf(COLOR_GREEN, "[==========] "); @@ -3273,6 +3334,13 @@ void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); + const int skipped_test_count = unit_test.skipped_test_count(); + if (skipped_test_count > 0) { + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); + printf("%s, listed below:\n", FormatTestCount(skipped_test_count).c_str()); + PrintSkippedTests(unit_test); + } + int num_failures = unit_test.failed_test_count(); if (!unit_test.Passed()) { const int failed_test_count = unit_test.failed_test_count(); @@ -4540,6 +4608,11 @@ int UnitTest::successful_test_count() const { return impl()->successful_test_count(); } +// Gets the number of skipped tests. +int UnitTest::skipped_test_count() const { + return impl()->skipped_test_count(); +} + // Gets the number of failed tests. int UnitTest::failed_test_count() const { return impl()->failed_test_count(); } @@ -4660,7 +4733,8 @@ void UnitTest::AddTestPartResult( impl_->GetTestPartResultReporterForCurrentThread()-> ReportTestPartResult(result); - if (result_type != TestPartResult::kSuccess) { + if (result_type != TestPartResult::kSuccess && + result_type != TestPartResult::kSkip) { // gtest_break_on_failure takes precedence over // gtest_throw_on_failure. This allows a user to set the latter // in the code (perhaps in order to use Google Test assertions diff --git contrib/googletest/googletest/test/googletest-test-part-test.cc contrib/googletest/googletest/test/googletest-test-part-test.cc index cd2d6f9e858f..8c9459e18aa7 100644 --- contrib/googletest/googletest/test/googletest-test-part-test.cc +++ contrib/googletest/googletest/test/googletest-test-part-test.cc @@ -46,9 +46,10 @@ class TestPartResultTest : public Test { TestPartResultTest() : r1_(TestPartResult::kSuccess, "foo/bar.cc", 10, "Success!"), r2_(TestPartResult::kNonFatalFailure, "foo/bar.cc", -1, "Failure!"), - r3_(TestPartResult::kFatalFailure, NULL, -1, "Failure!") {} + r3_(TestPartResult::kFatalFailure, nullptr, -1, "Failure!"), + r4_(TestPartResult::kSkip, "foo/bar.cc", 2, "Skipped!") {} - TestPartResult r1_, r2_, r3_; + TestPartResult r1_, r2_, r3_, r4_; }; @@ -79,6 +80,7 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_FALSE(success.failed()); EXPECT_FALSE(success.nonfatally_failed()); EXPECT_FALSE(success.fatally_failed()); + EXPECT_FALSE(success.skipped()); const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure, "file.cc", @@ -88,6 +90,7 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_TRUE(nonfatal_failure.failed()); EXPECT_TRUE(nonfatal_failure.nonfatally_failed()); EXPECT_FALSE(nonfatal_failure.fatally_failed()); + EXPECT_FALSE(nonfatal_failure.skipped()); const TestPartResult fatal_failure(TestPartResult::kFatalFailure, "file.cc", @@ -97,6 +100,14 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_TRUE(fatal_failure.failed()); EXPECT_FALSE(fatal_failure.nonfatally_failed()); EXPECT_TRUE(fatal_failure.fatally_failed()); + EXPECT_FALSE(fatal_failure.skipped()); + + const TestPartResult skip(TestPartResult::kSkip, "file.cc", 42, "message"); + EXPECT_FALSE(skip.passed()); + EXPECT_FALSE(skip.failed()); + EXPECT_FALSE(skip.nonfatally_failed()); + EXPECT_FALSE(skip.fatally_failed()); + EXPECT_TRUE(skip.skipped()); } // Tests TestPartResult::type(). @@ -104,23 +115,27 @@ TEST_F(TestPartResultTest, type) { EXPECT_EQ(TestPartResult::kSuccess, r1_.type()); EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type()); EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type()); + EXPECT_EQ(TestPartResult::kSkip, r4_.type()); } // Tests TestPartResult::file_name(). TEST_F(TestPartResultTest, file_name) { EXPECT_STREQ("foo/bar.cc", r1_.file_name()); EXPECT_STREQ(NULL, r3_.file_name()); + EXPECT_STREQ("foo/bar.cc", r4_.file_name()); } // Tests TestPartResult::line_number(). TEST_F(TestPartResultTest, line_number) { EXPECT_EQ(10, r1_.line_number()); EXPECT_EQ(-1, r2_.line_number()); + EXPECT_EQ(2, r4_.line_number()); } // Tests TestPartResult::message(). TEST_F(TestPartResultTest, message) { EXPECT_STREQ("Success!", r1_.message()); + EXPECT_STREQ("Skipped!", r4_.message()); } // Tests TestPartResult::passed(). @@ -128,6 +143,7 @@ TEST_F(TestPartResultTest, Passed) { EXPECT_TRUE(r1_.passed()); EXPECT_FALSE(r2_.passed()); EXPECT_FALSE(r3_.passed()); + EXPECT_FALSE(r4_.passed()); } // Tests TestPartResult::failed(). @@ -135,6 +151,15 @@ TEST_F(TestPartResultTest, Failed) { EXPECT_FALSE(r1_.failed()); EXPECT_TRUE(r2_.failed()); EXPECT_TRUE(r3_.failed()); + EXPECT_FALSE(r4_.failed()); +} + +// Tests TestPartResult::failed(). +TEST_F(TestPartResultTest, Skipped) { + EXPECT_FALSE(r1_.skipped()); + EXPECT_FALSE(r2_.skipped()); + EXPECT_FALSE(r3_.skipped()); + EXPECT_TRUE(r4_.skipped()); } // Tests TestPartResult::fatally_failed(). @@ -142,6 +167,7 @@ TEST_F(TestPartResultTest, FatallyFailed) { EXPECT_FALSE(r1_.fatally_failed()); EXPECT_FALSE(r2_.fatally_failed()); EXPECT_TRUE(r3_.fatally_failed()); + EXPECT_FALSE(r4_.fatally_failed()); } // Tests TestPartResult::nonfatally_failed(). @@ -149,6 +175,7 @@ TEST_F(TestPartResultTest, NonfatallyFailed) { EXPECT_FALSE(r1_.nonfatally_failed()); EXPECT_TRUE(r2_.nonfatally_failed()); EXPECT_FALSE(r3_.nonfatally_failed()); + EXPECT_FALSE(r4_.nonfatally_failed()); } // Tests the TestPartResultArray class. diff --git contrib/googletest/googletest/test/gtest_all_test.cc contrib/googletest/googletest/test/gtest_all_test.cc index e61e36b1dfe8..f948a104ff0b 100644 --- contrib/googletest/googletest/test/gtest_all_test.cc +++ contrib/googletest/googletest/test/gtest_all_test.cc @@ -37,10 +37,11 @@ #include "test/googletest-message-test.cc" #include "test/googletest-options-test.cc" #include "test/googletest-port-test.cc" -#include "test/gtest_pred_impl_unittest.cc" -#include "test/gtest_prod_test.cc" #include "test/googletest-test-part-test.cc" -#include "test/gtest-typed-test_test.cc" #include "test/gtest-typed-test2_test.cc" +#include "test/gtest-typed-test_test.cc" +#include "test/gtest_pred_impl_unittest.cc" +#include "test/gtest_prod_test.cc" +#include "test/gtest_skip_test.cc" #include "test/gtest_unittest.cc" #include "test/production.cc" diff --git contrib/googletest/googletest/test/gtest_skip_test.cc contrib/googletest/googletest/test/gtest_skip_test.cc new file mode 100644 index 000000000000..717e105e2e07 --- /dev/null +++ contrib/googletest/googletest/test/gtest_skip_test.cc @@ -0,0 +1,55 @@ +// Copyright 2008 Google Inc. +// All Rights Reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: arseny.aprelev@gmail.com (Arseny Aprelev) +// + +#include "gtest/gtest.h" + +using ::testing::Test; + +TEST(SkipTest, DoesSkip) { + GTEST_SKIP(); + EXPECT_EQ(0, 1); +} + +class Fixture : public Test { + protected: + void SetUp() override { + GTEST_SKIP() << "skipping all tests for this fixture"; + } +}; + +TEST_F(Fixture, SkipsOneTest) { + EXPECT_EQ(5, 7); +} + +TEST_F(Fixture, SkipsAnotherTest) { + EXPECT_EQ(99, 100); +} diff --git contrib/llvm/tools/clang/lib/Basic/Version.cpp contrib/llvm/tools/clang/lib/Basic/Version.cpp index 1d594b974189..a15c60e0f55c 100644 --- contrib/llvm/tools/clang/lib/Basic/Version.cpp +++ contrib/llvm/tools/clang/lib/Basic/Version.cpp @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_80/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); diff --git contrib/llvm/tools/lld/ELF/Config.h contrib/llvm/tools/lld/ELF/Config.h index fb29396926bf..e8bb6bf70ee0 100644 --- contrib/llvm/tools/lld/ELF/Config.h +++ contrib/llvm/tools/lld/ELF/Config.h @@ -122,6 +122,7 @@ struct Configuration { uint64_t> CallGraphProfile; bool AllowMultipleDefinition; + bool AllowShlibUndefined; bool AndroidPackDynRelocs; bool ARMHasBlx = false; bool ARMHasMovtMovw = false; diff --git contrib/llvm/tools/lld/ELF/Driver.cpp contrib/llvm/tools/lld/ELF/Driver.cpp index 407f1734f143..3e565bcb8732 100644 --- contrib/llvm/tools/lld/ELF/Driver.cpp +++ contrib/llvm/tools/lld/ELF/Driver.cpp @@ -758,6 +758,9 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Args.hasFlag(OPT_allow_multiple_definition, OPT_no_allow_multiple_definition, false) || hasZOption(Args, "muldefs"); + Config->AllowShlibUndefined = + Args.hasFlag(OPT_allow_shlib_undefined, OPT_no_allow_shlib_undefined, + Args.hasArg(OPT_shared)); Config->AuxiliaryList = args::getStrings(Args, OPT_auxiliary); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); diff --git contrib/llvm/tools/lld/ELF/InputFiles.cpp contrib/llvm/tools/lld/ELF/InputFiles.cpp index bc7e61072e64..c5922d3155d9 100644 --- contrib/llvm/tools/lld/ELF/InputFiles.cpp +++ contrib/llvm/tools/lld/ELF/InputFiles.cpp @@ -865,7 +865,7 @@ SharedFile<ELFT>::SharedFile(MemoryBufferRef M, StringRef DefaultSoName) // Partially parse the shared object file so that we can call // getSoName on this object. -template <class ELFT> void SharedFile<ELFT>::parseSoName() { +template <class ELFT> void SharedFile<ELFT>::parseDynamic() { const Elf_Shdr *DynamicSec = nullptr; const ELFFile<ELFT> Obj = this->getObj(); ArrayRef<Elf_Shdr> Sections = CHECK(Obj.sections(), this); @@ -902,12 +902,16 @@ template <class ELFT> void SharedFile<ELFT>::parseSoName() { ArrayRef<Elf_Dyn> Arr = CHECK(Obj.template getSectionContentsAsArray<Elf_Dyn>(DynamicSec), this); for (const Elf_Dyn &Dyn : Arr) { - if (Dyn.d_tag == DT_SONAME) { + if (Dyn.d_tag == DT_NEEDED) { + uint64_t Val = Dyn.getVal(); + if (Val >= this->StringTable.size()) + fatal(toString(this) + ": invalid DT_NEEDED entry"); + DtNeeded.push_back(this->StringTable.data() + Val); + } else if (Dyn.d_tag == DT_SONAME) { uint64_t Val = Dyn.getVal(); if (Val >= this->StringTable.size()) fatal(toString(this) + ": invalid DT_SONAME entry"); SoName = this->StringTable.data() + Val; - return; } } } @@ -975,7 +979,7 @@ uint32_t SharedFile<ELFT>::getAlignment(ArrayRef<Elf_Shdr> Sections, return (Ret > UINT32_MAX) ? 0 : Ret; } -// Fully parse the shared object file. This must be called after parseSoName(). +// Fully parse the shared object file. This must be called after parseDynamic(). // // This function parses symbol versions. If a DSO has version information, // the file has a ".gnu.version_d" section which contains symbol version diff --git contrib/llvm/tools/lld/ELF/InputFiles.h contrib/llvm/tools/lld/ELF/InputFiles.h index d7cbbc67a365..db9097fb868e 100644 --- contrib/llvm/tools/lld/ELF/InputFiles.h +++ contrib/llvm/tools/lld/ELF/InputFiles.h @@ -323,6 +323,7 @@ template <class ELFT> class SharedFile : public ELFFileBase<ELFT> { public: std::vector<const Elf_Verdef *> Verdefs; + std::vector<StringRef> DtNeeded; std::string SoName; static bool classof(const InputFile *F) { @@ -331,7 +332,7 @@ public: SharedFile(MemoryBufferRef M, StringRef DefaultSoName); - void parseSoName(); + void parseDynamic(); void parseRest(); uint32_t getAlignment(ArrayRef<Elf_Shdr> Sections, const Elf_Sym &Sym); std::vector<const Elf_Verdef *> parseVerdefs(); @@ -349,6 +350,9 @@ public: // data structures in the output file. std::map<const Elf_Verdef *, NeededVer> VerdefMap; + // Used for --no-allow-shlib-undefined. + bool AllNeededIsKnown; + // Used for --as-needed bool IsNeeded; }; diff --git contrib/llvm/tools/lld/ELF/Options.td contrib/llvm/tools/lld/ELF/Options.td index 439fe341644c..3a19b230780a 100644 --- contrib/llvm/tools/lld/ELF/Options.td +++ contrib/llvm/tools/lld/ELF/Options.td @@ -63,6 +63,10 @@ defm allow_multiple_definition: B<"allow-multiple-definition", "Allow multiple definitions", "Do not allow multiple definitions (default)">; +defm allow_shlib_undefined: B<"allow-shlib-undefined", + "Allow unresolved references in shared libraries (default when linking a shared library)", + "Do not allow unresolved references in shared libraries (default when linking an executable)">; + defm apply_dynamic_relocs: B<"apply-dynamic-relocs", "Apply link-time values for dynamic relocations", "Do not apply link-time values for dynamic relocations (default)">; @@ -492,12 +496,10 @@ def plugin_opt_thinlto: J<"plugin-opt=thinlto">; def plugin_opt_slash: J<"plugin-opt=/">; // Options listed below are silently ignored for now for compatibility. -def: F<"allow-shlib-undefined">; def: F<"detect-odr-violations">; def: Flag<["-"], "g">; def: F<"long-plt">; def: F<"no-add-needed">; -def: F<"no-allow-shlib-undefined">; def: F<"no-copy-dt-needed-entries">; def: F<"no-ctors-in-init-array">; def: F<"no-keep-memory">; diff --git contrib/llvm/tools/lld/ELF/SymbolTable.cpp contrib/llvm/tools/lld/ELF/SymbolTable.cpp index 7615e12199fa..bf1bf4511e96 100644 --- contrib/llvm/tools/lld/ELF/SymbolTable.cpp +++ contrib/llvm/tools/lld/ELF/SymbolTable.cpp @@ -93,7 +93,7 @@ template <class ELFT> void SymbolTable::addFile(InputFile *File) { // .so file if (auto *F = dyn_cast<SharedFile<ELFT>>(File)) { // DSOs are uniquified not by filename but by soname. - F->parseSoName(); + F->parseDynamic(); if (errorCount()) return; diff --git contrib/llvm/tools/lld/ELF/SymbolTable.h contrib/llvm/tools/lld/ELF/SymbolTable.h index 898185fc9612..675a4915598f 100644 --- contrib/llvm/tools/lld/ELF/SymbolTable.h +++ contrib/llvm/tools/lld/ELF/SymbolTable.h @@ -80,6 +80,9 @@ public: void handleDynamicList(); + // Set of .so files to not link the same shared object file more than once. + llvm::DenseMap<StringRef, InputFile *> SoNames; + private: std::pair<Symbol *, bool> insertName(StringRef Name); @@ -107,9 +110,6 @@ private: // is used to uniquify them. llvm::DenseSet<llvm::CachedHashStringRef> ComdatGroups; - // Set of .so files to not link the same shared object file more than once. - llvm::DenseMap<StringRef, InputFile *> SoNames; - // A map from demangled symbol names to their symbol objects. // This mapping is 1:N because two symbols with different versions // can have the same name. We use this map to handle "extern C++ {}" diff --git contrib/llvm/tools/lld/ELF/Writer.cpp contrib/llvm/tools/lld/ELF/Writer.cpp index 5c987ca5a813..dcabf52e64f3 100644 --- contrib/llvm/tools/lld/ELF/Writer.cpp +++ contrib/llvm/tools/lld/ELF/Writer.cpp @@ -1668,6 +1668,27 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { if (In.Iplt && !In.Iplt->empty()) In.Iplt->addSymbols(); + if (!Config->AllowShlibUndefined) { + // Error on undefined symbols in a shared object, if all of its DT_NEEDED + // entires are seen. These cases would otherwise lead to runtime errors + // reported by the dynamic linker. + // + // ld.bfd traces all DT_NEEDED to emulate the logic of the dynamic linker to + // catch more cases. That is too much for us. Our approach resembles the one + // used in ld.gold, achieves a good balance to be useful but not too smart. + for (InputFile *File : SharedFiles) { + SharedFile<ELFT> *F = cast<SharedFile<ELFT>>(File); + F->AllNeededIsKnown = llvm::all_of(F->DtNeeded, [&](StringRef Needed) { + return Symtab->SoNames.count(Needed); + }); + } + for (Symbol *Sym : Symtab->getSymbols()) + if (Sym->isUndefined() && !Sym->isWeak()) + if (auto *F = dyn_cast_or_null<SharedFile<ELFT>>(Sym->File)) + if (F->AllNeededIsKnown) + error(toString(F) + ": undefined reference to " + toString(*Sym)); + } + // Now that we have defined all possible global symbols including linker- // synthesized ones. Visit all symbols to give the finishing touches. for (Symbol *Sym : Symtab->getSymbols()) { diff --git contrib/llvm/tools/lld/docs/ld.lld.1 contrib/llvm/tools/lld/docs/ld.lld.1 index 04bf19d6b23c..6fd746f030dd 100644 --- contrib/llvm/tools/lld/docs/ld.lld.1 +++ contrib/llvm/tools/lld/docs/ld.lld.1 @@ -56,6 +56,9 @@ option. .It Fl -allow-multiple-definition Do not error if a symbol is defined multiple times. The first definition will be used. +.It Fl -allow-shlib-undefined +Allow unresolved references in shared libraries. +This option is enabled by default when linking a shared library. .It Fl -apply-dynamic-relocs Apply link-time values for dynamic relocations. .It Fl -as-needed @@ -252,6 +255,9 @@ Set target emulation. .It Fl -Map Ns = Ns Ar file , Fl M Ar file Print a link map to .Ar file . +.It Fl -no-allow-shlib-undefined +Do not allow unresolved references in shared libraries. +This option is enabled by default when linking an executable. .It Fl -no-as-needed Always set .Dv DT_NEEDED diff --git lib/clang/include/clang/Basic/Version.inc lib/clang/include/clang/Basic/Version.inc index 5ff159c94ceb..4f0b7700f434 100644 --- lib/clang/include/clang/Basic/Version.inc +++ lib/clang/include/clang/Basic/Version.inc @@ -8,4 +8,4 @@ #define CLANG_VENDOR "FreeBSD " -#define SVN_REVISION "356034" +#define SVN_REVISION "356365" diff --git lib/clang/include/lld/Common/Version.inc lib/clang/include/lld/Common/Version.inc index 595c4d5e42b2..67dc3ea96718 100644 --- lib/clang/include/lld/Common/Version.inc +++ lib/clang/include/lld/Common/Version.inc @@ -7,4 +7,4 @@ #define LLD_REPOSITORY_STRING "FreeBSD" // <Upstream revision at import>-<Local identifier in __FreeBSD_version style> -#define LLD_REVISION_STRING "356034-1300002" +#define LLD_REVISION_STRING "356365-1300003" diff --git lib/clang/include/llvm/Support/VCSRevision.h lib/clang/include/llvm/Support/VCSRevision.h index cbadec6dbc23..8faf47acd038 100644 --- lib/clang/include/llvm/Support/VCSRevision.h +++ lib/clang/include/llvm/Support/VCSRevision.h @@ -1,2 +1,2 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "svn-r356034" +#define LLVM_REVISION "svn-r356365" diff --git lib/googletest/gtest_main/tests/Makefile lib/googletest/gtest_main/tests/Makefile index 60ec30579b55..d7399ebaad4d 100644 --- lib/googletest/gtest_main/tests/Makefile +++ lib/googletest/gtest_main/tests/Makefile @@ -18,6 +18,7 @@ GTESTS+= gtest_prod_test GTESTS+= gtest_sole_header_test GTESTS+= googletest-test-part-test GTESTS+= gtest-typed-test_test +GTESTS+= gtest_skip_test GTESTS+= gtest_unittest CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include diff --git lib/libjail/jail.c lib/libjail/jail.c index dc7fdf1479bd..ad05f5273f2c 100644 --- lib/libjail/jail.c +++ lib/libjail/jail.c @@ -1050,14 +1050,8 @@ kldload_param(const char *name) kl = kldload(name); else if (strncmp(name, "allow.mount.", 12) == 0) { /* Load the matching filesystem */ - const char *modname; + const char *modname = name + 12; - if (strcmp("fusefs", name + 12) == 0 || - strcmp("nofusefs", name + 12) == 0) { - modname = "fuse"; - } else { - modname = name + 12; - } kl = kldload(modname); if (kl < 0 && errno == ENOENT && strncmp(modname, "no", 2) == 0) diff --git sbin/mount_fusefs/mount_fusefs.c sbin/mount_fusefs/mount_fusefs.c index 2dd2dcafb828..087df356dece 100644 --- sbin/mount_fusefs/mount_fusefs.c +++ sbin/mount_fusefs/mount_fusefs.c @@ -501,7 +501,7 @@ init_backgrounded(void) len = sizeof(ibg); - if (sysctlbyname("vfs.fuse.init_backgrounded", &ibg, &len, NULL, 0)) + if (sysctlbyname("vfs.fusefs.init_backgrounded", &ibg, &len, NULL, 0)) return (0); return (ibg); diff --git sys/conf/NOTES sys/conf/NOTES index fe95adeeb27d..ba735d9a7c04 100644 --- sys/conf/NOTES +++ sys/conf/NOTES @@ -1071,7 +1071,7 @@ options NFSCL #Network File System client options AUTOFS #Automounter filesystem options CD9660 #ISO 9660 filesystem options FDESCFS #File descriptor filesystem -options FUSE #FUSE support module +options FUSEFS #FUSEFS support module options MSDOSFS #MS DOS File System (FAT, FAT32) options NFSLOCKD #Network Lock Manager options NFSD #Network Filesystem Server diff --git sys/conf/files sys/conf/files index 8c1faabee60b..3448c71920b6 100644 --- sys/conf/files +++ sys/conf/files @@ -3494,15 +3494,15 @@ fs/fdescfs/fdesc_vfsops.c optional fdescfs fs/fdescfs/fdesc_vnops.c optional fdescfs fs/fifofs/fifo_vnops.c standard fs/cuse/cuse.c optional cuse -fs/fuse/fuse_device.c optional fuse -fs/fuse/fuse_file.c optional fuse -fs/fuse/fuse_internal.c optional fuse -fs/fuse/fuse_io.c optional fuse -fs/fuse/fuse_ipc.c optional fuse -fs/fuse/fuse_main.c optional fuse -fs/fuse/fuse_node.c optional fuse -fs/fuse/fuse_vfsops.c optional fuse -fs/fuse/fuse_vnops.c optional fuse +fs/fuse/fuse_device.c optional fusefs +fs/fuse/fuse_file.c optional fusefs +fs/fuse/fuse_internal.c optional fusefs +fs/fuse/fuse_io.c optional fusefs +fs/fuse/fuse_ipc.c optional fusefs +fs/fuse/fuse_main.c optional fusefs +fs/fuse/fuse_node.c optional fusefs +fs/fuse/fuse_vfsops.c optional fusefs +fs/fuse/fuse_vnops.c optional fusefs fs/msdosfs/msdosfs_conv.c optional msdosfs fs/msdosfs/msdosfs_denode.c optional msdosfs fs/msdosfs/msdosfs_fat.c optional msdosfs diff --git sys/conf/kern.post.mk sys/conf/kern.post.mk index 5a0dcb6e1ee0..ebb437a6a6ed 100644 --- sys/conf/kern.post.mk +++ sys/conf/kern.post.mk @@ -140,6 +140,8 @@ kernel-obj: .if !defined(NO_MODULES) modules: modules-all +modules-depend: beforebuild +modules-all: beforebuild .if !defined(NO_MODULES_OBJ) modules-all modules-depend: modules-obj @@ -328,6 +330,11 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} .depend: .PRECIOUS ${SRCS} +.if ${COMPILER_TYPE} == "clang" || \ + (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60000) +_MAP_DEBUG_PREFIX= yes +.endif + _ILINKS= machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+= ${MACHINE_CPUARCH} @@ -337,12 +344,25 @@ _ILINKS+= x86 .endif # Ensure that the link exists without depending on it when it exists. +# Ensure that debug info references the path in the source tree. .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${SRCS} ${CLEAN:M*.o}: ${_link} .endif +.if defined(_MAP_DEBUG_PREFIX) +.if ${_link} == "machine" +CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include +.else +CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include +.endif +.endif .endfor +.if defined(_MAP_DEBUG_PREFIX) +# Ensure that DWARF info contains a full path for auto-generated headers. +CFLAGS+= -fdebug-prefix-map=.=${.OBJDIR} +.endif + ${_ILINKS}: @case ${.TARGET} in \ machine) \ diff --git sys/conf/kmod.mk sys/conf/kmod.mk index 3487939d37b7..562fde4c4db5 100644 --- sys/conf/kmod.mk +++ sys/conf/kmod.mk @@ -271,6 +271,11 @@ ${FULLPROG}: ${OBJS} ${OBJCOPY} --strip-debug ${.TARGET} .endif +.if ${COMPILER_TYPE} == "clang" || \ + (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60000) +_MAP_DEBUG_PREFIX= yes +.endif + _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -287,12 +292,25 @@ beforebuild: ${_ILINKS} # Ensure that the links exist without depending on it when it exists which # causes all the modules to be rebuilt when the directory pointed to changes. +# Ensure that debug info references the path in the source tree. .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) OBJS_DEPEND_GUESS+= ${_link} .endif +.if defined(_MAP_DEBUG_PREFIX) +.if ${_link} == "machine" +CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include +.else +CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include +.endif +.endif .endfor +.if defined(_MAP_DEBUG_PREFIX) +# Ensure that DWARF info contains a full path for auto-generated headers. +CFLAGS+= -fdebug-prefix-map=.=${.OBJDIR} +.endif + .NOPATH: ${_ILINKS} ${_ILINKS}: diff --git sys/conf/options sys/conf/options index 759f5b4f53a6..b084d91f8146 100644 --- sys/conf/options +++ sys/conf/options @@ -253,7 +253,7 @@ CD9660 opt_dontuse.h EXT2FS opt_dontuse.h FDESCFS opt_dontuse.h FFS opt_dontuse.h -FUSE opt_dontuse.h +FUSEFS opt_dontuse.h MSDOSFS opt_dontuse.h NANDFS opt_dontuse.h NULLFS opt_dontuse.h diff --git sys/fs/fuse/fuse.h sys/fs/fuse/fuse.h index 07e2759af96c..792ab0aa3684 100644 --- sys/fs/fuse/fuse.h +++ sys/fs/fuse/fuse.h @@ -143,7 +143,7 @@ /* misc */ -SYSCTL_DECL(_vfs_fuse); +SYSCTL_DECL(_vfs_fusefs); /* Fuse locking */ diff --git sys/fs/fuse/fuse_file.c sys/fs/fuse/fuse_file.c index 015b13534455..04caf871ec33 100644 --- sys/fs/fuse/fuse_file.c +++ sys/fs/fuse/fuse_file.c @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); static int fuse_fh_count = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, filehandle_count, CTLFLAG_RD, &fuse_fh_count, 0, "number of open FUSE filehandles"); int diff --git sys/fs/fuse/fuse_ipc.c sys/fs/fuse/fuse_ipc.c index 54d24f1bc34a..ed9884b51db9 100644 --- sys/fs/fuse/fuse_ipc.c +++ sys/fs/fuse/fuse_ipc.c @@ -99,21 +99,21 @@ static int fuse_body_audit(struct fuse_ticket *ftick, size_t blen); static fuse_handler_t fuse_standard_handler; -SYSCTL_NODE(_vfs, OID_AUTO, fuse, CTLFLAG_RW, 0, "FUSE tunables"); -SYSCTL_STRING(_vfs_fuse, OID_AUTO, version, CTLFLAG_RD, +SYSCTL_NODE(_vfs, OID_AUTO, fusefs, CTLFLAG_RW, 0, "FUSE tunables"); +SYSCTL_STRING(_vfs_fusefs, OID_AUTO, version, CTLFLAG_RD, FUSE_FREEBSD_VERSION, 0, "fuse-freebsd version"); static int fuse_ticket_count = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, ticket_count, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, ticket_count, CTLFLAG_RW, &fuse_ticket_count, 0, "number of allocated tickets"); static long fuse_iov_permanent_bufsize = 1 << 19; -SYSCTL_LONG(_vfs_fuse, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, +SYSCTL_LONG(_vfs_fusefs, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, &fuse_iov_permanent_bufsize, 0, "limit for permanently stored buffer size for fuse_iovs"); static int fuse_iov_credit = 16; -SYSCTL_INT(_vfs_fuse, OID_AUTO, iov_credit, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, iov_credit, CTLFLAG_RW, &fuse_iov_credit, 0, "how many times is an oversized fuse_iov tolerated"); diff --git sys/fs/fuse/fuse_main.c sys/fs/fuse/fuse_main.c index c43cf2bb9b10..41e2d611e10c 100644 --- sys/fs/fuse/fuse_main.c +++ sys/fs/fuse/fuse_main.c @@ -94,9 +94,9 @@ static struct vfsconf fuse_vfsconf = { .vfc_flags = VFCF_JAIL | VFCF_SYNTHETIC }; -SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_major, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, kernelabi_major, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, FUSE_KERNEL_VERSION, "FUSE kernel abi major version"); -SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_minor, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, kernelabi_minor, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, FUSE_KERNEL_MINOR_VERSION, "FUSE kernel abi minor version"); /****************************** @@ -156,10 +156,10 @@ fuse_loader(struct module *m, int what, void *arg) /* Registering the module */ static moduledata_t fuse_moddata = { - "fuse", + "fusefs", fuse_loader, &fuse_vfsconf }; -DECLARE_MODULE(fuse, fuse_moddata, SI_SUB_VFS, SI_ORDER_MIDDLE); -MODULE_VERSION(fuse, 1); +DECLARE_MODULE(fusefs, fuse_moddata, SI_SUB_VFS, SI_ORDER_MIDDLE); +MODULE_VERSION(fusefs, 1); diff --git sys/fs/fuse/fuse_node.c sys/fs/fuse/fuse_node.c index caf8119d5df7..e2c60ce24129 100644 --- sys/fs/fuse/fuse_node.c +++ sys/fs/fuse/fuse_node.c @@ -98,47 +98,47 @@ static int sysctl_fuse_cache_mode(SYSCTL_HANDLER_ARGS); static int fuse_node_count = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, node_count, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, node_count, CTLFLAG_RD, &fuse_node_count, 0, "Count of FUSE vnodes"); int fuse_data_cache_mode = FUSE_CACHE_WT; -SYSCTL_PROC(_vfs_fuse, OID_AUTO, data_cache_mode, CTLTYPE_INT|CTLFLAG_RW, +SYSCTL_PROC(_vfs_fusefs, OID_AUTO, data_cache_mode, CTLTYPE_INT|CTLFLAG_RW, &fuse_data_cache_mode, 0, sysctl_fuse_cache_mode, "I", "Zero: disable caching of FUSE file data; One: write-through caching " "(default); Two: write-back caching (generally unsafe)"); int fuse_data_cache_invalidate = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, data_cache_invalidate, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, data_cache_invalidate, CTLFLAG_RW, &fuse_data_cache_invalidate, 0, "If non-zero, discard cached clean file data when there are no active file" " users"); int fuse_mmap_enable = 1; -SYSCTL_INT(_vfs_fuse, OID_AUTO, mmap_enable, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, mmap_enable, CTLFLAG_RW, &fuse_mmap_enable, 0, "If non-zero, and data_cache_mode is also non-zero, enable mmap(2) of " "FUSE files"); int fuse_refresh_size = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, refresh_size, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, refresh_size, CTLFLAG_RW, &fuse_refresh_size, 0, "If non-zero, and no dirty file extension data is buffered, fetch file " "size before write operations"); int fuse_sync_resize = 1; -SYSCTL_INT(_vfs_fuse, OID_AUTO, sync_resize, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, sync_resize, CTLFLAG_RW, &fuse_sync_resize, 0, "If a cached write extended a file, inform FUSE filesystem of the changed" "size immediately subsequent to the issued writes"); int fuse_fix_broken_io = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, fix_broken_io, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, fix_broken_io, CTLFLAG_RW, &fuse_fix_broken_io, 0, "If non-zero, print a diagnostic warning if a userspace filesystem returns" " EIO on reads of recently extended portions of files"); diff --git sys/fs/fuse/fuse_vfsops.c sys/fs/fuse/fuse_vfsops.c index 0b3c4db7daf3..715307290428 100644 --- sys/fs/fuse/fuse_vfsops.c +++ sys/fs/fuse/fuse_vfsops.c @@ -115,16 +115,16 @@ struct vfsops fuse_vfsops = { .vfs_statfs = fuse_vfsop_statfs, }; -SYSCTL_INT(_vfs_fuse, OID_AUTO, init_backgrounded, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, init_backgrounded, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, 1, "indicate async handshake"); static int fuse_enforce_dev_perms = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, &fuse_enforce_dev_perms, 0, "enforce fuse device permissions for secondary mounts"); static unsigned sync_unmount = 1; -SYSCTL_UINT(_vfs_fuse, OID_AUTO, sync_unmount, CTLFLAG_RW, +SYSCTL_UINT(_vfs_fusefs, OID_AUTO, sync_unmount, CTLFLAG_RW, &sync_unmount, 0, "specify when to use synchronous unmount"); MALLOC_DEFINE(M_FUSEVFS, "fuse_filesystem", "buffer for fuse vfs layer"); diff --git sys/fs/fuse/fuse_vnops.c sys/fs/fuse/fuse_vnops.c index 08aa45b852eb..59ac3ecbda0b 100644 --- sys/fs/fuse/fuse_vnops.c +++ sys/fs/fuse/fuse_vnops.c @@ -179,17 +179,17 @@ struct vop_vector fuse_vnops = { static u_long fuse_lookup_cache_hits = 0; -SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, +SYSCTL_ULONG(_vfs_fusefs, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, &fuse_lookup_cache_hits, 0, "number of positive cache hits in lookup"); static u_long fuse_lookup_cache_misses = 0; -SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, +SYSCTL_ULONG(_vfs_fusefs, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, &fuse_lookup_cache_misses, 0, "number of cache misses in lookup"); int fuse_lookup_cache_enable = 1; -SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, &fuse_lookup_cache_enable, 0, "if non-zero, enable lookup cache"); /* @@ -198,7 +198,7 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, */ static int fuse_reclaim_revoked = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, reclaim_revoked, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, reclaim_revoked, CTLFLAG_RW, &fuse_reclaim_revoked, 0, ""); uma_zone_t fuse_pbuf_zone; diff --git sys/modules/Makefile sys/modules/Makefile index c8ed845f89ae..27ec483988de 100644 --- sys/modules/Makefile +++ sys/modules/Makefile @@ -128,7 +128,7 @@ SUBDIR= \ filemon \ firewire \ firmware \ - fuse \ + fusefs \ ${_fxp} \ gem \ geom \ diff --git sys/modules/fuse/Makefile sys/modules/fusefs/Makefile similarity index 59% rename from sys/modules/fuse/Makefile rename to sys/modules/fusefs/Makefile index c831e5dc0e60..c4950077c06a 100644 --- sys/modules/fuse/Makefile +++ sys/modules/fusefs/Makefile @@ -2,9 +2,12 @@ .PATH: ${SRCTOP}/sys/fs/fuse -KMOD= fuse +KMOD= fusefs SRCS= vnode_if.h \ fuse_node.c fuse_io.c fuse_device.c fuse_ipc.c fuse_file.c \ fuse_vfsops.c fuse_vnops.c fuse_internal.c fuse_main.c +# Symlink for backwards compatibility with systems installed at 12.0 or older +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/fuse.ko + .include <bsd.kmod.mk> diff --git sys/ufs/ffs/ffs_softdep.c sys/ufs/ffs/ffs_softdep.c index 76a022346e72..af7f0f740dac 100644 --- sys/ufs/ffs/ffs_softdep.c +++ sys/ufs/ffs/ffs_softdep.c @@ -13970,6 +13970,8 @@ softdep_bp_to_mp(bp) if (LIST_EMPTY(&bp->b_dep)) return (NULL); vp = bp->b_vp; + KASSERT(vp != NULL, + ("%s, buffer with dependencies lacks vnode", __func__)); /* * The ump mount point is stable after we get a correct @@ -13979,17 +13981,33 @@ softdep_bp_to_mp(bp) * workitem might be freed while dereferenced. */ retry: - if (vp->v_type == VCHR) { + switch (vp->v_type) { + case VCHR: VI_LOCK(vp); mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; VI_UNLOCK(vp); if (mp == NULL) goto retry; - } else if (vp->v_type == VREG || vp->v_type == VDIR || - vp->v_type == VLNK || vp->v_type == VFIFO) { + break; + case VREG: + case VDIR: + case VLNK: + case VFIFO: + case VSOCK: mp = vp->v_mount; - } else { - return (NULL); + break; + case VBLK: + vn_printf(vp, "softdep_bp_to_mp: unexpected block device\n"); + /* FALLTHROUGH */ + case VNON: + case VBAD: + case VMARKER: + mp = NULL; + break; + default: + vn_printf(vp, "unknown vnode type"); + mp = NULL; + break; } return (VFSTOUFS(mp)); }