From a1b291d44aa1d3a3bd3f4c6d5f6a5087acff410f Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Thu, 24 Oct 2019 02:37:28 -0700 Subject: [PATCH] Fix mount entries listing for tmpfs PiperOrigin-RevId: 276447076 Change-Id: Ia5873e34327c281e5c9fb66f5f58a0dd49ba10b0 --- sandboxed_api/sandbox2/mounts.cc | 1 + sandboxed_api/sandbox2/mounts_test.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/sandboxed_api/sandbox2/mounts.cc b/sandboxed_api/sandbox2/mounts.cc index ace7148..7f897c3 100644 --- a/sandboxed_api/sandbox2/mounts.cc +++ b/sandboxed_api/sandbox2/mounts.cc @@ -589,6 +589,7 @@ void RecursivelyListMountsImpl(const MountTree& tree, inside_entries->emplace_back(absl::StrCat(rw_str, tree_path)); outside_entries->emplace_back(absl::StrCat(node.file_node().outside())); } else if (node.has_tmpfs_node()) { + inside_entries->emplace_back(tree_path); outside_entries->emplace_back( absl::StrCat("tmpfs: ", node.tmpfs_node().tmpfs_options())); } diff --git a/sandboxed_api/sandbox2/mounts_test.cc b/sandboxed_api/sandbox2/mounts_test.cc index e026648..f2c95e1 100644 --- a/sandboxed_api/sandbox2/mounts_test.cc +++ b/sandboxed_api/sandbox2/mounts_test.cc @@ -205,6 +205,8 @@ TEST(MountTreeTest, TestList) { } } + ASSERT_THAT(mounts.AddTmpfs(file::CleanPath("/d"), 1024 * 1024), IsOk()); + std::vector outside_entries; std::vector inside_entries; mounts.RecursivelyListMounts(&outside_entries, &inside_entries); @@ -219,6 +221,7 @@ TEST(MountTreeTest, TestList) { "R /h", "W /i/j/k", "W /i/l/", + "/d", })); EXPECT_THAT( outside_entries, @@ -229,6 +232,7 @@ TEST(MountTreeTest, TestList) { absl::StrCat("/some/dir/", "h"), absl::StrCat("/some/dir/", "i/j/k"), absl::StrCat("/some/dir/", "i/l/"), + absl::StrCat("tmpfs: size=", 1024*1024), })); // clang-format on }