Skip to content

Commit 4585a93

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: move on_thread_stack() to <asm/stacktrace.h>
Currently on_thread_stack() is defined in <asm/processor.h>, depending upon definitiong from <asm/stacktrace.h> despite this header not being included. This ends up being fragile, and any user of on_thread_stack() must include both <asm/processor.h> and <asm/stacktrace.h>. We organised things this way due to header dependencies back in commit: 0b3e336 ("arm64: Add support for STACKLEAK gcc plugin") ... but now that we no longer use current_top_of_stack(), and given that stackleak includes <asm/stacktrace.h> via <linux/stackleak.h>, we no longer need the definition to live in <asm/processor.h>. Move on_thread_stack() to <asm/stacktrace.h>, where all its dependencies are guaranteed to be defined. This requires having arm64's irq.c explicitly include <asm/stacktrace.h>, and I've taken the opportunity to sort the includes, which were slightly out of order. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Kees Cook <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent c8c384d commit 4585a93

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

arch/arm64/include/asm/processor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,5 @@ long get_tagged_addr_ctrl(struct task_struct *task);
396396
#define GET_TAGGED_ADDR_CTRL() get_tagged_addr_ctrl(current)
397397
#endif
398398

399-
#define on_thread_stack() (on_task_stack(current, current_stack_pointer, 1))
400-
401399
#endif /* __ASSEMBLY__ */
402400
#endif /* __ASM_PROCESSOR_H */

arch/arm64/include/asm/stacktrace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ static inline bool on_task_stack(const struct task_struct *tsk,
5757
return stackinfo_on_stack(&info, sp, size);
5858
}
5959

60+
#define on_thread_stack() (on_task_stack(current, current_stack_pointer, 1))
61+
6062
#ifdef CONFIG_VMAP_STACK
6163
DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack);
6264

arch/arm64/kernel/irq.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@
1010
* Copyright (C) 2012 ARM Ltd.
1111
*/
1212

13-
#include <linux/irq.h>
14-
#include <linux/memory.h>
15-
#include <linux/smp.h>
1613
#include <linux/hardirq.h>
1714
#include <linux/init.h>
15+
#include <linux/irq.h>
1816
#include <linux/irqchip.h>
1917
#include <linux/kprobes.h>
18+
#include <linux/memory.h>
2019
#include <linux/scs.h>
2120
#include <linux/seq_file.h>
21+
#include <linux/smp.h>
2222
#include <linux/vmalloc.h>
2323
#include <asm/daifflags.h>
2424
#include <asm/exception.h>
25-
#include <asm/vmap_stack.h>
2625
#include <asm/softirq_stack.h>
26+
#include <asm/stacktrace.h>
27+
#include <asm/vmap_stack.h>
2728

2829
/* Only access this in an NMI enter/exit */
2930
DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts);

0 commit comments

Comments
 (0)