From 2a5d0160611d8a5f68e94b6932bd3c30c0b6a0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Thu, 21 Jul 2022 13:27:24 +0000 Subject: [PATCH] BpfLoader v0.28 - if (map.zero != 0) abort() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also effectively forces the 'struct bpf_map_def' definition to include the zero field, and thus to have the uid field at the new offset. Bug: 239807354 Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I44dd740bda4cce4d8fcb04895ee7eb3d4c3300e4 --- libbpf_android/Loader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp index ad20176..d68f407 100644 --- a/libbpf_android/Loader.cpp +++ b/libbpf_android/Loader.cpp @@ -30,9 +30,9 @@ #include #include -// This is BpfLoader v0.27 +// This is BpfLoader v0.28 #define BPFLOADER_VERSION_MAJOR 0u -#define BPFLOADER_VERSION_MINOR 27u +#define BPFLOADER_VERSION_MINOR 28u #define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR) #include "bpf/BpfUtils.h" @@ -737,6 +737,8 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& } for (int i = 0; i < (int)mapNames.size(); i++) { + if (md[i].zero != 0) abort(); + if (BPFLOADER_VERSION < md[i].bpfloader_min_ver) { ALOGI("skipping map %s which requires bpfloader min ver 0x%05x", mapNames[i].c_str(), md[i].bpfloader_min_ver);