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: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20211013145322.869001791@linutronix.de
This commit is contained in:
committed by
Borislav Petkov
parent
f0cbc8b3cd
commit
2dd8eedc80
@@ -461,9 +461,6 @@ DECLARE_PER_CPU(struct irq_stack *, hardirq_stack_ptr);
|
|||||||
DECLARE_PER_CPU(struct irq_stack *, softirq_stack_ptr);
|
DECLARE_PER_CPU(struct irq_stack *, softirq_stack_ptr);
|
||||||
#endif /* !X86_64 */
|
#endif /* !X86_64 */
|
||||||
|
|
||||||
extern unsigned int fpu_kernel_xstate_size;
|
|
||||||
extern unsigned int fpu_user_xstate_size;
|
|
||||||
|
|
||||||
struct perf_event;
|
struct perf_event;
|
||||||
|
|
||||||
struct thread_struct {
|
struct thread_struct {
|
||||||
@@ -537,12 +534,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,
|
static inline void arch_thread_struct_whitelist(unsigned long *offset,
|
||||||
unsigned long *size)
|
unsigned long *size)
|
||||||
{
|
{
|
||||||
*offset = offsetof(struct thread_struct, fpu.__fpstate.regs);
|
fpu_thread_struct_whitelist(offset, size);
|
||||||
*size = fpu_kernel_xstate_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|||||||
@@ -404,6 +404,16 @@ int fpu_clone(struct task_struct *dst)
|
|||||||
return 0;
|
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
|
* Drops current FPU state: deactivates the fpregs and
|
||||||
* the fpstate. NOTE: it still leaves previous contents
|
* the fpstate. NOTE: it still leaves previous contents
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#ifndef __X86_KERNEL_FPU_INTERNAL_H
|
#ifndef __X86_KERNEL_FPU_INTERNAL_H
|
||||||
#define __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;
|
extern struct fpstate init_fpstate;
|
||||||
|
|
||||||
/* CPU feature check wrappers */
|
/* CPU feature check wrappers */
|
||||||
|
|||||||
Reference in New Issue
Block a user