Merge "bpf: remove zero uid hack" into main

This commit is contained in:
Treehugger Robot 2025-07-15 20:05:22 -07:00 • committed by Android (Google) Code Review
commit 792f685d65
2 changed files with 2 additions and 6 deletions

View file

@ -941,8 +941,6 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
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);

View file

@ -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");