mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-29 22:26:44 +07:00
1a79797b58
This will simplify future changes that want scratch variables early in the SYSENTER handler -- they'll be able to spill registers to the stack. It also lets us get rid of a SWAPGS_UNSAFE_STACK user. This does not depend on CONFIG_IA32_EMULATION=y because we'll want the stack space even without IA32 emulation. As far as I can tell, the reason that this wasn't done from day 1 is that we use IST for #DB and #BP, which is IMO rather nasty and causes a lot more problems than it solves. But, since #DB uses IST, we don't actually need a real stack for SYSENTER (because SYSENTER with TF set will invoke #DB on the IST stack rather than the SYSENTER stack). I want to remove IST usage from these vectors some day, and this patch is a prerequisite for that as well. Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@suse.de> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Borislav Petkov <bpetkov@suse.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Link: https://lkml.kernel.org/r/20171204150605.312726423@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
62 lines
1.7 KiB
C
62 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef __LINUX_KBUILD_H
|
|
# error "Please do not build this file directly, build asm-offsets.c instead"
|
|
#endif
|
|
|
|
#include <asm/ucontext.h>
|
|
|
|
#define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
|
|
static char syscalls[] = {
|
|
#include <asm/syscalls_32.h>
|
|
};
|
|
|
|
/* workaround for a warning with -Wmissing-prototypes */
|
|
void foo(void);
|
|
|
|
void foo(void)
|
|
{
|
|
OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
|
|
OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
|
|
OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
|
|
OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
|
|
OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
|
|
OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
|
|
OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
|
|
BLANK();
|
|
|
|
OFFSET(PT_EBX, pt_regs, bx);
|
|
OFFSET(PT_ECX, pt_regs, cx);
|
|
OFFSET(PT_EDX, pt_regs, dx);
|
|
OFFSET(PT_ESI, pt_regs, si);
|
|
OFFSET(PT_EDI, pt_regs, di);
|
|
OFFSET(PT_EBP, pt_regs, bp);
|
|
OFFSET(PT_EAX, pt_regs, ax);
|
|
OFFSET(PT_DS, pt_regs, ds);
|
|
OFFSET(PT_ES, pt_regs, es);
|
|
OFFSET(PT_FS, pt_regs, fs);
|
|
OFFSET(PT_GS, pt_regs, gs);
|
|
OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
|
|
OFFSET(PT_EIP, pt_regs, ip);
|
|
OFFSET(PT_CS, pt_regs, cs);
|
|
OFFSET(PT_EFLAGS, pt_regs, flags);
|
|
OFFSET(PT_OLDESP, pt_regs, sp);
|
|
OFFSET(PT_OLDSS, pt_regs, ss);
|
|
BLANK();
|
|
|
|
OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
|
|
BLANK();
|
|
|
|
/* Offset from the sysenter stack to tss.sp0 */
|
|
DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
|
|
offsetofend(struct tss_struct, SYSENTER_stack));
|
|
|
|
#ifdef CONFIG_CC_STACKPROTECTOR
|
|
BLANK();
|
|
OFFSET(stack_canary_offset, stack_canary, canary);
|
|
#endif
|
|
|
|
BLANK();
|
|
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
|
|
DEFINE(NR_syscalls, sizeof(syscalls));
|
|
}
|