diff --git a/netd/Android.bp b/netd/Android.bp index 473460d173..4325d89aeb 100644 --- a/netd/Android.bp +++ b/netd/Android.bp @@ -35,6 +35,9 @@ cc_library { "BpfHandler.cpp", "NetdUpdatable.cpp", ], + static_libs: [ + "libmodules-utils-build", + ], shared_libs: [ "libbase", "liblog", diff --git a/netd/BpfHandler.cpp b/netd/BpfHandler.cpp index 8081d12947..64093743f8 100644 --- a/netd/BpfHandler.cpp +++ b/netd/BpfHandler.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -74,9 +75,11 @@ static Status checkProgramAccessible(const char* programPath) { } static Status initPrograms(const char* cg2_path) { + if (modules::sdklevel::IsAtLeastU() && !!strcmp(cg2_path, "/sys/fs/cgroup")) abort(); + unique_fd cg_fd(open(cg2_path, O_DIRECTORY | O_RDONLY | O_CLOEXEC)); if (cg_fd == -1) { - int ret = errno; + const int ret = errno; ALOGE("Failed to open the cgroup directory: %s", strerror(ret)); return statusFromErrno(ret, "Open the cgroup directory failed"); }