Merge "BpfLoader: progs section must be present" into main
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index 08fd72d..7a68f99 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -162,31 +162,6 @@
return 0;
}
-// Technically 'value' doesn't need to be newline terminated, but it's best
-// to include a newline to match 'echo "value" > /proc/sys/...foo' behaviour,
-// which is usually how kernel devs test the actual sysctl interfaces.
-int writeProcSysFile(const char *filename, const char *value) {
- android::base::unique_fd fd(open(filename, O_WRONLY | O_CLOEXEC));
- if (fd < 0) {
- const int err = errno;
- ALOGE("open('%s', O_WRONLY | O_CLOEXEC) -> %s", filename, strerror(err));
- return -err;
- }
- int len = strlen(value);
- int v = write(fd, value, len);
- if (v < 0) {
- const int err = errno;
- ALOGE("write('%s', '%s', %d) -> %s", filename, value, len, strerror(err));
- return -err;
- }
- if (v != len) {
- // In practice, due to us only using this for /proc/sys/... files, this can't happen.
- ALOGE("write('%s', '%s', %d) -> short write [%d]", filename, value, len, v);
- return -EINVAL;
- }
- return 0;
-}
-
int main(int argc, char** argv) {
(void)argc;
android::base::InitLogging(argv, &android::base::KernelLogger);
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index ad73b26..e1f7883 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -1126,39 +1126,12 @@
}
// the following default values are for bpfloader V0.0 format which does not include them
- unsigned int bpfLoaderMinVer =
- readSectionUint("bpfloader_min_ver", elfFile, DEFAULT_BPFLOADER_MIN_VER);
- unsigned int bpfLoaderMaxVer =
- readSectionUint("bpfloader_max_ver", elfFile, DEFAULT_BPFLOADER_MAX_VER);
- unsigned int bpfLoaderMinRequiredVer =
- readSectionUint("bpfloader_min_required_ver", elfFile, 0);
size_t sizeOfBpfMapDef =
readSectionUint("size_of_bpf_map_def", elfFile, DEFAULT_SIZEOF_BPF_MAP_DEF);
size_t sizeOfBpfProgDef =
readSectionUint("size_of_bpf_prog_def", elfFile, DEFAULT_SIZEOF_BPF_PROG_DEF);
- // inclusive lower bound check
- if (BPFLOADER_VERSION < bpfLoaderMinVer) {
- ALOGI("BpfLoader version 0x%05x ignoring ELF object %s with min ver 0x%05x",
- BPFLOADER_VERSION, elfPath, bpfLoaderMinVer);
- return 0;
- }
-
- // exclusive upper bound check
- if (BPFLOADER_VERSION >= bpfLoaderMaxVer) {
- ALOGI("BpfLoader version 0x%05x ignoring ELF object %s with max ver 0x%05x",
- BPFLOADER_VERSION, elfPath, bpfLoaderMaxVer);
- return 0;
- }
-
- if (BPFLOADER_VERSION < bpfLoaderMinRequiredVer) {
- ALOGI("BpfLoader version 0x%05x failing due to ELF object %s with required min ver 0x%05x",
- BPFLOADER_VERSION, elfPath, bpfLoaderMinRequiredVer);
- return -1;
- }
-
- ALOGI("BpfLoader version 0x%05x processing ELF object %s with ver [0x%05x,0x%05x)",
- BPFLOADER_VERSION, elfPath, bpfLoaderMinVer, bpfLoaderMaxVer);
+ ALOGI("Platform BpfLoader processing ELF object %s", elfPath);
if (sizeOfBpfMapDef < DEFAULT_SIZEOF_BPF_MAP_DEF) {
ALOGE("sizeof(bpf_map_def) of %zu is too small (< %d)", sizeOfBpfMapDef,