Added additional logging to bpf handler

Bug: b/278923463
Test: Treehugger
Change-Id: I5b46b488723ebcde223b758c03c70fa8b1f14c25
This commit is contained in:
Nick Wille
2023-06-01 18:39:25 +00:00
parent 5e76b40973
commit 5076a021c8

View File

@@ -19,6 +19,7 @@
#include "BpfHandler.h" #include "BpfHandler.h"
#include <linux/bpf.h> #include <linux/bpf.h>
#include <inttypes.h>
#include <android-base/unique_fd.h> #include <android-base/unique_fd.h>
#include <bpf/WaitForProgsLoaded.h> #include <bpf/WaitForProgsLoaded.h>
@@ -243,6 +244,8 @@ int BpfHandler::tagSocket(int sockFd, uint32_t tag, uid_t chargeUid, uid_t realU
mCookieTagMap.getMap().get()); mCookieTagMap.getMap().get());
return -res.error().code(); return -res.error().code();
} }
ALOGD("Socket with cookie %" PRIu64 " tagged successfully with tag %" PRIu32 " uid %u "
"and real uid %u", sock_cookie, tag, chargeUid, realUid);
return 0; return 0;
} }
@@ -256,6 +259,7 @@ int BpfHandler::untagSocket(int sockFd) {
ALOGE("Failed to untag socket: %s", strerror(res.error().code())); ALOGE("Failed to untag socket: %s", strerror(res.error().code()));
return -res.error().code(); return -res.error().code();
} }
ALOGD("Socket with cookie %" PRIu64 " untagged successfully.", sock_cookie);
return 0; return 0;
} }