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 v5 01/10] ARM: bugs: Check in the vtable instead of defined aliases
Date: Mon, 15 Apr 2024 15:43:20 +0200 [thread overview]
Message-ID: <20240415-arm32-cfi-v5-1-ff11093eeccc@linaro.org> (raw)
In-Reply-To: <20240415-arm32-cfi-v5-0-ff11093eeccc@linaro.org>
Instead of checking if cpu_check_bugs() exist, check for this
callback directly in the CPU vtable: this is better because the
function is just a define to the vtable entry and this is why
the code works. But we want to be able to specify a proper
function for cpu_check_bugs() so look into the vtable instead.
In bugs.c assign PROC_VTABLE(switch_mm) instead of
assigning cpu_do_switch_mm where again this is just a define
into the vtable: this makes it possible to make
cpu_do_switch_mm() into a real function.
Tested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/kernel/bugs.c | 2 +-
arch/arm/mm/proc-v7-bugs.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c
index 087bce6ec8e9..35d39efb51ed 100644
--- a/arch/arm/kernel/bugs.c
+++ b/arch/arm/kernel/bugs.c
@@ -7,7 +7,7 @@
void check_other_bugs(void)
{
#ifdef MULTI_CPU
- if (cpu_check_bugs)
+ if (PROC_VTABLE(check_bugs))
cpu_check_bugs();
#endif
}
diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c
index 8bc7a2d6d6c7..ea3ee2bd7b56 100644
--- a/arch/arm/mm/proc-v7-bugs.c
+++ b/arch/arm/mm/proc-v7-bugs.c
@@ -87,14 +87,14 @@ static unsigned int spectre_v2_install_workaround(unsigned int method)
case SPECTRE_V2_METHOD_HVC:
per_cpu(harden_branch_predictor_fn, cpu) =
call_hvc_arch_workaround_1;
- cpu_do_switch_mm = cpu_v7_hvc_switch_mm;
+ PROC_VTABLE(switch_mm) = cpu_v7_hvc_switch_mm;
spectre_v2_method = "hypervisor";
break;
case SPECTRE_V2_METHOD_SMC:
per_cpu(harden_branch_predictor_fn, cpu) =
call_smc_arch_workaround_1;
- cpu_do_switch_mm = cpu_v7_smc_switch_mm;
+ PROC_VTABLE(switch_mm) = cpu_v7_smc_switch_mm;
spectre_v2_method = "firmware";
break;
}
--
2.44.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-15 13:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 13:43 [PATCH v5 00/10] CFI for ARM32 using LLVM Linus Walleij
2024-04-15 13:43 ` Linus Walleij [this message]
2024-04-15 13:43 ` [PATCH v5 02/10] ARM: ftrace: Define ftrace_stub_graph Linus Walleij
2024-04-15 13:43 ` [PATCH v5 03/10] ARM: mm: Make tlbflush routines CFI safe Linus Walleij
2024-04-15 13:43 ` [PATCH v5 05/10] ARM: mm: Rewrite cacheflush vtables in CFI safe C Linus Walleij
2024-04-15 13:43 ` [PATCH v5 06/10] ARM: mm Type-annotate all per-processor assembly routines Linus Walleij
2024-04-15 13:43 ` [PATCH v5 07/10] ARM: mm: Define prototypes for all per-processor calls Linus Walleij
2024-04-15 13:43 ` [PATCH v5 08/10] ARM: lib: Annotate loop delay instructions for CFI Linus Walleij
2024-04-15 13:43 ` [PATCH v5 09/10] ARM: hw_breakpoint: Handle CFI breakpoints Linus Walleij
2024-04-15 13:43 ` [PATCH v5 10/10] ARM: Support CLANG CFI Linus Walleij
[not found] ` <20240415-arm32-cfi-v5-4-ff11093eeccc@linaro.org>
2024-04-15 16:35 ` [PATCH v5 04/10] ARM: mm: Type-annotate all cache assembly routines Ard Biesheuvel
2024-04-16 7:38 ` Linus Walleij
2024-04-29 13:18 ` Russell King (Oracle)
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=20240415-arm32-cfi-v5-1-ff11093eeccc@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).