From eb85ea5f2a7bc1e65c08966a58d1fdce3c80fe07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 20 Nov 2024 19:32:07 +0000 Subject: [PATCH] Remove BpfBaseTest processgroup test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In practice this has to pass already due to netd_updatable init attaching BPF_CGROUP_INET_{E,IN}GRESS programs. This allows removing the processgroup shared lib dependency, which should allow switching it from C to C++ mangling. Thus we might be able to revert the revert (ie. reapply): https://android-review.googlesource.com/c/platform/system/core/+/3366140 in https://android-review.googlesource.com/c/platform/system/core/+/3369297 Test: TreeHugger Bug: 379796721 Signed-off-by: Maciej Żenczykowski Change-Id: I865d6705e4a6477d428261ef182173df1f5b4672 --- bpf/netd/Android.bp | 1 - bpf/netd/BpfBaseTest.cpp | 8 -------- bpf/netd/BpfHandler.cpp | 1 + 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/bpf/netd/Android.bp b/bpf/netd/Android.bp index fe4d999303..473c8c9429 100644 --- a/bpf/netd/Android.bp +++ b/bpf/netd/Android.bp @@ -82,7 +82,6 @@ cc_test { "libcutils", "liblog", "libnetdutils", - "libprocessgroup", ], compile_multilib: "both", multilib: { diff --git a/bpf/netd/BpfBaseTest.cpp b/bpf/netd/BpfBaseTest.cpp index 34dfbb4db7..4b8a04e944 100644 --- a/bpf/netd/BpfBaseTest.cpp +++ b/bpf/netd/BpfBaseTest.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -54,13 +53,6 @@ class BpfBasicTest : public NetNativeTestBase { BpfBasicTest() {} }; -TEST_F(BpfBasicTest, TestCgroupMounted) { - std::string cg2_path; - ASSERT_EQ(true, CgroupGetControllerPath(CGROUPV2_HIERARCHY_NAME, &cg2_path)); - ASSERT_EQ(0, access(cg2_path.c_str(), R_OK)); - ASSERT_EQ(0, access((cg2_path + "/cgroup.controllers").c_str(), R_OK)); -} - TEST_F(BpfBasicTest, TestTagSocket) { BpfMap cookieTagMap(COOKIE_TAG_MAP_PATH); ASSERT_TRUE(cookieTagMap.isValid()); diff --git a/bpf/netd/BpfHandler.cpp b/bpf/netd/BpfHandler.cpp index 50e03299c1..340acda0ad 100644 --- a/bpf/netd/BpfHandler.cpp +++ b/bpf/netd/BpfHandler.cpp @@ -97,6 +97,7 @@ static Status initPrograms(const char* cg2_path) { ALOGE("Failed to open the cgroup directory: %s", strerror(err)); return statusFromErrno(err, "Open the cgroup directory failed"); } + RETURN_IF_NOT_OK(checkProgramAccessible(XT_BPF_ALLOWLIST_PROG_PATH)); RETURN_IF_NOT_OK(checkProgramAccessible(XT_BPF_DENYLIST_PROG_PATH)); RETURN_IF_NOT_OK(checkProgramAccessible(XT_BPF_EGRESS_PROG_PATH));