Revert "LinuxKPI: Add explicit software context to FPU sections"
kmalloc() support within FPU sections will be redone in other way.
This reverts commit 5a3bd28167.
Sponsored by: Serenity Cyber Security, LLC
Requested by: jhb
This commit is contained in:
@@ -33,11 +33,6 @@
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
|
||||
defined(__i386__) || defined(__powerpc64__)
|
||||
#define LKPI_HAVE_FPU_CTX
|
||||
#endif
|
||||
|
||||
struct domainset;
|
||||
struct thread;
|
||||
struct task_struct;
|
||||
@@ -45,7 +40,6 @@ struct task_struct;
|
||||
extern int linux_alloc_current(struct thread *, int flags);
|
||||
extern void linux_free_current(struct task_struct *);
|
||||
extern struct domainset *linux_get_vm_domain_set(int node);
|
||||
extern int linux_set_fpu_ctx(struct task_struct *);
|
||||
|
||||
static inline void
|
||||
linux_set_current(struct thread *td)
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
#define TASK_COMM_LEN (MAXCOMLEN + 1)
|
||||
|
||||
struct seq_file;
|
||||
struct fpu_kern_ctx;
|
||||
|
||||
struct work_struct;
|
||||
struct task_struct {
|
||||
@@ -90,7 +89,6 @@ struct task_struct {
|
||||
struct task_struct *group_leader;
|
||||
unsigned rcu_section[TS_RCU_TYPE_MAX];
|
||||
unsigned int fpu_ctx_level;
|
||||
struct fpu_kern_ctx *fpu_ctx;
|
||||
};
|
||||
|
||||
#define current ({ \
|
||||
|
||||
@@ -43,10 +43,6 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <vm/uma.h>
|
||||
|
||||
#ifdef LKPI_HAVE_FPU_CTX
|
||||
#include <machine/fpu.h>
|
||||
#endif
|
||||
|
||||
#ifdef DEV_APIC
|
||||
extern u_int first_msi_irq, num_msi_irqs;
|
||||
#endif
|
||||
@@ -157,16 +153,6 @@ linux_alloc_current(struct thread *td, int flags)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
linux_set_fpu_ctx(struct task_struct *task)
|
||||
{
|
||||
#ifdef LKPI_HAVE_FPU_CTX
|
||||
if (task->fpu_ctx == NULL && curthread->td_critnest == 0)
|
||||
task->fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NOWAIT);
|
||||
#endif
|
||||
return (task->fpu_ctx != NULL ? 0 : ENOMEM);
|
||||
}
|
||||
|
||||
struct mm_struct *
|
||||
linux_get_task_mm(struct task_struct *task)
|
||||
{
|
||||
@@ -190,10 +176,6 @@ void
|
||||
linux_free_current(struct task_struct *ts)
|
||||
{
|
||||
mmput(ts->mm);
|
||||
#ifdef LKPI_HAVE_FPU_CTX
|
||||
if (ts->fpu_ctx != NULL)
|
||||
fpu_kern_free_ctx(ts->fpu_ctx);
|
||||
#endif
|
||||
uma_zfree(linux_current_zone, ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,12 +30,11 @@
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#include <asm/fpu/api.h>
|
||||
|
||||
#ifdef LKPI_HAVE_FPU_CTX
|
||||
#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <machine/fpu.h>
|
||||
|
||||
@@ -48,20 +47,15 @@
|
||||
void
|
||||
lkpi_kernel_fpu_begin(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((current->fpu_ctx_level)++ == 0) {
|
||||
err = linux_set_fpu_ctx(current);
|
||||
fpu_kern_enter(curthread, current->fpu_ctx,
|
||||
err == 0 ? FPU_KERN_KTHR : FPU_KERN_NOCTX);
|
||||
}
|
||||
if ((current->fpu_ctx_level)++ == 0)
|
||||
fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX);
|
||||
}
|
||||
|
||||
void
|
||||
lkpi_kernel_fpu_end(void)
|
||||
{
|
||||
if (--(current->fpu_ctx_level) == 0)
|
||||
fpu_kern_leave(curthread, current->fpu_ctx);
|
||||
fpu_kern_leave(curthread, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user