Use kernel sys/fs/fuse/features/fuse_bpf flag to enable fuse_bpf
Bug: 262887267
Test: ro.fuse.bpf.is_running is true
Change-Id: Ieeae532d96099f645e9682a84c93cedb752c4857
diff --git a/jni/FuseDaemon.cpp b/jni/FuseDaemon.cpp
index 729b28e..ee92707 100644
--- a/jni/FuseDaemon.cpp
+++ b/jni/FuseDaemon.cpp
@@ -18,6 +18,7 @@
#include "FuseDaemon.h"
+#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
@@ -2360,18 +2361,20 @@
}
bool IsFuseBpfEnabled() {
- // TODO b/262887267 Once kernel supports flag, trigger off kernel flag unless
- // ro.fuse.bpf.enabled is explicitly set to false
-
// ro.fuse.bpf.is_running may not be set when first reading this property, so we have to
// reproduce the vold/Utils.cpp:isFuseBpfEnabled() logic here
+
if (android::base::GetProperty("ro.fuse.bpf.is_running", "") != "") {
return android::base::GetBoolProperty("ro.fuse.bpf.is_running", false);
} else if (android::base::GetProperty("persist.sys.fuse.bpf.override", "") != "") {
return android::base::GetBoolProperty("persist.sys.fuse.bpf.override", false);
- } else {
+ } else if (android::base::GetProperty("ro.fuse.bpf.enabled", "") != "") {
return android::base::GetBoolProperty("ro.fuse.bpf.enabled", false);
}
+
+ string contents;
+ return android::base::ReadFileToString("/sys/fs/fuse/features/fuse_bpf", &contents) &&
+ contents == "supported\n";
}
void FuseDaemon::Start(android::base::unique_fd fd, const std::string& path,