diff mbox series

[1/2] arm64: remove current_top_of_stack()

Message ID 20221117120902.3974163-2-mark.rutland@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: stack helper cleanups | expand

Commit Message

Mark Rutland Nov. 17, 2022, 12:09 p.m. UTC
We no longer use current_top_of_stack() on arm64, so it can be removed.

We introduced current_top_of_stack() for STACKLEAK in commit:

  0b3e336601b82c6a ("arm64: Add support for STACKLEAK gcc plugin")

... then we figured out the intended semantics were unclear, and
reworked it in commit:

  e85094c31ddb794a ("arm64: stackleak: fix current_top_of_stack()")

... then we removed the only user in commit:

  0cfa2ccd285d98ad ("stackleak: rework stack high bound handling")

Given that it's no longer used, and it's very easy to misuse, this patch
removes current_top_of_stack(). For the moment, on_thread_stack() is
left where it is as moving it will change some header dependencies.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/processor.h | 11 -----------
 1 file changed, 11 deletions(-)

Comments

Mark Brown Nov. 17, 2022, 3:46 p.m. UTC | #1
On Thu, Nov 17, 2022 at 12:09:01PM +0000, Mark Rutland wrote:
> We no longer use current_top_of_stack() on arm64, so it can be removed.
> 
> We introduced current_top_of_stack() for STACKLEAK in commit:

Reviewed-by: Mark Brown <broonie@kernel.org>
Kees Cook Nov. 17, 2022, 10:09 p.m. UTC | #2
On Thu, Nov 17, 2022 at 12:09:01PM +0000, Mark Rutland wrote:
> We no longer use current_top_of_stack() on arm64, so it can be removed.
> 
> We introduced current_top_of_stack() for STACKLEAK in commit:
> 
>   0b3e336601b82c6a ("arm64: Add support for STACKLEAK gcc plugin")
> 
> ... then we figured out the intended semantics were unclear, and
> reworked it in commit:
> 
>   e85094c31ddb794a ("arm64: stackleak: fix current_top_of_stack()")
> 
> ... then we removed the only user in commit:
> 
>   0cfa2ccd285d98ad ("stackleak: rework stack high bound handling")
> 
> Given that it's no longer used, and it's very easy to misuse, this patch
> removes current_top_of_stack(). For the moment, on_thread_stack() is
> left where it is as moving it will change some header dependencies.
> 
> There should be no functional change as a result of this patch.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>

Reviewed-by: Kees Cook <keescook@chromium.org>
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 445aa3af3b76..cf4eefaacafc 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -396,17 +396,6 @@  long get_tagged_addr_ctrl(struct task_struct *task);
 #define GET_TAGGED_ADDR_CTRL()		get_tagged_addr_ctrl(current)
 #endif
 
-/*
- * For CONFIG_GCC_PLUGIN_STACKLEAK
- *
- * These need to be macros because otherwise we get stuck in a nightmare
- * of header definitions for the use of task_stack_page.
- */
-
-/*
- * The top of the current task's task stack
- */
-#define current_top_of_stack()	((unsigned long)current->stack + THREAD_SIZE)
 #define on_thread_stack()	(on_task_stack(current, current_stack_pointer, 1))
 
 #endif /* __ASSEMBLY__ */