public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Ard Biesheuvel <ardb@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Ard Biesheuvel <ardb@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH v2 1/3] arm64: Avoid enabling KPTI unnecessarily
Date: Mon, 27 Nov 2023 15:48:18 +0000	[thread overview]
Message-ID: <20231127154818.GA8453@willie-the-truck> (raw)
In-Reply-To: <20231127120049.2258650-6-ardb@google.com>

On Mon, Nov 27, 2023 at 01:00:51PM +0100, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> Commit 42c5a3b04bf6 refactored the KPTI init code in a way that results
> in the use of non-global kernel mappings even on systems that have no
> need for it, and even when KPTI has been disabled explicitly via the
> command line.
> 
> Ensure that this only happens when we have decided (based on the
> detected system-wide CPU features) that KPTI should be enabled.
> 
> Fixes: 42c5a3b04bf6 ("arm64: Split kpti_install_ng_mappings()")
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/arm64/kernel/cpufeature.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 646591c67e7a..91d2d6714969 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1839,6 +1839,10 @@ static int __init __kpti_install_ng_mappings(void *__unused)
>  
>  static void __init kpti_install_ng_mappings(void)
>  {
> +	/* Check whether KPTI is going to be used */
> +	if (!cpus_have_cap(ARM64_UNMAP_KERNEL_AT_EL0))
> +		return;

Why can't you use arm64_kernel_unmapped_at_el0() here?

Will

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

  reply	other threads:[~2023-11-27 15:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 12:00 [PATCH v2 0/3] arm64 kpti fixes Ard Biesheuvel
2023-11-27 12:00 ` [PATCH v2 1/3] arm64: Avoid enabling KPTI unnecessarily Ard Biesheuvel
2023-11-27 15:48   ` Will Deacon [this message]
2023-11-27 15:52     ` Ard Biesheuvel
2023-11-27 16:31       ` Will Deacon
2023-11-27 16:39         ` Ard Biesheuvel
2023-11-27 16:41         ` Will Deacon
2023-11-27 17:49           ` Mark Rutland
2023-11-28 11:03             ` Will Deacon
2023-11-28 14:13               ` Mark Rutland
2023-12-11 11:39                 ` Will Deacon
2023-12-12 17:16                   ` Mark Rutland
2023-11-28 11:06   ` Will Deacon
2023-11-27 12:00 ` [PATCH v2 2/3] arm64: mm: Only map KPTI trampoline if it is going to be used Ard Biesheuvel
2023-11-27 12:00 ` [PATCH v2 3/3] arm64: Kconfig: drop KAISER reference from KPTI option description Ard Biesheuvel
2023-11-27 12:47 ` [PATCH v2 0/3] arm64 kpti fixes Mark Rutland
2023-11-30 19:14 ` (subset) " Catalin Marinas
2023-12-11 20:27 ` Will Deacon

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=20231127154818.GA8453@willie-the-truck \
    --to=will@kernel.org \
    --cc=ardb@google.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    /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