mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-13 18:06:40 +07:00
d28c4393a7
This patch moves the entry.S:error_entry to .kprobes.text section, since code marked unsafe for kprobes jumps directly to entry.S::error_entry, that must be marked unsafe as well. This patch also moves all the ".previous.text" asm directives to ".previous" for kprobes section. AK: Following a similar i386 patch from Chuck Ebbert AK: Also merged Jeremy's fix in. +From: Jeremy Fitzhardinge <jeremy@goop.org> KPROBE_ENTRY does a .section .kprobes.text, and expects its users to do a .previous at the end of the function. Unfortunately, if any code within the function switches sections, for example .fixup, then the .previous ends up putting all subsequent code into .fixup. Worse, any subsequent .fixup code gets intermingled with the code its supposed to be fixing (which is also in .fixup). It's surprising this didn't cause more havok. The fix is to use .pushsection/.popsection, so this stuff nests properly. A further cleanup would be to get rid of all .section/.previous pairs, since they're inherently fragile. +From: Chuck Ebbert <76306.1226@compuserve.com> Because code marked unsafe for kprobes jumps directly to entry.S::error_code, that must be marked unsafe as well. The easiest way to do that is to move the page fault entry point to just before error_code and let it inherit the same section. Also moved all the ".previous" asm directives for kprobes sections to column 1 and removed ".text" from them. Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Andi Kleen <ak@suse.de>
68 lines
1.0 KiB
C
68 lines
1.0 KiB
C
#ifndef _LINUX_LINKAGE_H
|
|
#define _LINUX_LINKAGE_H
|
|
|
|
#include <asm/linkage.h>
|
|
|
|
#ifdef __cplusplus
|
|
#define CPP_ASMLINKAGE extern "C"
|
|
#else
|
|
#define CPP_ASMLINKAGE
|
|
#endif
|
|
|
|
#ifndef asmlinkage
|
|
#define asmlinkage CPP_ASMLINKAGE
|
|
#endif
|
|
|
|
#ifndef prevent_tail_call
|
|
# define prevent_tail_call(ret) do { } while (0)
|
|
#endif
|
|
|
|
#ifndef __ALIGN
|
|
#define __ALIGN .align 4,0x90
|
|
#define __ALIGN_STR ".align 4,0x90"
|
|
#endif
|
|
|
|
#ifdef __ASSEMBLY__
|
|
|
|
#define ALIGN __ALIGN
|
|
#define ALIGN_STR __ALIGN_STR
|
|
|
|
#ifndef ENTRY
|
|
#define ENTRY(name) \
|
|
.globl name; \
|
|
ALIGN; \
|
|
name:
|
|
#endif
|
|
|
|
#define KPROBE_ENTRY(name) \
|
|
.pushsection .kprobes.text, "ax"; \
|
|
ENTRY(name)
|
|
|
|
#define KPROBE_END(name) \
|
|
END(name); \
|
|
.popsection
|
|
|
|
#ifndef END
|
|
#define END(name) \
|
|
.size name, .-name
|
|
#endif
|
|
|
|
#ifndef ENDPROC
|
|
#define ENDPROC(name) \
|
|
.type name, @function; \
|
|
END(name)
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define NORET_TYPE /**/
|
|
#define ATTRIB_NORET __attribute__((noreturn))
|
|
#define NORET_AND noreturn,
|
|
|
|
#ifndef FASTCALL
|
|
#define FASTCALL(x) x
|
|
#define fastcall
|
|
#endif
|
|
|
|
#endif
|