Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/syscalls/linux/socket_capability.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ TEST(SocketTest, SetMarkNeedsNetAdminOrRaw) {

AutoCapability cap_admin(CAP_NET_ADMIN, false);
AutoCapability cap_raw(CAP_NET_RAW, false);
EXPECT_THAT(setsockopt(bound.get(), SOL_SOCKET, SO_MARK, &mark, sizeof(mark)),
SyscallFailsWithErrno(EPERM));
const int ret =
setsockopt(bound.get(), SOL_SOCKET, SO_MARK, &mark, sizeof(mark));
if (ret == 0 && GvisorPlatform() == Platform::kNative) {
// Some kernels or cgroup policies allow SO_MARK without these capabilities.
GTEST_SKIP() << "SO_MARK was allowed without CAP_NET_ADMIN or CAP_NET_RAW";
}
EXPECT_THAT(ret, SyscallFailsWithErrno(EPERM));

int get_mark = 0;
socklen_t optlen = sizeof(get_mark);
Expand Down
Loading