From c041c4825bbea0640bb453fdbede40705ea295c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 16 Jun 2025 01:27:55 -0700 Subject: [PATCH] bpf: remove /system/etc/bpf from the loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These directories are not populated on real devices and are not part of the test suite. This change removes them from the BPF loader. Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I719d0feb9ef1a6f0a1e41265af47916410590ac7 --- loader/Loader.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/loader/Loader.cpp b/loader/Loader.cpp index 9fbea05..651be69 100644 --- a/loader/Loader.cpp +++ b/loader/Loader.cpp @@ -866,23 +866,6 @@ int loadProg(const char* elfPath, bool* isCritical, const Location& location) { return ret; } -// Networking-related program types are limited to the Tethering Apex -// to prevent things from breaking due to conflicts on mainline updates -// (exception made for socket filters, ie. xt_bpf for potential use in iptables, -// or for attaching to sockets directly) -constexpr bpf_prog_type kPlatformAllowedProgTypes[] = { - BPF_PROG_TYPE_KPROBE, - BPF_PROG_TYPE_PERF_EVENT, - BPF_PROG_TYPE_SOCKET_FILTER, - BPF_PROG_TYPE_TRACEPOINT, - BPF_PROG_TYPE_UNSPEC, // Will be replaced with fuse bpf program type -}; - -constexpr bpf_prog_type kMemEventsAllowedProgTypes[] = { - BPF_PROG_TYPE_TRACEPOINT, - BPF_PROG_TYPE_SOCKET_FILTER, -}; - // see b/162057235. For arbitrary program types, the concern is that due to the lack of // SELinux access controls over BPF program attachpoints, we have no way to control the // attachment of programs to shared resources (or to detect when a shared resource @@ -892,20 +875,6 @@ constexpr bpf_prog_type kVendorAllowedProgTypes[] = { }; const Location locations[] = { - // Core operating system - { - .dir = "/system/etc/bpf/", - .prefix = "", - .allowedProgTypes = kPlatformAllowedProgTypes, - .allowedProgTypesLength = arraysize(kPlatformAllowedProgTypes), - }, - // memevents - { - .dir = "/system/etc/bpf/memevents/", - .prefix = "memevents/", - .allowedProgTypes = kMemEventsAllowedProgTypes, - .allowedProgTypesLength = arraysize(kMemEventsAllowedProgTypes), - }, // Vendor operating system { .dir = "/vendor/etc/bpf/",