Merge "Use kernel sys/fs/fuse/features/fuse_bpf flag to enable fuse_bpf" into udc-dev am: ee0a2bf52e

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/22427697

Change-Id: If2b2fcc55136560215d81791bd9ceb1bc5564631
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Paul Lawrence 2023-04-12 14:56:45 +00:00 committed by Automerger Merge Worker
commit 9bad75eb2d

View file

@ -1772,15 +1772,18 @@ std::pair<android::base::unique_fd, std::string> OpenDirInProcfs(std::string_vie
} }
bool IsFuseBpfEnabled() { bool IsFuseBpfEnabled() {
// TODO Once kernel supports flag, trigger off kernel flag unless
// ro.fuse.bpf.enabled is explicitly set to false
bool enabled; bool enabled;
std::string contents;
if (base::GetProperty("ro.fuse.bpf.is_running", "") != "") if (base::GetProperty("ro.fuse.bpf.is_running", "") != "")
enabled = base::GetBoolProperty("ro.fuse.bpf.is_running", false); enabled = base::GetBoolProperty("ro.fuse.bpf.is_running", false);
else if (base::GetProperty("persist.sys.fuse.bpf.override", "") != "") else if (base::GetProperty("persist.sys.fuse.bpf.override", "") != "")
enabled = base::GetBoolProperty("persist.sys.fuse.bpf.override", false); enabled = base::GetBoolProperty("persist.sys.fuse.bpf.override", false);
else else if (base::GetProperty("ro.fuse.bpf.enabled", "") != "")
enabled = base::GetBoolProperty("ro.fuse.bpf.enabled", false); enabled = base::GetBoolProperty("ro.fuse.bpf.enabled", false);
else
enabled = base::ReadFileToString("/sys/fs/fuse/features/fuse_bpf", &contents) &&
contents == "supported\n";
if (enabled) { if (enabled) {
base::SetProperty("ro.fuse.bpf.is_running", "true"); base::SetProperty("ro.fuse.bpf.is_running", "true");