bpfloader: add ability to disable btfloader am: 37b3d06333

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/19048272

Change-Id: I765fe4de6ecccc9d09b1fa901f84a4f0197d2e19
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Maciej Żenczykowski 2022-06-23 22:45:06 +00:00 committed by Automerger Merge Worker
commit 04da9002f4

View file

@ -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(),