diff options
| author | Maciej Żenczykowski <maze@google.com> | 2022-03-05 08:33:33 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-03-05 08:33:33 +0000 |
| commit | edf80c2da80c33093c394f59fd674fbc577d5e3c (patch) | |
| tree | 5cd0fc150b26ed3724cc409afb11d898e3366269 /netd/BpfHandlerTest.cpp | |
| parent | 171db11c5f1459c3ce83202477a603d1e0440d68 (diff) | |
| parent | 436547e368584ae71107c02b372403fe5451d127 (diff) | |
Merge "[CLATJ#30] Not allow tagSocket() to tag with uid AID_CLAT"
Diffstat (limited to 'netd/BpfHandlerTest.cpp')
| -rw-r--r-- | netd/BpfHandlerTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/netd/BpfHandlerTest.cpp b/netd/BpfHandlerTest.cpp index db59c7cf32..925a92f301 100644 --- a/netd/BpfHandlerTest.cpp +++ b/netd/BpfHandlerTest.cpp @@ -16,6 +16,7 @@ * BpfHandlerTest.cpp - unit tests for BpfHandler.cpp */ +#include <private/android_filesystem_config.h> #include <sys/socket.h> #include <gtest/gtest.h> @@ -208,6 +209,12 @@ TEST_F(BpfHandlerTest, TestTagSocketWithPermission) { EXPECT_EQ(0, mBh.untagSocket(v6socket)); expectNoTag(sockCookie); expectMapEmpty(mFakeCookieTagMap); + + // Tag a socket to AID_CLAT other then realUid. + int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); + ASSERT_NE(-1, sock); + ASSERT_EQ(-EPERM, mBh.tagSocket(sock, TEST_TAG, AID_CLAT, realUid)); + expectMapEmpty(mFakeCookieTagMap); } TEST_F(BpfHandlerTest, TestUntagInvalidSocket) { |
