From cb0433611e5a4531a304b56e05cec5b4568755d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 15 Jul 2025 14:46:09 -0700 Subject: [PATCH] bpf: remove zero uid hack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not needed any more, since no more loader vs .o version skew. Test: TreeHugger Flag: EXEMPT mainline Signed-off-by: Maciej Żenczykowski Change-Id: I6c0b9ff2683809f3e732ec950bc91cf87040642f --- bpf/loader/NetBpfLoad.cpp | 2 -- bpf/progs/include/bpf_map_def.h | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index d0c5a6a445..ef29cfef1a 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -941,8 +941,6 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& unsigned kvers = kernelVersion(); for (int i = 0; i < (int)mapNames.size(); i++) { - if (md[i].zero != 0) abort(); - if (bpfloader_ver < md[i].bpfloader_min_ver) { ALOGD("skipping map %s which requires bpfloader min ver 0x%05x", mapNames[i].c_str(), md[i].bpfloader_min_ver); diff --git a/bpf/progs/include/bpf_map_def.h b/bpf/progs/include/bpf_map_def.h index 22c79d508e..9fb2917290 100644 --- a/bpf/progs/include/bpf_map_def.h +++ b/bpf/progs/include/bpf_map_def.h @@ -136,7 +136,7 @@ struct bpf_map_def { // unsigned int inner_map_idx; // unsigned int numa_node; - unsigned int zero; // uid_t, for compat with old (buggy) bpfloader must be AID_ROOT == 0 + unsigned int uid; // uid_t unsigned int gid; // gid_t unsigned int mode; // mode_t @@ -158,13 +158,11 @@ struct bpf_map_def { bool shared; // use empty string as 'file' component of pin path - allows cross .o map sharing char pad0[3]; // manually pad up to 4 byte alignment, may be used for extensions in the future - - unsigned int uid; // uid_t }; // This needs to be updated whenever the above structure definition is expanded. // These asserts are here to make sure we have cross-6-arch consistency. -_Static_assert(sizeof(struct bpf_map_def) == 120, "sizeof struct bpf_map_def != 120"); +_Static_assert(sizeof(struct bpf_map_def) == 116, "sizeof struct bpf_map_def != 116"); _Static_assert(__alignof__(struct bpf_map_def) == 4, "__alignof__ struct bpf_map_def != 4"); _Static_assert(_Alignof(struct bpf_map_def) == 4, "_Alignof struct bpf_map_def != 4");