linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Daniel Kiss <daniel.kiss@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, Ard.Biesheuvel@arm.com,
	Catalin.Marinas@arm.com, pcc@google.com
Subject: Re: [PATCH v3 2/2] arm64: Conditionally configure PTR_AUTH key of the kernel.
Date: Mon, 29 Mar 2021 15:51:38 +0100	[thread overview]
Message-ID: <20210329145137.GE4203@willie-the-truck> (raw)
In-Reply-To: <20210208145554.2164638-3-daniel.kiss@arm.com>

On Mon, Feb 08, 2021 at 03:55:54PM +0100, Daniel Kiss wrote:
> If the kernel is not compiled with CONFIG_ARM64_PTR_AUTH_KERNEL=y,
> then no PACI/AUTI instructions are expected while the kernel is running
> so the kernel's key will not be used. Write of a system regiters
> is expensive therefore avoid it not required.

What happens if somebody tries to load a module built with PAC into a kernel
where CONFIG_ARM64_PTR_AUTH_KERNEL=n? Do we reject the module?

I'm not sure how much we care, but I'm a bit worried that it might not go
"obviously" wrong.

> Signed-off-by: Daniel Kiss <daniel.kiss@arm.com>
> ---
>  arch/arm64/include/asm/asm_pointer_auth.h | 63 +++++++++++++----------
>  arch/arm64/include/asm/pointer_auth.h     | 20 +++++--
>  arch/arm64/include/asm/processor.h        |  2 +
>  arch/arm64/kernel/asm-offsets.c           |  2 +
>  4 files changed, 54 insertions(+), 33 deletions(-)

[...]

> diff --git a/arch/arm64/include/asm/pointer_auth.h b/arch/arm64/include/asm/pointer_auth.h
> index c6b4f0603024..b34aebb95757 100644
> --- a/arch/arm64/include/asm/pointer_auth.h
> +++ b/arch/arm64/include/asm/pointer_auth.h
> @@ -30,9 +30,11 @@ struct ptrauth_keys_user {
>  	struct ptrauth_key apga;
>  };
>  
> +#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL
>  struct ptrauth_keys_kernel {
>  	struct ptrauth_key apia;
>  };
> +#endif
>  
>  static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys)
>  {
> @@ -54,6 +56,8 @@ do {								\
>  	write_sysreg_s(__pki_v.hi, SYS_ ## k ## KEYHI_EL1);	\
>  } while (0)
>  
> +#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL
> +
>  static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel *keys)
>  {
>  	if (system_supports_address_auth())
> @@ -69,6 +73,8 @@ static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kerne
>  	isb();
>  }
>  
> +#endif /* CONFIG_ARM64_PTR_AUTH_KERNEL */

Can you group this with the struct and avoid having two #ifdef blocks?

Will

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

  reply	other threads:[~2021-03-29 22:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 14:55 [PATCH v3 0/2] arm64: split ARM64_PTR_AUTH option to userspace and kernel Daniel Kiss
2021-02-08 14:55 ` [PATCH v3 1/2] arm64: Add ARM64_PTR_AUTH_KERNEL config option Daniel Kiss
2021-03-29 14:51   ` Will Deacon
2021-02-08 14:55 ` [PATCH v3 2/2] arm64: Conditionally configure PTR_AUTH key of the kernel Daniel Kiss
2021-03-29 14:51   ` Will Deacon [this message]
2021-04-12 20:17     ` Daniel Kiss

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=20210329145137.GE4203@willie-the-truck \
    --to=will@kernel.org \
    --cc=Ard.Biesheuvel@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=daniel.kiss@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pcc@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).