diff --git a/CMakeLists.txt b/CMakeLists.txt index b065eef2d..99ed10da2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -409,6 +409,14 @@ install(FILES PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) # Install configuration files +if(ENABLE_BPF) + install(FILES + ${CMAKE_BINARY_DIR}/src/Misc/BPF/cgroup_dev_bpf.o + DESTINATION /usr/local/lib64/bpf/ + COMPONENT cranedc + PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) +endif() + install(FILES ${CMAKE_SOURCE_DIR}/etc/config.yaml DESTINATION /etc/crane/ COMPONENT cranectldc diff --git a/src/Craned/CgroupManager.cpp b/src/Craned/CgroupManager.cpp index 6c97870cf..a5ed60d03 100644 --- a/src/Craned/CgroupManager.cpp +++ b/src/Craned/CgroupManager.cpp @@ -1322,8 +1322,8 @@ bool CgroupV2::SetDeviceAccess(const std::unordered_set &devices, auto &bpf_devices = m_cgroup_bpf_devices; for (const auto &[_, this_device] : Craned::g_this_node_device) { - if (!devices.contains(this_device->dev_id)) { - for (const auto &dev_meta : this_device->device_metas) { + if (!devices.contains(this_device->slot_id)) { + for (const auto &dev_meta : this_device->device_file_metas) { short op_type = 0; if (dev_meta.op_type == 'c') { op_type |= BPF_DEVCG_DEV_CHAR; diff --git a/src/Craned/CgroupManager.h b/src/Craned/CgroupManager.h index f88d338e4..68e700ca4 100644 --- a/src/Craned/CgroupManager.h +++ b/src/Craned/CgroupManager.h @@ -93,7 +93,7 @@ enum class ControllerFile : uint64_t { inline const char *kTaskCgPathPrefix = "Crane_Task_"; inline const char *RootCgroupFullPath = "/sys/fs/cgroup"; #ifdef CRANE_ENABLE_BPF -inline const char *BpfObjectFile = "/etc/crane/cgroup_dev_bpf.o"; +inline const char *BpfObjectFile = "/usr/local/lib64/bpf/cgroup_dev_bpf.o"; inline const char *BpfDeviceMapFile = "/sys/fs/bpf/craned_dev_map"; inline const char *BpfMapName = "craned_dev_map"; inline const char *BpfProgramName = "craned_device_access";