linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	 Kees Cook <keescook@chromium.org>,
	Nathan Chancellor <nathan@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Arnd Bergmann <arnd@arndb.de>,
	 linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev
Subject: Re: [PATCH v8 0/9] CFI for ARM32 using LLVM
Date: Mon, 29 Apr 2024 16:54:39 +0200	[thread overview]
Message-ID: <CAMj1kXG_oLtPMEhnnpQjJUSgFnJv-rP_yC-BNJRr+aC5eycnWA@mail.gmail.com> (raw)
In-Reply-To: <Zi+e9M/f5b/Sto9H@shell.armlinux.org.uk>

On Mon, 29 Apr 2024 at 15:22, Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
>
> I've applied this to a separate branch, and it should be in
> linux-next by tomorrow.
>
> As mentioned today on a previous iteration of the patch series,
> I'm not all that happy with the introduction of delay-inducing
> branches to solve CFI issues especially on the early CPUs where
> a branch causes the CPUs pipeline to be flushed - thus making
> branches expensive.
>
> Can we make these branches conditional on the use of CFI?
>
> Didn't Ard mention there was a way to do this using symbol aliases?
>

Yes, but only if the prototypes are identical. Not sure why Linus
decided to keep this separate, but 9386/2 implements this for
flush_user_cache_all() vs. flush_kern_cache_all().

For coherent_user_range() vs. coherent_kern_range(), the return type
is different (void vs int)

So we could either make coherent_kern_range() return int as well, or
alternatively, we could emit the branch instructions only when CFI is
enabled (as in that case, SYM_TYPED_FUNC_START() expands to something
that prevents a fall through)

E.g.,

--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -108,7 +108,9 @@ SYM_FUNC_END(v4wt_flush_user_cache_range)
  *     - end    - virtual end address
  */
 SYM_TYPED_FUNC_START(v4wt_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG
        b       v4wt_coherent_user_range
+#endif
 SYM_FUNC_END(v4wt_coherent_kern_range)

 /*

AFAICT, SYM_TYPED_FUNC_START() does not prevent a fall through if
CFI_CLANG is disabled, but someone should double check.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-04-29 14:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23  7:19 [PATCH v8 0/9] CFI for ARM32 using LLVM Linus Walleij
2024-04-23  7:19 ` [PATCH v8 1/9] ARM: mm: Make tlbflush routines CFI safe Linus Walleij
2024-04-23  7:19 ` [PATCH v8 3/9] ARM: mm: Use symbol alias for two cache functions Linus Walleij
2024-04-23  7:19 ` [PATCH v8 4/9] ARM: mm: Rewrite cacheflush vtables in CFI safe C Linus Walleij
2024-04-23  7:19 ` [PATCH v8 5/9] ARM: mm: Type-annotate all per-processor assembly routines Linus Walleij
2024-04-23  7:19 ` [PATCH v8 6/9] ARM: mm: Define prototypes for all per-processor calls Linus Walleij
2024-04-23  7:19 ` [PATCH v8 7/9] ARM: lib: Annotate loop delay instructions for CFI Linus Walleij
2024-04-23  7:19 ` [PATCH v8 8/9] ARM: hw_breakpoint: Handle CFI breakpoints Linus Walleij
2024-04-23  7:19 ` [PATCH v8 9/9] ARM: Support CLANG CFI Linus Walleij
2024-04-29 13:21 ` [PATCH v8 0/9] CFI for ARM32 using LLVM Russell King (Oracle)
2024-04-29 14:54   ` Ard Biesheuvel [this message]
2024-04-29 15:06     ` Sami Tolvanen
2024-04-30  7:43     ` Linus Walleij

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=CAMj1kXG_oLtPMEhnnpQjJUSgFnJv-rP_yC-BNJRr+aC5eycnWA@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=keescook@chromium.org \
    --cc=linus.walleij@linaro.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).