提交 4dd9f6ac 编写于 作者: Y Yang Yingliang

signal: fix kabi changes in struct task_struct

hulk inclusion
category: kabi
bugzilla: NA
CVE: CVE-2020-10741, CVE-2020-12826

---------------------------

Commit d1e7fd64 ("signal: Extend exec_id to 64bits") can fixes
CVE-2020-10741 and CVE-2020-12826, but it introduces a kabi change
in struct task_strcut. Fix this kabi broken by using another new
64bits variables parent_exec_id_u64 and self_exec_id_u64.
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 1f4a4074
...@@ -1380,6 +1380,7 @@ void setup_new_exec(struct linux_binprm * bprm) ...@@ -1380,6 +1380,7 @@ void setup_new_exec(struct linux_binprm * bprm)
/* An exec changes our domain. We are no longer part of the thread /* An exec changes our domain. We are no longer part of the thread
group */ group */
WRITE_ONCE(current->self_exec_id, current->self_exec_id + 1); WRITE_ONCE(current->self_exec_id, current->self_exec_id + 1);
WRITE_ONCE(current->self_exec_id_u64, current->self_exec_id_u64 + 1);
flush_signal_handlers(current, 0); flush_signal_handlers(current, 0);
} }
EXPORT_SYMBOL(setup_new_exec); EXPORT_SYMBOL(setup_new_exec);
......
...@@ -892,8 +892,8 @@ struct task_struct { ...@@ -892,8 +892,8 @@ struct task_struct {
struct seccomp seccomp; struct seccomp seccomp;
/* Thread group tracking: */ /* Thread group tracking: */
u64 parent_exec_id; u32 parent_exec_id;
u64 self_exec_id; u32 self_exec_id;
/* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */ /* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */
spinlock_t alloc_lock; spinlock_t alloc_lock;
...@@ -1212,8 +1212,13 @@ struct task_struct { ...@@ -1212,8 +1212,13 @@ struct task_struct {
*/ */
randomized_struct_fields_end randomized_struct_fields_end
#ifndef __GENKSYMS__
u64 parent_exec_id_u64;
u64 self_exec_id_u64;
#else
KABI_RESERVE(1) KABI_RESERVE(1)
KABI_RESERVE(2) KABI_RESERVE(2)
#endif
KABI_RESERVE(3) KABI_RESERVE(3)
KABI_RESERVE(4) KABI_RESERVE(4)
KABI_RESERVE(5) KABI_RESERVE(5)
......
...@@ -2055,9 +2055,11 @@ static __latent_entropy struct task_struct *copy_process( ...@@ -2055,9 +2055,11 @@ static __latent_entropy struct task_struct *copy_process(
if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) { if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
p->real_parent = current->real_parent; p->real_parent = current->real_parent;
p->parent_exec_id = current->parent_exec_id; p->parent_exec_id = current->parent_exec_id;
p->parent_exec_id_u64 = current->parent_exec_id_u64;
} else { } else {
p->real_parent = current; p->real_parent = current;
p->parent_exec_id = current->self_exec_id; p->parent_exec_id = current->self_exec_id;
p->parent_exec_id_u64 = current->self_exec_id_u64;
} }
klp_copy_process(p); klp_copy_process(p);
......
...@@ -1827,7 +1827,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig) ...@@ -1827,7 +1827,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
* This is only possible if parent == real_parent. * This is only possible if parent == real_parent.
* Check if it has changed security domain. * Check if it has changed security domain.
*/ */
if (tsk->parent_exec_id != READ_ONCE(tsk->parent->self_exec_id)) if (tsk->parent_exec_id_u64 != READ_ONCE(tsk->parent->self_exec_id_u64))
sig = SIGCHLD; sig = SIGCHLD;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册