提交 f4b3a000 编写于 作者: J Jingxian He 提交者: Yang Yingliang

pid: fix pid recover method kabi change

hulk inclusion
category: feature
bugzilla: 48159
CVE: N/A

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

Pid recover method add new member to task_truct,
which generates kabi change problem.
We use KABI_RESERVE of task_truct, instead of
adding new member to task_truct.
Signed-off-by: NJingxian He <hejingxian@huawei.com>
Reviewed-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b5758284
......@@ -164,7 +164,7 @@ static int set_fork_pid(unsigned long arg)
goto fault;
if (copy_from_user(&pid, buf, sizeof(int)))
goto fault;
current->fork_pid = pid;
current->fork_pid_union.fork_pid = pid;
return 0;
fault:
return -EFAULT;
......
......@@ -596,6 +596,13 @@ struct wake_q_node {
struct wake_q_node *next;
};
#ifdef CONFIG_PID_RESERVE
typedef union {
pid_t fork_pid;
unsigned long pid_reserve;
} fork_pid_t;
#endif
struct task_struct {
#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
......@@ -1206,9 +1213,6 @@ struct task_struct {
/* Used by LSM modules for access restriction: */
void *security;
#endif
#ifdef CONFIG_PID_RESERVE
int fork_pid;
#endif
/*
* New fields for task_struct should be added above here, so that
......@@ -1227,7 +1231,15 @@ struct task_struct {
KABI_RESERVE(3)
KABI_RESERVE(4)
#endif
#ifdef CONFIG_PID_RESERVE
#ifndef __GENKSYMS__
fork_pid_t fork_pid_union;
#else
KABI_RESERVE(5)
#endif
#else
KABI_RESERVE(5)
#endif
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
......
......@@ -181,7 +181,9 @@ struct task_struct init_task
.security = NULL,
#endif
#ifdef CONFIG_PID_RESERVE
.fork_pid = 0,
.fork_pid_union = {
.fork_pid = 0,
},
#endif
};
EXPORT_SYMBOL(init_task);
......
......@@ -189,7 +189,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)
pid_min = RESERVED_PIDS;
#ifdef CONFIG_PID_RESERVE
if (!current->fork_pid) {
if (!current->fork_pid_union.fork_pid) {
/*
* Store a null pointer so find_pid_ns does not find
* a partially initialized PID (see below).
......@@ -199,9 +199,9 @@ struct pid *alloc_pid(struct pid_namespace *ns)
GFP_ATOMIC);
} else {
/* Try to free the reserved fork_pid, and then use it to alloc pid. */
free_reserved_pid(&tmp->idr, current->fork_pid);
pid_min = current->fork_pid;
current->fork_pid = 0;
free_reserved_pid(&tmp->idr, current->fork_pid_union.fork_pid);
pid_min = current->fork_pid_union.fork_pid;
current->fork_pid_union.fork_pid = 0;
nr = idr_alloc(&tmp->idr, NULL, pid_min,
pid_min + 1,
GFP_ATOMIC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册