From: Linus Walleij <linus.walleij@linaro.org>
To: Russell King <linux@armlinux.org.uk>,
Sami Tolvanen <samitolvanen@google.com>,
Kees Cook <keescook@chromium.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev,
Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v2 5/9] ARM: delay: Turn delay functions into static inlines
Date: Thu, 07 Mar 2024 15:22:04 +0100 [thread overview]
Message-ID: <20240307-arm32-cfi-v2-5-cc74ea0306b3@linaro.org> (raw)
In-Reply-To: <20240307-arm32-cfi-v2-0-cc74ea0306b3@linaro.org>
The members of the vector table arm_delay_ops are called
directly using defines, but this is really confusing for
KCFI. Wrap the calls in static inlines and tag them with
__nocfi so things start to work.
Without this patch, platforms without a delay timer will
not boot (sticks in calibrating loop etc).
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/include/asm/delay.h | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index 1d069e558d8d..7d611b810b6c 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -55,7 +55,10 @@ extern struct arm_delay_ops {
unsigned long ticks_per_jiffy;
} arm_delay_ops;
-#define __delay(n) arm_delay_ops.delay(n)
+static inline void __nocfi __delay(unsigned long n)
+{
+ arm_delay_ops.delay(n);
+}
/*
* This function intentionally does not exist; if you see references to
@@ -76,8 +79,15 @@ extern void __bad_udelay(void);
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
-#define __udelay(n) arm_delay_ops.udelay(n)
-#define __const_udelay(n) arm_delay_ops.const_udelay(n)
+static inline void __nocfi __udelay(unsigned long n)
+{
+ arm_delay_ops.udelay(n);
+}
+
+static inline void __nocfi __const_udelay(unsigned long n)
+{
+ arm_delay_ops.const_udelay(n);
+}
#define udelay(n) \
(__builtin_constant_p(n) ? \
--
2.34.1
next prev parent reply other threads:[~2024-03-07 14:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 14:21 [PATCH v2 0/9] CFI for ARM32 using LLVM Linus Walleij
2024-03-07 14:22 ` [PATCH v2 1/9] ARM: Support CLANG CFI Linus Walleij
2024-03-07 14:22 ` [PATCH v2 2/9] ARM: tlbflush: Make TLB flushes into static inlines Linus Walleij
2024-03-07 14:22 ` [PATCH v2 3/9] ARM: bugs: Check in the vtable instead of defined aliases Linus Walleij
2024-03-07 14:22 ` [PATCH v2 4/9] ARM: proc: Use inlines instead of defines Linus Walleij
2024-03-07 14:22 ` Linus Walleij [this message]
2024-03-07 14:22 ` [PATCH v2 6/9] ARM: turn CPU cache flush functions into static inlines Linus Walleij
2024-03-07 14:22 ` [PATCH v2 7/9] ARM: page: Turn highpage accesses " Linus Walleij
2024-03-07 14:22 ` [PATCH v2 8/9] ARM: ftrace: Define ftrace_stub_graph Linus Walleij
2024-03-07 14:22 ` [PATCH v2 9/9] ARM: KCFI: Allow permissive CFI mode Linus Walleij
2024-03-07 18:58 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240307-arm32-cfi-v2-5-cc74ea0306b3@linaro.org \
--to=linus.walleij@linaro.org \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=samitolvanen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).