mirror of
https://github.com/torvalds/linux.git
synced 2024-12-01 00:21:32 +00:00
c03e27506a
With gcc toplevel assembler statements that do not mark themselves as .text may end up in other sections. This causes LTO boot crashes because various assembler statements ended up in the middle of the initcall section. It's also a latent problem without LTO, although it's currently not known to cause any real problems. According to the gcc team it's expected behavior. Always mark all the top level assembler statements as text so that they switch to the right section. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20190330004743.29541-1-andi@firstfloor.org
22 lines
465 B
C
22 lines
465 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/error-injection.h>
|
|
#include <linux/kprobes.h>
|
|
|
|
asmlinkage void just_return_func(void);
|
|
|
|
asm(
|
|
".text\n"
|
|
".type just_return_func, @function\n"
|
|
".globl just_return_func\n"
|
|
"just_return_func:\n"
|
|
" ret\n"
|
|
".size just_return_func, .-just_return_func\n"
|
|
);
|
|
|
|
void override_function_with_return(struct pt_regs *regs)
|
|
{
|
|
regs->ip = (unsigned long)&just_return_func;
|
|
}
|
|
NOKPROBE_SYMBOL(override_function_with_return);
|