mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-25 11:55:37 +00:00
samples: ftrace: Include the nospec-branch.h only for x86
When other architectures without the nospec functionality write their
direct-call functions of samples/ftrace/*.c, the including of
asm/nospec-branch.h must be taken care to fix the no header file found
error in building process.
This commit (ee3e2469b3
"x86/ftrace: Make it call depth tracking aware")
file-globally includes asm/nospec-branch.h providing CALL_DEPTH_ACCOUNT
for only x86 direct-call functions.
It seems better to move the including to `#ifdef CONFIG_X86_64`.
Link: https://lore.kernel.org/linux-trace-kernel/20230130085954.647845-1-suagrfillet@gmail.com
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
a9c4bdd505
commit
01678fbce3
5 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,6 @@
|
|||
#include <linux/kthread.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
extern void my_direct_func1(void);
|
||||
extern void my_direct_func2(void);
|
||||
|
@ -26,6 +25,7 @@ static unsigned long my_ip = (unsigned long)schedule;
|
|||
#ifdef CONFIG_X86_64
|
||||
|
||||
#include <asm/ibt.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <linux/kthread.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
extern void my_direct_func1(unsigned long ip);
|
||||
extern void my_direct_func2(unsigned long ip);
|
||||
|
@ -24,6 +23,7 @@ extern void my_tramp2(void *);
|
|||
#ifdef CONFIG_X86_64
|
||||
|
||||
#include <asm/ibt.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <linux/ftrace.h>
|
||||
#include <linux/sched/stat.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
extern void my_direct_func(unsigned long ip);
|
||||
|
||||
|
@ -19,6 +18,7 @@ extern void my_tramp(void *);
|
|||
#ifdef CONFIG_X86_64
|
||||
|
||||
#include <asm/ibt.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <linux/mm.h> /* for handle_mm_fault() */
|
||||
#include <linux/ftrace.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
extern void my_direct_func(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned int flags);
|
||||
|
@ -21,6 +20,7 @@ extern void my_tramp(void *);
|
|||
#ifdef CONFIG_X86_64
|
||||
|
||||
#include <asm/ibt.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <linux/sched.h> /* for wake_up_process() */
|
||||
#include <linux/ftrace.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
extern void my_direct_func(struct task_struct *p);
|
||||
|
||||
|
@ -18,6 +17,7 @@ extern void my_tramp(void *);
|
|||
#ifdef CONFIG_X86_64
|
||||
|
||||
#include <asm/ibt.h>
|
||||
#include <asm/nospec-branch.h>
|
||||
|
||||
asm (
|
||||
" .pushsection .text, \"ax\", @progbits\n"
|
||||
|
|
Loading…
Reference in a new issue