bpfloader: ignore_on_arch support am: 8d2e7d9ae3 am: 0edf3d92a9

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

Change-Id: I0b5ea92ad2e8618ba748e8f6feadef853f6c7c10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Maciej Żenczykowski 2023-05-20 17:22:54 +00:00 committed by Automerger Merge Worker
commit de2ff678a2

View file

@ -31,13 +31,13 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
// This is BpfLoader v0.37 // This is BpfLoader v0.38
// WARNING: If you ever hit cherrypick conflicts here you're doing it wrong: // WARNING: If you ever hit cherrypick conflicts here you're doing it wrong:
// You are NOT allowed to cherrypick bpfloader related patches out of order. // You are NOT allowed to cherrypick bpfloader related patches out of order.
// (indeed: cherrypicking is probably a bad idea and you should merge instead) // (indeed: cherrypicking is probably a bad idea and you should merge instead)
// Mainline supports ONLY the published versions of the bpfloader for each Android release. // Mainline supports ONLY the published versions of the bpfloader for each Android release.
#define BPFLOADER_VERSION_MAJOR 0u #define BPFLOADER_VERSION_MAJOR 0u
#define BPFLOADER_VERSION_MINOR 37u #define BPFLOADER_VERSION_MINOR 38u
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR) #define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
#include "BpfSyscallWrappers.h" #include "BpfSyscallWrappers.h"
@ -816,6 +816,17 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
continue; continue;
} }
if ((isArm() && isKernel32Bit() && md[i].ignore_on_arm32) ||
(isArm() && isKernel64Bit() && md[i].ignore_on_aarch64) ||
(isX86() && isKernel32Bit() && md[i].ignore_on_x86_32) ||
(isX86() && isKernel64Bit() && md[i].ignore_on_x86_64) ||
(isRiscV() && md[i].ignore_on_riscv64)) {
ALOGI("skipping map %s which is ignored on %s", mapNames[i].c_str(),
describeArch());
mapFds.push_back(unique_fd());
continue;
}
enum bpf_map_type type = md[i].type; enum bpf_map_type type = md[i].type;
if (type == BPF_MAP_TYPE_DEVMAP_HASH && !isAtLeastKernelVersion(5, 4, 0)) { if (type == BPF_MAP_TYPE_DEVMAP_HASH && !isAtLeastKernelVersion(5, 4, 0)) {
// On Linux Kernels older than 5.4 this map type doesn't exist, but it can kind // On Linux Kernels older than 5.4 this map type doesn't exist, but it can kind
@ -1071,6 +1082,15 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
continue; continue;
} }
if ((isArm() && isKernel32Bit() && cs[i].prog_def->ignore_on_arm32) ||
(isArm() && isKernel64Bit() && cs[i].prog_def->ignore_on_aarch64) ||
(isX86() && isKernel32Bit() && cs[i].prog_def->ignore_on_x86_32) ||
(isX86() && isKernel64Bit() && cs[i].prog_def->ignore_on_x86_64) ||
(isRiscV() && cs[i].prog_def->ignore_on_riscv64)) {
ALOGD("cs[%d].name:%s is ignored on %s", i, name.c_str(), describeArch());
continue;
}
if (unrecognized(pin_subdir)) return -ENOTDIR; if (unrecognized(pin_subdir)) return -ENOTDIR;
if (specified(selinux_context)) { if (specified(selinux_context)) {