Skip to content

Commit d8c1d79

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: make is_ttbrX_addr() noinstr-safe
We use is_ttbr0_addr() in noinstr code, but as it's only marked as inline, it's theoretically possible for the compiler to place it out-of-line and instrument it, which would be problematic. Mark is_ttbr0_addr() as __always_inline such that that can safely be used from noinstr code. For consistency, do the same to is_ttbr1_addr(). Note that while is_ttbr1_addr() calls arch_kasan_reset_tag(), this is a macro (and its callees are either macros or __always_inline), so there is not a risk of transient instrumentation. Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 9e75e74 commit d8c1d79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/processor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,13 @@ static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
308308
}
309309
#endif
310310

311-
static inline bool is_ttbr0_addr(unsigned long addr)
311+
static __always_inline bool is_ttbr0_addr(unsigned long addr)
312312
{
313313
/* entry assembly clears tags for TTBR0 addrs */
314314
return addr < TASK_SIZE;
315315
}
316316

317-
static inline bool is_ttbr1_addr(unsigned long addr)
317+
static __always_inline bool is_ttbr1_addr(unsigned long addr)
318318
{
319319
/* TTBR1 addresses may have a tag if KASAN_SW_TAGS is in use */
320320
return arch_kasan_reset_tag(addr) >= PAGE_OFFSET;

0 commit comments

Comments
 (0)