stop abusing netd's DAC override on prog accesses by using R/O fetch
and also use mapRetrieveRW(x) instead of bpfFdGet(x, 0) or mapRetrieve(x, 0)
Test: builds, treehugger, see above
Bug: 150040815
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1339962
Merged-In: I09206bd07eb3ecea5256422ed9b52b791079f75a
Change-Id: I09206bd07eb3ecea5256422ed9b52b791079f75a
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
index 9d7d6a1..3839962 100644
--- a/server/TrafficController.cpp
+++ b/server/TrafficController.cpp
@@ -202,7 +202,7 @@
static Status attachProgramToCgroup(const char* programPath, const unique_fd& cgroupFd,
bpf_attach_type type) {
- unique_fd cgroupProg(bpfFdGet(programPath, 0));
+ unique_fd cgroupProg(retrieveProgram(programPath));
if (cgroupProg == -1) {
int ret = errno;
ALOGE("Failed to get program from %s: %s", programPath, strerror(ret));