1
0
mirror of https://github.com/ponces/treble_aosp.git synced 2024-11-24 20:16:22 +00:00
treble_aosp/patches/trebledroid/platform_system_bpf/0001-Support-no-bpf-usecase.patch
2024-06-18 10:56:01 +01:00

56 lines
2.1 KiB
Diff

From 2f853166adea13064fffb903a95c53ce79695a30 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 13 Oct 2021 10:56:52 -0400
Subject: [PATCH 1/3] Support no-bpf usecase
Change-Id: I75a427a2a41aa4ab1104ad88a891bef0dc2d9c91
---
bpfloader/BpfLoader.cpp | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index 08fd72d..07bf6f3 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -196,19 +196,15 @@ int main(int argc, char** argv) {
// which could otherwise fail with ENOENT during object pinning or renaming,
// due to ordering issues)
for (const auto& location : locations) {
- if (createSysFsBpfSubDir(location.prefix)) return 1;
+ if (createSysFsBpfSubDir(location.prefix)) {
+ goto fail;
+ }
}
// Load all ELF objects, create programs and maps, and pin them
for (const auto& location : locations) {
if (loadAllElfObjects(location) != 0) {
- ALOGE("=== CRITICAL FAILURE LOADING BPF PROGRAMS FROM %s ===", location.dir);
- ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
- ALOGE("If this triggers randomly, you might be hitting some memory allocation "
- "problems or startup script race.");
- ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
- sleep(20);
- return 2;
+ goto fail;
}
}
@@ -217,5 +213,13 @@ int main(int argc, char** argv) {
return 1;
}
+ return 0;
+fail:
+ ALOGE("=== CRITICAL FAILURE LOADING BPF PROGRAMS ===");
+ ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
+ ALOGE("If this triggers randomly, you might be hitting some memory allocation "
+ "problems or startup script race.");
+ ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
+ android::base::SetProperty("bpf.progs_loaded", "1");
return 0;
}
--
2.34.1