提交 328e6481 编写于 作者: G GONG, Ruiqi 提交者: Zheng Zengkai

kabi: reserve space for cred and user_namespace

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4MYYH
CVE: N/A

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

Reserve space in struct cred and struct user_namespace in advance to
prepare for merging a promising new feature [1] from kernel 5.14 and
some others in the future.

[1]: https://lkml.kernel.org/r/94d1dbecab060a6b116b0a2d1accd8ca1bbb4f5f.1619094428.git.legion@kernel.orgSigned-off-by: NGONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: Nweiyang wang <wangweiyang2@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 00422feb
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/uidgid.h> #include <linux/uidgid.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/user.h> #include <linux/sched/user.h>
#include <linux/kabi.h>
struct cred; struct cred;
struct inode; struct inode;
...@@ -150,6 +151,7 @@ struct cred { ...@@ -150,6 +151,7 @@ struct cred {
int non_rcu; /* Can we skip RCU deletion? */ int non_rcu; /* Can we skip RCU deletion? */
struct rcu_head rcu; /* RCU deletion hook */ struct rcu_head rcu; /* RCU deletion hook */
}; };
KABI_RESERVE(1) /* reserved for ucounts */
} __randomize_layout; } __randomize_layout;
extern void __put_cred(struct cred *); extern void __put_cred(struct cred *);
......
...@@ -50,6 +50,26 @@ enum ucount_type { ...@@ -50,6 +50,26 @@ enum ucount_type {
UCOUNT_INOTIFY_INSTANCES, UCOUNT_INOTIFY_INSTANCES,
UCOUNT_INOTIFY_WATCHES, UCOUNT_INOTIFY_WATCHES,
#endif #endif
/* These 15 members are reserved (with extra margin) for the future
* enlargement of enum ucount_type, as how RH8.1 did it. This number
* should be enough, as 6 of them are very likely to be used in the near
* future.
*/
UCOUNT_KABI_RESERVE1,
UCOUNT_KABI_RESERVE2,
UCOUNT_KABI_RESERVE3,
UCOUNT_KABI_RESERVE4,
UCOUNT_KABI_RESERVE5,
UCOUNT_KABI_RESERVE6,
UCOUNT_KABI_RESERVE7,
UCOUNT_KABI_RESERVE8,
UCOUNT_KABI_RESERVE9,
UCOUNT_KABI_RESERVE10,
UCOUNT_KABI_RESERVE11,
UCOUNT_KABI_RESERVE12,
UCOUNT_KABI_RESERVE13,
UCOUNT_KABI_RESERVE14,
UCOUNT_KABI_RESERVE15,
UCOUNT_COUNTS, UCOUNT_COUNTS,
}; };
......
...@@ -74,6 +74,22 @@ static struct ctl_table user_table[] = { ...@@ -74,6 +74,22 @@ static struct ctl_table user_table[] = {
UCOUNT_ENTRY("max_inotify_instances"), UCOUNT_ENTRY("max_inotify_instances"),
UCOUNT_ENTRY("max_inotify_watches"), UCOUNT_ENTRY("max_inotify_watches"),
#endif #endif
/* These corresponds to the reservation in enum ucount_type */
{ }, // UCOUNT_KABI_RESERVE1
{ }, // UCOUNT_KABI_RESERVE2
{ }, // UCOUNT_KABI_RESERVE3
{ }, // UCOUNT_KABI_RESERVE4
{ }, // UCOUNT_KABI_RESERVE5
{ }, // UCOUNT_KABI_RESERVE6
{ }, // UCOUNT_KABI_RESERVE7
{ }, // UCOUNT_KABI_RESERVE8
{ }, // UCOUNT_KABI_RESERVE9
{ }, // UCOUNT_KABI_RESERVE10
{ }, // UCOUNT_KABI_RESERVE11
{ }, // UCOUNT_KABI_RESERVE12
{ }, // UCOUNT_KABI_RESERVE13
{ }, // UCOUNT_KABI_RESERVE14
{ }, // UCOUNT_KABI_RESERVE15
{ } { }
}; };
#endif /* CONFIG_SYSCTL */ #endif /* CONFIG_SYSCTL */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册