mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
01684e72f1
With link time optimizations enabled, I get a link failure:
./ccLbOEHX.ltrans19.ltrans.o: In function `override_function_with_return':
<artificial>:(.text+0x7f3): undefined reference to `just_return_func'
Marking the symbol .globl makes it work as expected.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 540adea380
("error-injection: Separate error-injection from kprobe")
Link: http://lkml.kernel.org/r/20180202145634.200291-3-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
21 lines
454 B
C
21 lines
454 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/error-injection.h>
|
|
#include <linux/kprobes.h>
|
|
|
|
asmlinkage void just_return_func(void);
|
|
|
|
asm(
|
|
".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);
|