From 8b9958f055e2e909e4d0ce6279aef520cb0b64f8 Mon Sep 17 00:00:00 2001 From: Cheng Jian Date: Wed, 5 Feb 2020 12:30:53 +0800 Subject: [PATCH] membarrier/kabi: fix kabi for membarrier_state hulk inclusion category: feature bugzilla: 28332 CVE: NA ------------------------------------------------- Signed-off-by: Cheng Jian Reviewed-By: Xie XiuQi Signed-off-by: Yang Yingliang --- include/linux/mm_types.h | 20 ++++++++++---------- kernel/sched/sched.h | 11 +++++++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 178e9dee217a..bb4844973793 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -369,16 +369,6 @@ struct mm_struct { unsigned long highest_vm_end; /* highest vma end address */ pgd_t * pgd; -#ifdef CONFIG_MEMBARRIER - /** - * @membarrier_state: Flags controlling membarrier behavior. - * - * This field is close to @pgd to hopefully fit in the same - * cache-line, which needs to be touched by switch_mm(). - */ - atomic_t membarrier_state; -#endif - /** * @mm_users: The number of users including userspace. * @@ -449,6 +439,16 @@ struct mm_struct { struct core_state *core_state; /* coredumping support */ +#ifdef CONFIG_MEMBARRIER + /** + * @membarrier_state: Flags controlling membarrier behavior. + * + * This field is close to @pgd to hopefully fit in the same + * cache-line, which needs to be touched by switch_mm(). + */ + atomic_t membarrier_state; +#endif + #ifdef CONFIG_AIO spinlock_t ioctx_lock; struct kioctx_table __rcu *ioctx_table; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 2213dac95a16..378bf05237c6 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -843,10 +843,6 @@ struct rq { atomic_t nr_iowait; -#ifdef CONFIG_MEMBARRIER - int membarrier_state; -#endif - #ifdef CONFIG_SMP struct root_domain *rd; struct sched_domain *sd; @@ -930,7 +926,14 @@ struct rq { struct cpuidle_state *idle_state; #endif +#if defined(CONFIG_MEMBARRIER) && !defined(__GENKSYMS__) + union { + int membarrier_state; + long membarrier_state_KABI; + }; +#else KABI_RESERVE(1) +#endif KABI_RESERVE(2) }; -- GitLab