[automerger skipped] [NFC] Move MTE mode settings to a product variable. am: b895507094 -s ours
am skip reason: Merged-In I7b2713fa0065f8c0317cc7634eedf6143f7fefec with SHA-1 d26716e148 is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/23716468
Change-Id: Ib28f1891d6c72790555d970adc27277c11f95e64
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index e53669a..fe51ed5 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -270,14 +270,12 @@
// kernel does not have CONFIG_BPF_JIT=y)
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n") &&
- android::bpf::isAtLeastKernelVersion(5, 4, 0)) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n")) return 1;
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n") &&
- android::bpf::isAtLeastKernelVersion(5, 4, 0)) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n")) return 1;
// Create all the pin subdirectories
// (this must be done first to allow selinux_context and pin_subdir functionality,
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index 7f6aae1..71a5a64 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -31,13 +31,13 @@
#include <sys/wait.h>
#include <unistd.h>
-// This is BpfLoader v0.38
+// This is BpfLoader v0.39
// 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.
// (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.
#define BPFLOADER_VERSION_MAJOR 0u
-#define BPFLOADER_VERSION_MINOR 38u
+#define BPFLOADER_VERSION_MINOR 39u
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
#include "BpfSyscallWrappers.h"
@@ -767,7 +767,10 @@
ret = getSectionSymNames(elfFile, "maps", mapNames);
if (ret) return ret;
- unsigned btfMinBpfLoaderVer = readSectionUint("btf_min_bpfloader_ver", elfFile, 0);
+ // BpfLoader before v0.39 unconditionally check only 'btf_min_bpfloader_ver'
+ unsigned btfMinBpfLoaderVer = readSectionUint(
+ isUser() ? "btf_user_min_bpfloader_ver" : "btf_min_bpfloader_ver", elfFile, 0);
+
unsigned btfMinKernelVer = readSectionUint("btf_min_kernel_ver", elfFile, 0);
unsigned kvers = kernelVersion();