Merge "Perform map chmod *before* chown" am: e867b84dae am: 2c8f2fac61 am: a161c1bf8b

Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2143734

Change-Id: I7f89b4e9bbf5eef949160791d35515505165e2ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Maciej Żenczykowski 2022-07-01 21:01:42 +00:00 committed by Automerger Merge Worker
commit 5d9e2e4ef0

View file

@ -30,9 +30,9 @@
#include <sys/wait.h>
#include <unistd.h>
// This is BpfLoader v0.20
// This is BpfLoader v0.21
#define BPFLOADER_VERSION_MAJOR 0u
#define BPFLOADER_VERSION_MINOR 20u
#define BPFLOADER_VERSION_MINOR 21u
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
#include "bpf/BpfUtils.h"
@ -877,13 +877,6 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
return -err;
}
}
ret = chown(mapPinLoc.c_str(), (uid_t)md[i].uid, (gid_t)md[i].gid);
if (ret) {
int err = errno;
ALOGE("chown(%s, %u, %u) = %d [%d:%s]", mapPinLoc.c_str(), md[i].uid, md[i].gid,
ret, err, strerror(err));
return -err;
}
ret = chmod(mapPinLoc.c_str(), md[i].mode);
if (ret) {
int err = errno;
@ -891,6 +884,13 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
strerror(err));
return -err;
}
ret = chown(mapPinLoc.c_str(), (uid_t)md[i].uid, (gid_t)md[i].gid);
if (ret) {
int err = errno;
ALOGE("chown(%s, %u, %u) = %d [%d:%s]", mapPinLoc.c_str(), md[i].uid, md[i].gid,
ret, err, strerror(err));
return -err;
}
}
struct bpf_map_info map_info = {};