diff options
author | Chenbo Feng <fengc@google.com> | 2019-04-17 14:33:02 -0700 |
---|---|---|
committer | Maciej Żenczykowski <maze@google.com> | 2019-04-17 16:16:15 -0700 |
commit | a4be0e6905e27634270016219ca52e884c6f8ec4 (patch) | |
tree | 4ef38413aa7f54910c9a9db9f8dbb9b1655ac669 | |
parent | 64b91ac112506e19e01819197d6e7b6585ffdb65 (diff) | |
download | android_system_bpf-a4be0e6905e27634270016219ca52e884c6f8ec4.tar.gz android_system_bpf-a4be0e6905e27634270016219ca52e884c6f8ec4.tar.bz2 android_system_bpf-a4be0e6905e27634270016219ca52e884c6f8ec4.zip |
Skip bpf object loading on unsupported devices
The bpfloader should not try to load bpf objects on unsupported devices
since devices with 4.4 kernel can have bpf maps but not bpf pogram
support. Creating bpf maps on those devices would mislead the framework
code to use an unsupported code path and crash system server.
Bug: 130687855
Test: cuttlefish boot test for 4.4 kernel.
Change-Id: I43ffc01e1099ee3effaa6ba30aa78080d5bec72f
Merged-In: I43ffc01e1099ee3effaa6ba30aa78080d5bec72f
(cherry picked from commit b20d28df6a1f49da7038522674c5356fea2bcacf)
-rw-r--r-- | bpfloader/BpfLoader.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp index 35b84de..01c02cc 100644 --- a/bpfloader/BpfLoader.cpp +++ b/bpfloader/BpfLoader.cpp @@ -92,8 +92,10 @@ int main() { return 0; } - // Load all ELF objects, create programs and maps, and pin them - loadAllElfObjects(); + if (android::bpf::getBpfSupportLevel() != android::bpf::BpfLevel::NONE) { + // Load all ELF objects, create programs and maps, and pin them + loadAllElfObjects(); + } if (android::base::SetProperty("bpf.progs_loaded", "1") == false) { ALOGE("Failed to set bpf.progs_loaded property\n"); |