mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
Revert "x86/ftrace: Use alternative RET encoding"
This reverts commit3eb602ad6a
. Revert the backport of upstream commit1f001e9da6
("x86/ftrace: Use alternative RET encoding") in favor of a proper backport after backporting the commit which adds __text_gen_insn(). Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
70d92abbe2
commit
c13d426040
@ -311,7 +311,7 @@ union ftrace_op_code_union {
|
|||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RET_SIZE (IS_ENABLED(CONFIG_RETPOLINE) ? 5 : 1 + IS_ENABLED(CONFIG_SLS))
|
#define RET_SIZE 1 + IS_ENABLED(CONFIG_SLS)
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
|
create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
|
||||||
@ -367,12 +367,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ip = trampoline + size;
|
ip = trampoline + size;
|
||||||
|
memcpy(ip, retq, RET_SIZE);
|
||||||
/* The trampoline ends with ret(q) */
|
|
||||||
if (cpu_feature_enabled(X86_FEATURE_RETHUNK))
|
|
||||||
memcpy(ip, text_gen_insn(JMP32_INSN_OPCODE, ip, &__x86_return_thunk), JMP32_INSN_SIZE);
|
|
||||||
else
|
|
||||||
memcpy(ip, retq, sizeof(retq));
|
|
||||||
|
|
||||||
/* No need to test direct calls on created trampolines */
|
/* No need to test direct calls on created trampolines */
|
||||||
if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
|
if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user