From: Ma Wupeng mawupeng1@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9HSOM CVE: NA
-------------------------------
Move oom_reaper_timer from task_struct to task_struct_resvd to fix KABI broken.
Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- include/linux/sched.h | 4 +++- mm/oom_kill.c | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h index dff84406bd49..26255b76ca52 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -629,6 +629,9 @@ struct task_struct_resvd { */ struct task_struct *task;
+#ifdef CONFIG_MMU + struct timer_list oom_reaper_timer; +#endif #ifdef CONFIG_QOS_SCHED_SMART_GRID struct sched_grid_qos *grid_qos; #endif @@ -1236,7 +1239,6 @@ struct task_struct { int pagefault_disabled; #ifdef CONFIG_MMU struct task_struct *oom_reaper_list; - struct timer_list oom_reaper_timer; #endif #ifdef CONFIG_VMAP_STACK struct vm_struct *stack_vm_area; diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 31d2bafc8a9b..d917e1e47f7d 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -744,8 +744,9 @@ static int oom_reaper(void *unused)
static void wake_oom_reaper(struct timer_list *timer) { - struct task_struct *tsk = container_of(timer, struct task_struct, - oom_reaper_timer); + struct task_struct_resvd *tsk_resvd = container_of(timer, + struct task_struct_resvd, oom_reaper_timer); + struct task_struct *tsk = tsk_resvd->task; struct mm_struct *mm = tsk->signal->oom_mm; unsigned long flags;
@@ -779,9 +780,9 @@ static void queue_oom_reaper(struct task_struct *tsk) return;
get_task_struct(tsk); - timer_setup(&tsk->oom_reaper_timer, wake_oom_reaper, 0); - tsk->oom_reaper_timer.expires = jiffies + OOM_REAPER_DELAY; - add_timer(&tsk->oom_reaper_timer); + timer_setup(&tsk->_resvd->oom_reaper_timer, wake_oom_reaper, 0); + tsk->_resvd->oom_reaper_timer.expires = jiffies + OOM_REAPER_DELAY; + add_timer(&tsk->_resvd->oom_reaper_timer); }
static int __init oom_init(void)