FUSE-BPF: use both ro and persist properties

persist.sys.fuse.bpf.enable and ro.fuse.bpf.enabled are both used to
decide if FUSE-BPF must be enabled or not.
- ro.fuse.bpf.enabled is a read-only property that is set in the device
  makefile and would allow dogfooding devices to turn the feature
  on/off.
- persist.sys.fuse.bpf.enable is a system property that overrides
  ro.fuse.bpf.enabled and can only be set manually during the
  development to simplify the testing of FUSE-BPF, mostly to compare if
  those tests that are failing with FUSE-BPF were failing also without
  the feature.

Bug: 202785178
Test: adb logcat | grep "FuseDaemon" | grep BPF
Ignore-AOSP-First: FUSE-BPF is not available in AOSP
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I23f9d27172907f6c72c73bea22e4a7e0ac643888
This commit is contained in:
Alessio Balsini 2022-03-23 18:27:59 +00:00
parent 16b7a74bcf
commit 583ae3e55d
3 changed files with 14 additions and 3 deletions

View file

@ -1765,5 +1765,15 @@ std::pair<android::base::unique_fd, std::string> OpenDirInProcfs(std::string_vie
return {std::move(fd), std::move(linkPath)}; return {std::move(fd), std::move(linkPath)};
} }
bool IsFuseBpfEnabled() {
std::string bpf_override = android::base::GetProperty("persist.sys.fuse.bpf.override", "");
if (bpf_override == "true") {
return true;
} else if (bpf_override == "false") {
return false;
}
return base::GetBoolProperty("ro.fuse.bpf.enabled", false);
}
} // namespace vold } // namespace vold
} // namespace android } // namespace android

View file

@ -37,7 +37,6 @@ namespace vold {
static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled"; static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled";
static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled"; static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled";
static const char* kFuseBpfEnabled = "persist.sys.fuse.bpf.override";
static constexpr std::chrono::seconds kUntrustedFsckSleepTime(45); static constexpr std::chrono::seconds kUntrustedFsckSleepTime(45);
@ -206,6 +205,8 @@ status_t UnmountUserFuse(userid_t userId, const std::string& absolute_lower_path
status_t PrepareAndroidDirs(const std::string& volumeRoot); status_t PrepareAndroidDirs(const std::string& volumeRoot);
bool IsFuseBpfEnabled();
// Open a given directory as an FD, and return that and the corresponding procfs virtual // Open a given directory as an FD, and return that and the corresponding procfs virtual
// symlink path that can be used in any API that accepts a path string. Path stays valid until // symlink path that can be used in any API that accepts a path string. Path stays valid until
// the directory FD is closed. // the directory FD is closed.

View file

@ -49,7 +49,7 @@ EmulatedVolume::EmulatedVolume(const std::string& rawPath, int userId)
mRawPath = rawPath; mRawPath = rawPath;
mLabel = "emulated"; mLabel = "emulated";
mFuseMounted = false; mFuseMounted = false;
mFuseBpfEnabled = base::GetBoolProperty(kFuseBpfEnabled, false); mFuseBpfEnabled = IsFuseBpfEnabled();
mUseSdcardFs = IsSdcardfsUsed(); mUseSdcardFs = IsSdcardfsUsed();
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false); mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
} }
@ -61,7 +61,7 @@ EmulatedVolume::EmulatedVolume(const std::string& rawPath, dev_t device, const s
mRawPath = rawPath; mRawPath = rawPath;
mLabel = fsUuid; mLabel = fsUuid;
mFuseMounted = false; mFuseMounted = false;
mFuseBpfEnabled = base::GetBoolProperty(kFuseBpfEnabled, false); mFuseBpfEnabled = IsFuseBpfEnabled();
mUseSdcardFs = IsSdcardfsUsed(); mUseSdcardFs = IsSdcardfsUsed();
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false); mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
} }