fgraph: Separate size of ret_stack from PAGE_SIZE
Steven Rostedt
maintainerPATCH 1/1 fgraph: Separate size of ret_stack from PAGE_SIZE
From: Steven Rostedt <[email protected]>
The ret_stack (shadow stack used by function graph infrastructure) is currently defined as PAGE_SIZE. But some architectures which have 64K PAGE_SIZE, this is way overkill. Also there's an effort to allow the PAGE_SIZE to be defined at boot up.
Hard code it for now to 4096. In the future, this size may change and even be dependent on specific architectures.
--- kernel/trace/fgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/fgraph.c +1 -1
@@ -153,7 +153,7 @@ enum {* SHADOW_STACK_OFFSET: The size in long words of the shadow stack * SHADOW_STACK_MAX_OFFSET: The max offset of the stack for a new frame to be added */ -#define SHADOW_STACK_SIZE (PAGE_SIZE) +#define SHADOW_STACK_SIZE (4096)#define SHADOW_STACK_OFFSET (SHADOW_STACK_SIZE / sizeof(long))/* Leave on a buffer at the end */ #define SHADOW_STACK_MAX_OFFSET \
Signature · 1 line
2.45.2
Quoted 7 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
The
ret_stack(shadow stack used by function graph infrastructure) is currently defined asPAGE_SIZE. But some architectures which have 64KPAGE_SIZE, this is way overkill. Also there's an effort to allow thePAGE_SIZEto be defined at boot up.
Quoted 7 lines
Hard code it for now to 4096. In the future, this size may change and even be dependent on specific architectures.
Suggested-by Ryan Roberts <[email protected]>Signed-off-by Steven Rostedt (Google) <[email protected]>
LGTM!
Quoted 17 lines
--- kernel/trace/fgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/fgraph.c +1
-1@@ -153,7 +153,7 @@ enum {* SHADOW_STACK_OFFSET: The size in long words of the shadow stack * SHADOW_STACK_MAX_OFFSET: The max offset of the stack for a new frame to be added */ -#define SHADOW_STACK_SIZE (PAGE_SIZE) +#define SHADOW_STACK_SIZE (4096)#define SHADOW_STACK_OFFSET (SHADOW_STACK_SIZE / sizeof(long))/* Leave on a buffer at the end */ #define SHADOW_STACK_MAX_OFFSET \
Quoted 7 lines · On Sat, 19 Oct 2024 15:29:51 -0400 Steven Rostedt <[email protected]> wrote:
From: Steven Rostedt <[email protected]>
The
ret_stack(shadow stack used by function graph infrastructure) is currently defined asPAGE_SIZE. But some architectures which have 64KPAGE_SIZE, this is way overkill. Also there's an effort to allow thePAGE_SIZEto be defined at boot up.
Quoted 5 lines
Hard code it for now to 4096. In the future, this size may change and even be dependent on specific architectures.
Looks good to me.
Thanks!
Quoted 22 lines
Suggested-by Ryan Roberts <[email protected]>Signed-off-by Steven Rostedt (Google) <[email protected]>--- kernel/trace/fgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/fgraph.c +1
-1@@ -153,7 +153,7 @@ enum {* SHADOW_STACK_OFFSET: The size in long words of the shadow stack * SHADOW_STACK_MAX_OFFSET: The max offset of the stack for a new frame to be added */ -#define SHADOW_STACK_SIZE (PAGE_SIZE) +#define SHADOW_STACK_SIZE (4096)#define SHADOW_STACK_OFFSET (SHADOW_STACK_SIZE / sizeof(long))/* Leave on a buffer at the end */ #define SHADOW_STACK_MAX_OFFSET \Signature · 1 line
2.45.2
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>