Adding some more kabi reserve padding to base structures before kernel freeze.
Ard Biesheuvel (7): riscv: rely on core code to keep thread_info::cpu updated powerpc: smp: remove hack to obtain offset of task_struct::cpu arm64: add CPU field to struct thread_info x86: add CPU field to struct thread_info s390: add CPU field to struct thread_info powerpc: add CPU field to struct thread_info sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y
Chen Jiahao (2): KABI: reserve space for several i2c structures KABI: reserve space for struct input_dev
Guan Jing (1): KABI: add reserve space for sched structures
Guo Zihua (1): KABI: KABI reservation for IMA namespace
Wang Hai (1): kabi: net: reserve space for some net subsystems related structure
Wang ShaoBo (1): kabi: reserve space for arm64 SME in thread_struct
Wenchao Hao (1): kabi:fuse: reserve space for future expansion
Yu Liao (1): kabi: Reserve space for struct acpi_device_power
arch/arm64/include/asm/processor.h | 9 +++++++++ arch/arm64/include/asm/thread_info.h | 1 + arch/arm64/kernel/asm-offsets.c | 1 + arch/powerpc/Makefile | 8 -------- arch/powerpc/include/asm/smp.h | 17 +--------------- arch/powerpc/include/asm/thread_info.h | 3 +++ arch/powerpc/kernel/asm-offsets.c | 4 +--- arch/powerpc/kernel/smp.c | 2 +- arch/riscv/kernel/asm-offsets.c | 1 - arch/riscv/kernel/entry.S | 5 ----- arch/riscv/kernel/head.S | 1 - arch/s390/include/asm/thread_info.h | 1 + arch/x86/include/asm/thread_info.h | 3 +++ fs/fuse/fuse_i.h | 10 +++++++++ include/acpi/acpi_bus.h | 3 +++ include/linux/fs.h | 2 ++ include/linux/i2c.h | 12 +++++++++++ include/linux/inetdevice.h | 4 ++++ include/linux/input.h | 4 ++++ include/linux/key-type.h | 2 ++ include/linux/key.h | 2 ++ include/linux/nsproxy.h | 9 +++++++++ include/linux/proc_ns.h | 2 +- include/linux/sched.h | 28 +++++++++++++++----------- include/net/devlink.h | 4 ++++ include/net/flow_dissector.h | 6 ++++++ include/net/sch_generic.h | 1 + include/net/tls.h | 10 +++++++++ include/net/xsk_buff_pool.h | 3 +++ kernel/sched/sched.h | 17 ++++++++++++---- 30 files changed, 123 insertions(+), 52 deletions(-)
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit 8aa0fb0fbb82a4d2395be7eaeb994653b2d869fc category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
------------------------------
Now that the core code switched back to using thread_info::cpu to keep a task's CPU number, we no longer need to keep it in sync explicitly. So just drop the code that does this.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Palmer Dabbelt palmerdabbelt@google.com Acked-by: Mark Rutland mark.rutland@arm.com Signed-off-by: Guan Jing guanjing6@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/riscv/kernel/asm-offsets.c | 1 - arch/riscv/kernel/entry.S | 5 ----- arch/riscv/kernel/head.S | 1 - 3 files changed, 7 deletions(-)
diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index 63fbcea8bc70..ddbc952e9eab 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c @@ -33,7 +33,6 @@ void asm_offsets(void) OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); - OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu);
OFFSET(TASK_THREAD_F0, task_struct, thread.fstate.f[0]); OFFSET(TASK_THREAD_F1, task_struct, thread.fstate.f[1]); diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 76274a4a1d8e..3a4f24a5b32b 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -432,11 +432,6 @@ ENTRY(__switch_to) REG_L s9, TASK_THREAD_S9_RA(a4) REG_L s10, TASK_THREAD_S10_RA(a4) REG_L s11, TASK_THREAD_S11_RA(a4) - /* Swap the CPU entry around. */ - lw a3, TASK_TI_CPU(a0) - lw a4, TASK_TI_CPU(a1) - sw a3, TASK_TI_CPU(a1) - sw a4, TASK_TI_CPU(a0) /* The offset of thread_info in task_struct is zero. */ move tp, a1 ret diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index 1a819c18bede..5fd9e8f21a26 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -272,7 +272,6 @@ clear_bss_done: call setup_trap_vector /* Restore C environment */ la tp, init_task - sw zero, TASK_TI_CPU(tp) la sp, init_thread_union + THREAD_SIZE
#ifdef CONFIG_KASAN
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit 336868afbaae2d153fc20268a21747c31e5071b8 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
------------------------------
Instead of relying on awful hacks to obtain the offset of the cpu field in struct task_struct, move it back into struct thread_info, which does not create the same level of circular dependency hell when trying to include the header file that defines it.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Mark Rutland mark.rutland@arm.com Acked-by: Michael Ellerman mpe@ellerman.id.au Signed-off-by: Guan Jing guanjing6@huawei.com
Conflicts: arch/powerpc/Makefile Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/powerpc/Makefile | 8 -------- arch/powerpc/include/asm/smp.h | 17 +---------------- arch/powerpc/kernel/asm-offsets.c | 2 -- 3 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 5c8c06215dd4..35bf7634e095 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -434,14 +434,6 @@ else endif endif
-ifdef CONFIG_SMP -prepare: task_cpu_prepare - -PHONY += task_cpu_prepare -task_cpu_prepare: prepare0 - $(eval KBUILD_CFLAGS += -D_TASK_CPU=$(shell awk '{if ($$2 == "TASK_CPU") print $$3;}' include/generated/asm-offsets.h)) -endif - PHONY += checkbin # Check toolchain versions: # - gcc-4.6 is the minimum kernel-wide version so nothing required. diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index 635bdf947105..25825d597709 100644 --- a/arch/powerpc/include/asm/smp.h +++ b/arch/powerpc/include/asm/smp.h @@ -82,22 +82,7 @@ int is_cpu_dead(unsigned int cpu); /* 32-bit */ extern int smp_hw_index[];
-/* - * This is particularly ugly: it appears we can't actually get the definition - * of task_struct here, but we need access to the CPU this task is running on. - * Instead of using task_struct we're using _TASK_CPU which is extracted from - * asm-offsets.h by kbuild to get the current processor ID. - * - * This also needs to be safeguarded when building asm-offsets.s because at - * that time _TASK_CPU is not defined yet. It could have been guarded by - * _TASK_CPU itself, but we want the build to fail if _TASK_CPU is missing - * when building something else than asm-offsets.s - */ -#ifdef GENERATING_ASM_OFFSETS -#define raw_smp_processor_id() (0) -#else -#define raw_smp_processor_id() (*(unsigned int *)((void *)current + _TASK_CPU)) -#endif +#define raw_smp_processor_id() (current_thread_info()->cpu) #define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
static inline int get_hard_smp_processor_id(int cpu) diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 5c125255571c..c5fe4be1c68a 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -9,8 +9,6 @@ * #defines from the assembly-language output. */
-#define GENERATING_ASM_OFFSETS /* asm/smp.h */ - #include <linux/compat.h> #include <linux/signal.h> #include <linux/sched.h>
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit 001430c1910df65ab805116c563aebd8a40ff23a category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
------------------------------
The CPU field will be moved back into thread_info even when THREAD_INFO_IN_TASK is enabled, so add it back to arm64's definition of struct thread_info.
Note that arm64 always has CONFIG_SMP=y so there is no point in guarding the CPU field with an #ifdef.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Catalin Marinas catalin.marinas@arm.com Acked-by: Mark Rutland mark.rutland@arm.com Signed-off-by: Guan Jing guanjing6@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm64/include/asm/thread_info.h | 1 + arch/arm64/kernel/asm-offsets.c | 1 + 2 files changed, 2 insertions(+)
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 8b9f936a860e..c826ad282dc9 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -45,6 +45,7 @@ struct thread_info { void *scs_base; void *scs_sp; #endif + u32 cpu; };
#define thread_saved_pc(tsk) \ diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 4ed1fec68907..560ae96660ee 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -28,6 +28,7 @@ int main(void) { DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); BLANK(); + DEFINE(TSK_TI_CPU, offsetof(struct task_struct, thread_info.cpu)); DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); DEFINE(TSK_TI_PREEMPT, offsetof(struct task_struct, thread_info.preempt_count)); DEFINE(TSK_TI_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit));
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit 5443f98fb9e06e765e24f9d894bf028accad8f71 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
------------------------------
The CPU field will be moved back into thread_info even when THREAD_INFO_IN_TASK is enabled, so add it back to x86's definition of struct thread_info.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Borislav Petkov bp@suse.de Acked-by: Mark Rutland mark.rutland@arm.com Signed-off-by: Guan Jing guanjing6@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/x86/include/asm/thread_info.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index e701f29b4881..7a931f95e1ce 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -56,6 +56,9 @@ struct task_struct; struct thread_info { unsigned long flags; /* low level flags */ u32 status; /* thread synchronous flags */ +#ifdef CONFIG_SMP + u32 cpu; /* current CPU */ +#endif };
#define INIT_THREAD_INFO(tsk) \
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit bd2e2632556a464bd07cc8e21f60738611a934af category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
-----------------------------
The CPU field will be moved back into thread_info even when THREAD_INFO_IN_TASK is enabled, so add it back to s390's definition of struct thread_info.
Note that s390 always has CONFIG_SMP=y so there is no point in guarding the CPU field with an #ifdef.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Mark Rutland mark.rutland@arm.com Acked-by: Heiko Carstens hca@linux.ibm.com Signed-off-by: Guan Jing guanjing6@huawei.com
Conflicts: arch/s390/include/asm/thread_info.h Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/s390/include/asm/thread_info.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index 13a04fcf7762..97983e99ec27 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h @@ -36,6 +36,7 @@ */ struct thread_info { unsigned long flags; /* low level flags */ + unsigned int cpu; /* current CPU */ };
/*
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit 227d735d889e0403f1659df6e2dece7633f380bc category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
------------------------------
The CPU field will be moved back into thread_info even when THREAD_INFO_IN_TASK is enabled, so add it back to powerpc's definition of struct thread_info.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Mark Rutland mark.rutland@arm.com Acked-by: Michael Ellerman mpe@ellerman.id.au Signed-off-by: Guan Jing guanjing6@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/powerpc/include/asm/thread_info.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index 46a210b03d2b..28d2908afaa7 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h @@ -48,6 +48,9 @@ struct thread_info { int preempt_count; /* 0 => preemptable, <0 => BUG */ +#ifdef CONFIG_SMP + unsigned int cpu; +#endif unsigned long local_flags; /* private flags for thread */ #ifdef CONFIG_LIVEPATCH unsigned long *livepatch_sp;
From: Ard Biesheuvel ardb@kernel.org
mainline inclusion from mainline-v5.16-rc1 commit bcf9033e5449bdcaa9bed46467a7141a8049dadb category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4Q94A CVE: NA
---------------------------
THREAD_INFO_IN_TASK moved the CPU field out of thread_info, but this causes some issues on architectures that define raw_smp_processor_id() in terms of this field, due to the fact that #include'ing linux/sched.h to get at struct task_struct is problematic in terms of circular dependencies.
Given that thread_info and task_struct are the same data structure anyway when THREAD_INFO_IN_TASK=y, let's move it back so that having access to the type definition of struct thread_info is sufficient to reference the CPU number of the current task.
Note that this requires THREAD_INFO_IN_TASK's definition of the task_thread_info() helper to be updated, as task_cpu() takes a pointer-to-const, whereas task_thread_info() (which is used to generate lvalues as well), needs a non-const pointer. So make it a macro instead.
Signed-off-by: Ard Biesheuvel ardb@kernel.org Acked-by: Catalin Marinas catalin.marinas@arm.com Acked-by: Mark Rutland mark.rutland@arm.com Acked-by: Michael Ellerman mpe@ellerman.id.au Signed-off-by: Guan Jing guanjing6@huawei.com
Conflicts: arch/arm64/kernel/head.S Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/kernel/smp.c | 2 +- include/linux/sched.h | 13 +------------ kernel/sched/sched.h | 4 ---- 4 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index c5fe4be1c68a..760f656efcf6 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -96,7 +96,7 @@ int main(void) #endif /* CONFIG_PPC64 */ OFFSET(TASK_STACK, task_struct, stack); #ifdef CONFIG_SMP - OFFSET(TASK_CPU, task_struct, cpu); + OFFSET(TASK_CPU, task_struct, thread_info.cpu); #endif
#ifdef CONFIG_LIVEPATCH diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index b7bed52a5a73..ab2d3446e628 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1103,7 +1103,7 @@ static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) paca_ptrs[cpu]->kstack = (unsigned long)task_stack_page(idle) + THREAD_SIZE - STACK_FRAME_OVERHEAD; #endif - idle->cpu = cpu; + task_thread_info(idle)->cpu = cpu; secondary_current = current_set[cpu] = idle; }
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3bc2f15df252..5cd59c883522 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -694,10 +694,6 @@ struct task_struct { #ifdef CONFIG_SMP int on_cpu; struct __call_single_node wake_entry; -#ifdef CONFIG_THREAD_INFO_IN_TASK - /* Current CPU: */ - unsigned int cpu; -#endif unsigned int wakee_flips; unsigned long wakee_flip_decay_ts; struct task_struct *last_wakee; @@ -1771,10 +1767,7 @@ extern struct thread_info init_thread_info; extern unsigned long init_stack[THREAD_SIZE / sizeof(unsigned long)];
#ifdef CONFIG_THREAD_INFO_IN_TASK -static inline struct thread_info *task_thread_info(struct task_struct *task) -{ - return &task->thread_info; -} +# define task_thread_info(task) (&(task)->thread_info) #elif !defined(__HAVE_THREAD_FUNCTIONS) # define task_thread_info(task) ((struct thread_info *)(task)->stack) #endif @@ -1970,11 +1963,7 @@ static __always_inline bool need_resched(void)
static inline unsigned int task_cpu(const struct task_struct *p) { -#ifdef CONFIG_THREAD_INFO_IN_TASK - return READ_ONCE(p->cpu); -#else return READ_ONCE(task_thread_info(p)->cpu); -#endif }
extern void set_task_cpu(struct task_struct *p, unsigned int cpu); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 451440e36318..66be40862d99 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1652,11 +1652,7 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu) * per-task data have been completed by this moment. */ smp_wmb(); -#ifdef CONFIG_THREAD_INFO_IN_TASK - WRITE_ONCE(p->cpu, cpu); -#else WRITE_ONCE(task_thread_info(p)->cpu, cpu); -#endif p->wake_cpu = cpu; #endif }
From: Guan Jing guanjing6@huawei.com
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: Guan Jing guanjing6@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/sched.h | 15 +++++++++++++++ kernel/sched/sched.h | 13 +++++++++++++ 2 files changed, 28 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5cd59c883522..c33f7a70629a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -668,6 +668,12 @@ struct wake_q_node { struct wake_q_node *next; };
+/** +* struct task_struct_resvd - KABI extension struct +*/ +struct task_struct_resvd { +}; + struct task_struct { #ifdef CONFIG_THREAD_INFO_IN_TASK /* @@ -1394,6 +1400,15 @@ struct task_struct { KABI_RESERVE(6) KABI_RESERVE(7) KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) + KABI_RESERVE(16) + KABI_AUX_PTR(task_struct)
/* CPU-specific state of this task: */ struct thread_struct thread; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 66be40862d99..d122f1b8e3e6 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -386,6 +386,11 @@ struct cfs_bandwidth { u64 throttled_time;
KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) #endif };
@@ -623,6 +628,8 @@ struct cfs_rq {
KABI_RESERVE(1) KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
static inline int rt_bandwidth_enabled(void) @@ -1091,6 +1098,12 @@ struct rq {
KABI_RESERVE(1) KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
#ifdef CONFIG_FAIR_GROUP_SCHED
From: Chen Jiahao chenjiahao16@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4QWBF CVE: NA
--------
Reserving some fields in struct i2c_bus_recovery_info, i2c_adapter, i2c_board_info and i2c_algorithm for future development.
Signed-off-by: Chen Jiahao chenjiahao16@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/i2c.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 75b42c72d454..58a721c23eca 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -20,6 +20,7 @@ #include <linux/of.h> /* for struct device_node */ #include <linux/swab.h> /* for swab16 */ #include <uapi/linux/i2c.h> +#include <linux/kabi.h>
extern struct bus_type i2c_bus_type; extern struct device_type i2c_adapter_type; @@ -422,6 +423,8 @@ struct i2c_board_info { const struct resource *resources; unsigned int num_resources; int irq; + + KABI_RESERVE(1) };
/** @@ -547,6 +550,9 @@ struct i2c_algorithm { int (*reg_slave)(struct i2c_client *client); int (*unreg_slave)(struct i2c_client *client); #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/** @@ -636,6 +642,9 @@ struct i2c_bus_recovery_info { struct pinctrl *pinctrl; struct pinctrl_state *pins_default; struct pinctrl_state *pins_gpio; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
int i2c_recover_bus(struct i2c_adapter *adap); @@ -726,6 +735,9 @@ struct i2c_adapter { const struct i2c_adapter_quirks *quirks;
struct irq_domain *host_notify_domain; + + KABI_RESERVE(1) + KABI_RESERVE(2) }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
From: Chen Jiahao chenjiahao16@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4QWCF CVE: NA
--------
Reserving some fields in struct input_dev for future development.
Signed-off-by: Chen Jiahao chenjiahao16@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/input.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/linux/input.h b/include/linux/input.h index 56f2fd32e609..08d1409ce222 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -20,6 +20,7 @@ #include <linux/fs.h> #include <linux/timer.h> #include <linux/mod_devicetable.h> +#include <linux/kabi.h>
struct input_dev_poller;
@@ -201,6 +202,9 @@ struct input_dev { bool devres_managed;
ktime_t timestamp[INPUT_CLK_MAX]; + + KABI_RESERVE(1) + KABI_RESERVE(2) }; #define to_input_dev(d) container_of(d, struct input_dev, dev)
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for some net subsystems framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/inetdevice.h | 4 ++++ include/net/devlink.h | 4 ++++ include/net/flow_dissector.h | 6 ++++++ include/net/sch_generic.h | 1 + include/net/tls.h | 10 ++++++++++ include/net/xsk_buff_pool.h | 3 +++ 6 files changed, 28 insertions(+)
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index b68fca08be27..a44812b24687 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -13,6 +13,7 @@ #include <linux/sysctl.h> #include <linux/rtnetlink.h> #include <linux/refcount.h> +#include <linux/kabi.h>
struct ipv4_devconf { void *sysctl; @@ -48,6 +49,9 @@ struct in_device { struct neigh_parms *arp_parms; struct ipv4_devconf cnf; struct rcu_head rcu_head; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
#define IPV4_DEVCONF(cnf, attr) ((cnf).data[IPV4_DEVCONF_ ## attr - 1]) diff --git a/include/net/devlink.h b/include/net/devlink.h index b01bb9bca5a2..dbfcb088c86a 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -19,6 +19,7 @@ #include <net/flow_offload.h> #include <uapi/linux/devlink.h> #include <linux/xarray.h> +#include <linux/kabi.h>
#define DEVLINK_RELOAD_STATS_ARRAY_SIZE \ (__DEVLINK_RELOAD_LIMIT_MAX * __DEVLINK_RELOAD_ACTION_MAX) @@ -52,6 +53,9 @@ struct devlink { struct mutex lock; /* Serializes access to devlink instance specific objects such as * port, sb, dpipe, resource, params, region, traps and more. */ + KABI_RESERVE(1) + KABI_RESERVE(2) + u8 reload_failed:1, reload_enabled:1, registered:1; diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index cc10b10dc3a1..31a748a52c90 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h @@ -7,6 +7,7 @@ #include <linux/siphash.h> #include <linux/string.h> #include <uapi/linux/if_ether.h> +#include <linux/kabi.h>
struct bpf_prog; struct net; @@ -316,6 +317,11 @@ struct flow_keys { struct flow_dissector_key_icmp icmp; /* 'addrs' must be the last member */ struct flow_dissector_key_addrs addrs; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define FLOW_KEYS_HASH_OFFSET \ diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 50dd8be91bf4..3696246d336a 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -116,6 +116,7 @@ struct Qdisc { struct rcu_head rcu;
KABI_RESERVE(1) + KABI_RESERVE(2)
/* private data */ long privdata[] ____cacheline_aligned; diff --git a/include/net/tls.h b/include/net/tls.h index 8e02a6ae247f..fee4e55bd8d9 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -50,6 +50,7 @@ #include <crypto/aead.h> #include <uapi/linux/tls.h>
+#include <linux/kabi.h>
/* Maximum data size carried in a TLS record */ #define TLS_MAX_PAYLOAD_SIZE ((size_t)1 << 14) @@ -167,6 +168,10 @@ struct tls_record_info { u32 end_seq; int len; int num_frags; + + KABI_RESERVE(1) + KABI_RESERVE(2) + skb_frag_t frags[MAX_SKB_FRAGS]; };
@@ -284,6 +289,11 @@ struct tls_context { struct list_head list; refcount_t refcount; struct rcu_head rcu; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
enum tls_offload_ctx_dir { diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h index 7a9a23e7a604..33bf0a584f7c 100644 --- a/include/net/xsk_buff_pool.h +++ b/include/net/xsk_buff_pool.h @@ -8,6 +8,7 @@ #include <linux/types.h> #include <linux/dma-mapping.h> #include <net/xdp.h> +#include <linux/kabi.h>
struct xsk_buff_pool; struct xdp_rxq_info; @@ -78,6 +79,8 @@ struct xsk_buff_pool { * sockets share a single cq when the same netdev and queue id is shared. */ spinlock_t cq_lock; + KABI_RESERVE(1) + KABI_RESERVE(2) struct xdp_buff_xsk *free_heads[]; };
From: Wenchao Hao haowenchao@huawei.com
euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4PF3R?from=project-issue
-------------------------------------------------
Reserve space for future fuse kabi expansion
Signed-off-by: Wenchao Hao haowenchao@huawei.com Reviewed-by: Wu Bo wubo40@huawei.com Reviewed-by: Zhang Yi yi.zhang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- fs/fuse/fuse_i.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index b159d8b5e893..ed71ef6fbc9d 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -31,6 +31,7 @@ #include <linux/pid_namespace.h> #include <linux/refcount.h> #include <linux/user_namespace.h> +#include <linux/kabi.h>
/** Default max number of pages that can be used in a single read request */ #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32 @@ -162,6 +163,8 @@ struct fuse_inode { */ struct fuse_inode_dax *dax; #endif + + KABI_RESERVE(1) };
/** FUSE inode state bits */ @@ -485,6 +488,8 @@ struct fuse_dev {
/** list entry on fc->devices */ struct list_head entry; + + KABI_RESERVE(1) };
struct fuse_fs_context { @@ -790,6 +795,11 @@ struct fuse_conn {
/** List of filesystems using this connection */ struct list_head mounts; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/*
From: Yu Liao liaoyu15@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4QQWY CVE: NA
--------------------------
Reserve space for struct acpi_device_power
Signed-off-by: Yu Liao liaoyu15@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/acpi/acpi_bus.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 6ad3b89a8a2e..a072afc7609a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -11,6 +11,7 @@
#include <linux/device.h> #include <linux/property.h> +#include <linux/kabi.h>
/* TBD: Make dynamic */ #define ACPI_MAX_HANDLES 10 @@ -277,6 +278,8 @@ struct acpi_device_power { int state; /* Current state */ struct acpi_device_power_flags flags; struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */ + + KABI_RESERVE(1) };
/* Performance Management */
From: Guo Zihua guozihua@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4REJ3 CVE: NA
---------------------------
KABI reservation for IMA namespace
reference: https://gitee.com/openeuler/kernel/issues/I49KW1
Signed-off-by: Guo Zihua guozihua@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/fs.h | 2 ++ include/linux/key-type.h | 2 ++ include/linux/key.h | 2 ++ include/linux/nsproxy.h | 9 +++++++++ include/linux/proc_ns.h | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h index b7f96c3c52ac..db632747781a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -968,6 +968,8 @@ struct file { struct address_space *f_mapping; errseq_t f_wb_err; errseq_t f_sb_err; /* for syncfs */ + + KABI_RESERVE(1) } __randomize_layout __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 2ab2d6d6aeab..9a595cc831ea 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h @@ -10,6 +10,7 @@
#include <linux/key.h> #include <linux/errno.h> +#include <linux/kabi.h>
#ifdef CONFIG_KEYS
@@ -55,6 +56,7 @@ struct key_match_data { unsigned lookup_type; /* Type of lookup for this search. */ #define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */ #define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */ + KABI_RESERVE(1) };
/* diff --git a/include/linux/key.h b/include/linux/key.h index eed3ce139a32..6657ca910034 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -20,6 +20,7 @@ #include <linux/assoc_array.h> #include <linux/refcount.h> #include <linux/time64.h> +#include <linux/kabi.h>
#ifdef __KERNEL__ #include <linux/uidgid.h> @@ -272,6 +273,7 @@ struct key { * restriction. */ struct key_restriction *restrict_link; + KABI_RESERVE(1) };
extern struct key *key_alloc(struct key_type *type, diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index cdb171efc7cb..be2d42c27780 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h @@ -4,6 +4,7 @@
#include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/kabi.h>
struct mnt_namespace; struct uts_namespace; @@ -38,6 +39,14 @@ struct nsproxy { struct time_namespace *time_ns; struct time_namespace *time_ns_for_children; struct cgroup_namespace *cgroup_ns; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) }; extern struct nsproxy init_nsproxy;
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h index 75807ecef880..81e99aa97cd7 100644 --- a/include/linux/proc_ns.h +++ b/include/linux/proc_ns.h @@ -16,7 +16,7 @@ struct inode; struct proc_ns_operations { const char *name; const char *real_ns_name; - int type; + u64 type; struct ns_common *(*get)(struct task_struct *task); void (*put)(struct ns_common *ns); int (*install)(struct nsset *nsset, struct ns_common *ns);
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4QPLR CVE: NA
Reference: https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211210184133.3...
-------------------------------
Reserve space for arm64 SME in thread_struct.
According to the implementation of SME, we need to reserve space for the following fields like this:
+enum vec_type { + ARM64_VEC_SVE = 0, + ARM64_VEC_SME, + ARM64_VEC_MAX, +}; + struct thread_struct { struct cpu_context cpu_context; /* cpu context */
@@ -149,8 +155,6 @@ struct thread_struct {
unsigned int fpsimd_cpu; void *sve_state; /* SVE registers, if any */ - unsigned int sve_vl; /* SVE vector length */ - unsigned int sve_vl_onexec; /* SVE vl after next exec */ unsigned long fault_address; /* fault info */ unsigned long fault_code; /* ESR_EL1 value */ struct debug_info debug; /* debugging */ @@ -162,6 +166,11 @@ struct thread_struct { u64 sctlr_tcf0; u64 gcr_user_incl; #endif + void *za_state; /* ZA register, if any */ + unsigned int vl[ARM64_VEC_MAX]; /* vector length */ + unsigned int vl_onexec[ARM64_VEC_MAX]; /* vl after next exec */ + u64 svcr; + u64 tpidr2_el0; };
This requires at least five 64bit spaces, other three for expansion.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm64/include/asm/processor.h | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 44968ffc322b..d94d60d01d9e 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -32,6 +32,7 @@ #include <linux/stddef.h> #include <linux/string.h> #include <linux/thread_info.h> +#include <linux/kabi.h>
#include <vdso/processor.h>
@@ -162,6 +163,14 @@ struct thread_struct { u64 sctlr_tcf0; u64 gcr_user_incl; #endif + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
static inline void arch_thread_struct_whitelist(unsigned long *offset,