Commit 328e6481 authored by GONG, Ruiqi's avatar GONG, Ruiqi Committed by Zheng Zengkai
Browse files

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.org



Signed-off-by: default avatarGONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: default avatarweiyang wang <wangweiyang2@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 00422feb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/uidgid.h>
#include <linux/sched.h>
#include <linux/sched/user.h>
#include <linux/kabi.h>

struct cred;
struct inode;
@@ -150,6 +151,7 @@ struct cred {
		int non_rcu;			/* Can we skip RCU deletion? */
		struct rcu_head	rcu;		/* RCU deletion hook */
	};
	KABI_RESERVE(1)			/* reserved for ucounts */
} __randomize_layout;

extern void __put_cred(struct cred *);
+20 −0
Original line number Diff line number Diff line
@@ -50,6 +50,26 @@ enum ucount_type {
	UCOUNT_INOTIFY_INSTANCES,
	UCOUNT_INOTIFY_WATCHES,
#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,
};

+16 −0
Original line number Diff line number Diff line
@@ -74,6 +74,22 @@ static struct ctl_table user_table[] = {
	UCOUNT_ENTRY("max_inotify_instances"),
	UCOUNT_ENTRY("max_inotify_watches"),
#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 */