Improve Storage Service sandboxing support
This corrects some deficiencies in the Storage Service's sandboxing
support by eliminating all remaining instances of direct filesystem
traversal within DOM Storage, replacing them with appropriate
FilesystemProxy usage.
A few new IPCs are added to the Directory mojom interface in support of
this, and a new delegate is added to support use of
sql::SandboxedVfs with a FilesystemProxy backing it.
Bug: 1052045
Test: content_browsertests with StorageServiceOutOfProcess and StorageServiceSandbox enabled
Change-Id: I8e7593d9424be705cb3c2bf561a4fe4c5d61251d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350542
Commit-Queue: Ken Rockot <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Reviewed-by: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#798710}
diff --git a/sql/database.cc b/sql/database.cc
index 05831c9..5e3605c0 100644
--- a/sql/database.cc
+++ b/sql/database.cc
@@ -40,6 +40,8 @@
namespace {
+bool enable_mmap_by_default_ = true;
+
// Spin for up to a second waiting for the lock to clear when setting
// up the database.
// TODO(shess): Better story on this. http://crbug.com/56559
@@ -249,7 +251,7 @@
in_memory_(false),
poisoned_(false),
mmap_alt_status_(false),
- mmap_disabled_(false),
+ mmap_disabled_(!enable_mmap_by_default_),
mmap_enabled_(false),
total_changes_at_last_release_(0),
stats_histogram_(nullptr) {}
@@ -258,6 +260,10 @@
Close();
}
+void Database::DisableMmapByDefault() {
+ enable_mmap_by_default_ = false;
+}
+
void Database::RecordEvent(Events event, size_t count) {
for (size_t i = 0; i < count; ++i) {
UMA_HISTOGRAM_ENUMERATION("Sqlite.Stats2", event, EVENT_MAX_VALUE);
@@ -1006,11 +1012,11 @@
CHECK(vfs->xDelete);
CHECK(vfs->xAccess);
- // We only work with unix, win32 and mojo filesystems. If you're trying to
+ // We only work with the VFS implementations listed below. If you're trying to
// use this code with any other VFS, you're not in a good place.
CHECK(strncmp(vfs->zName, "unix", 4) == 0 ||
strncmp(vfs->zName, "win32", 5) == 0 ||
- strcmp(vfs->zName, "mojo") == 0);
+ strcmp(vfs->zName, "storage_service") == 0);
vfs->xDelete(vfs, journal_str.c_str(), 0);
vfs->xDelete(vfs, wal_str.c_str(), 0);