Commit 800d1646 authored by Guan Jing's avatar Guan Jing Committed by Zheng Zengkai
Browse files

KABI:reserve space for sched structures

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KAP1?from=project-issue


CVE: NA

--------
We reserve some fields beforehand for sched structures prone to change,
therefore, we can hot add/change features of sched with this enhancement.
After reserving, normally cache does not matter as the reserved fields
are not accessed at all.

Signed-off-by: default avatarGuan Jing <guanjing6@huawei.com>
Reviewed-by: default avatarChen Hui <judy.chenhui@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent f389569e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#define _LINUX_DELAYACCT_H

#include <uapi/linux/taskstats.h>
#include <linux/kabi.h>

/*
 * Per-task flags relevant to delay accounting
@@ -53,6 +54,9 @@ struct task_delay_info {

	u32 freepages_count;	/* total count of memory reclaim */
	u32 thrashing_count;	/* total count of thrash waits */

	KABI_RESERVE(1)
	KABI_RESERVE(2)
};
#endif

+30 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <linux/seqlock.h>
#include <linux/kcsan.h>
#include <linux/thread_bits.h>
#include <linux/kabi.h>

/* task_struct member predeclarations (sorted alphabetically): */
struct audit_context;
@@ -307,6 +308,10 @@ struct sched_info {
	/* When were we last queued to run? */
	unsigned long long		last_queued;

	KABI_RESERVE(1)
	KABI_RESERVE(2)
	KABI_RESERVE(3)
	KABI_RESERVE(4)
#endif /* CONFIG_SCHED_INFO */
};

@@ -455,6 +460,11 @@ struct sched_statistics {
	u64				nr_wakeups_affine_attempts;
	u64				nr_wakeups_passive;
	u64				nr_wakeups_idle;

	KABI_RESERVE(1)
	KABI_RESERVE(2)
	KABI_RESERVE(3)
	KABI_RESERVE(4)
#endif
};

@@ -494,6 +504,11 @@ struct sched_entity {
	 */
	struct sched_avg		avg;
#endif

	KABI_RESERVE(1)
	KABI_RESERVE(2)
	KABI_RESERVE(3)
	KABI_RESERVE(4)
};

struct sched_rt_entity {
@@ -512,6 +527,9 @@ struct sched_rt_entity {
	/* rq "owned" by this entity/group: */
	struct rt_rq			*my_q;
#endif

	KABI_RESERVE(1)
	KABI_RESERVE(2)
} __randomize_layout;

struct sched_dl_entity {
@@ -589,6 +607,9 @@ struct sched_dl_entity {
	 */
	struct sched_dl_entity *pi_se;
#endif

	KABI_RESERVE(1)
	KABI_RESERVE(2)
};

#ifdef CONFIG_UCLAMP_TASK
@@ -1369,6 +1390,15 @@ struct task_struct {
	 */
	randomized_struct_fields_end

	KABI_RESERVE(1)
	KABI_RESERVE(2)
	KABI_RESERVE(3)
	KABI_RESERVE(4)
	KABI_RESERVE(5)
	KABI_RESERVE(6)
	KABI_RESERVE(7)
	KABI_RESERVE(8)

	/* CPU-specific state of this task: */
	struct thread_struct		thread;

+6 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/posix-timers.h>
#include <linux/mm_types.h>
#include <asm/ptrace.h>
#include <linux/kabi.h>

/*
 * Types defining task->signal and task->sighand and APIs using them:
@@ -235,6 +236,11 @@ struct signal_struct {
						 * and may have inconsistent
						 * permissions.
						 */

	KABI_RESERVE(1)
	KABI_RESERVE(2)
	KABI_RESERVE(3)
	KABI_RESERVE(4)
} __randomize_layout;

/*
+4 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include <linux/topology.h>

#include <linux/sched/idle.h>
#include <linux/kabi.h>

/*
 * sched-domains (multiprocessor balancing) declarations:
@@ -152,6 +153,9 @@ struct sched_domain {
	};
	struct sched_domain_shared *shared;

	KABI_RESERVE(1)
	KABI_RESERVE(2)

	unsigned int span_weight;
	/*
	 * Span of all CPUs in this domain.
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/atomic.h>
#include <linux/refcount.h>
#include <linux/ratelimit.h>
#include <linux/kabi.h>

/*
 * Some day this will be a full-fledged user tracking system..
@@ -42,6 +43,9 @@ struct user_struct {

	/* Miscellaneous per-user rate limit */
	struct ratelimit_state ratelimit;

	KABI_RESERVE(1)
	KABI_RESERVE(2)
};

extern int uids_sysfs_init(void);
Loading