summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-24 02:27:08 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-24 02:27:08 +0000
commit82eed90a2022982e229171fd3949554c02478d41 (patch)
tree612e8d224624a5121f3358d69267f003b14e7919
parent4153bbe8687b3937899877fcf077384555f41197 (diff)
parent490a53e6f75e66ec87fdf5d1948c3eb6dc27c7ef (diff)
downloadbpf-android13-s1-release.tar.gz
Change-Id: I5a85c6b087465b678bea7c2564383150b012e983
-rw-r--r--libbpf_android/Loader.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index 47cf4c9..1c462dd 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -724,13 +724,16 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
ret = getSectionSymNames(elfFile, "maps", mapNames);
if (ret) return ret;
+ unsigned btfMinBpfLoaderVer = readSectionUint("btf_min_bpfloader_ver", elfFile, 0);
+ unsigned btfMinKernelVer = readSectionUint("btf_min_kernel_ver", elfFile, 0);
+ unsigned kvers = kernelVersion();
+
std::optional<unique_fd> btfFd;
- if (!readSectionByName(".BTF", elfFile, btfData)) {
+ if ((BPFLOADER_VERSION >= btfMinBpfLoaderVer) && (kvers >= btfMinKernelVer) &&
+ (!readSectionByName(".BTF", elfFile, btfData))) {
btfFd = getMapBtfInfo(elfPath, btfTypeIdMap);
}
- unsigned kvers = kernelVersion();
-
for (int i = 0; i < (int)mapNames.size(); i++) {
if (BPFLOADER_VERSION < md[i].bpfloader_min_ver) {
ALOGI("skipping map %s which requires bpfloader min ver 0x%05x", mapNames[i].c_str(),