From: Lu Jialin lujialin4@huawei.com
hulk inclusion category: feature/cgroups bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=7 CVE: NA
--------
The patch adds ifndef(__GENKSYMS__) into cgroup_subsys.h, and this change is more nasty than it looks. It hides the fact that that we change the layout of "struct cgroup" and "struct css_set", they both have the subsys[CGROUP_SUBSYS_COUNT] member. I hope this is fine, the modular code has no reasons to access the private members after ->subsys[], and the helpers like cgroup_sane_behavior() shouldn't be used by external modules.
The patch also fixes the following compile warning caused by the fix kabi broken.
Signed-off-by: Lu Jialin lujialin4@huawei.com Reviewed-by: Chen Zhou chenzhou10@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- include/linux/cgroup_subsys.h | 2 ++ kernel/cgroup/cgroup.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 716e79baa796..e1dfab82f354 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h @@ -68,9 +68,11 @@ SUBSYS(rdma) SUBSYS(debug) #endif
+#if ((!defined __GENKSYMS__) || (!defined CONFIG_X86)) #if IS_ENABLED(CONFIG_CGROUP_FILES) SUBSYS(files) #endif +#endif
/* * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index e38da89fad66..79fa4e90499a 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -134,6 +134,12 @@ static const char *cgroup_subsys_name[] = { EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key); \ EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_on_dfl_key); #include <linux/cgroup_subsys.h> + +#if ((defined __GENKSYMS__) && (defined CONFIG_X86)) +#if IS_ENABLED(CONFIG_CGROUP_FILES) +SUBSYS(files) +#endif +#endif #undef SUBSYS
#define SUBSYS(_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys_enabled_key,