提交 d5bdb8d8 编写于 作者: T Thomas Gleixner 提交者: Aichun Shi

x86/process: Move arch_thread_struct_whitelist() out of line

mainline inclusion
from mainline-v5.16-rc1
commit 2dd8eedc
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I590ZC
CVE: NA

Intel-SIG: commit 2dd8eedc x86/process: Move arch_thread_struct_whitelist() out of line.

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

In preparation for dynamically enabled FPU features move the function
out of line as the goal is to expose less and not more information.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211013145322.869001791@linutronix.deSigned-off-by: NLin Wang <lin.x.wang@intel.com>
Signed-off-by: NAichun Shi <aichun.shi@intel.com>
上级 80893d3a
......@@ -493,9 +493,6 @@ DECLARE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
DECLARE_PER_CPU(struct irq_stack *, softirq_stack_ptr);
#endif /* X86_64 */
extern unsigned int fpu_kernel_xstate_size;
extern unsigned int fpu_user_xstate_size;
struct perf_event;
struct thread_struct {
......@@ -570,12 +567,12 @@ struct thread_struct {
*/
};
/* Whitelist the FPU register state from the task_struct for hardened usercopy. */
extern void fpu_thread_struct_whitelist(unsigned long *offset, unsigned long *size);
static inline void arch_thread_struct_whitelist(unsigned long *offset,
unsigned long *size)
{
*offset = offsetof(struct thread_struct, fpu.__fpstate.regs);
*size = fpu_kernel_xstate_size;
fpu_thread_struct_whitelist(offset, size);
}
static inline void
......
......@@ -404,6 +404,16 @@ int fpu_clone(struct task_struct *dst)
return 0;
}
/*
* Whitelist the FPU register state embedded into task_struct for hardened
* usercopy.
*/
void fpu_thread_struct_whitelist(unsigned long *offset, unsigned long *size)
{
*offset = offsetof(struct thread_struct, fpu.__fpstate.regs);
*size = fpu_kernel_xstate_size;
}
/*
* Drops current FPU state: deactivates the fpregs and
* the fpstate. NOTE: it still leaves previous contents
......
......@@ -2,6 +2,8 @@
#ifndef __X86_KERNEL_FPU_INTERNAL_H
#define __X86_KERNEL_FPU_INTERNAL_H
extern unsigned int fpu_kernel_xstate_size;
extern unsigned int fpu_user_xstate_size;
extern struct fpstate init_fpstate;
/* CPU feature check wrappers */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册