diff mbox series

[2/4] powerpc/64: Setup KUP before feature fixups

Message ID 20181122140416.3447-3-ruscur@russell.cc (mailing list archive)
State Superseded
Headers show
Series Kernel Userspace Protection for Radix MMU | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning next/apply_patch Patch failed to apply
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Russell Currey Nov. 22, 2018, 2:04 p.m. UTC
The subsequent implementation of KUAP for radix makes use of a MMU
feature in order to patch out assembly when KUAP is disabled or
unsupported.  This won't work unless there's an entry point for
KUP support before the feature magic happens, so relocate
setup_kup() earlier in setup.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 arch/powerpc/kernel/setup_64.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Christophe Leroy Nov. 28, 2018, 9:38 a.m. UTC | #1
On 11/22/2018 02:04 PM, Russell Currey wrote:
> The subsequent implementation of KUAP for radix makes use of a MMU
> feature in order to patch out assembly when KUAP is disabled or
> unsupported.  This won't work unless there's an entry point for
> KUP support before the feature magic happens, so relocate
> setup_kup() earlier in setup.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>

I squashed it in my RFC v2

Christophe

> ---
>   arch/powerpc/kernel/setup_64.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index 0f4e06ab70a5..cc20dc3e7b69 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -331,6 +331,12 @@ void __init early_setup(unsigned long dt_ptr)
>   	 */
>   	configure_exceptions();
>   
> +	/*
> +	 * Configure Kernel Userspace Protection. This needs to happen before
> +	 * feature fixups for platforms that implement this using features.
> +	 */
> +	setup_kup();
> +
>   	/* Apply all the dynamic patching */
>   	apply_feature_fixups();
>   	setup_feature_keys();
> @@ -372,7 +378,6 @@ void __init early_setup(unsigned long dt_ptr)
>   	 */
>   	btext_map();
>   #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */
> -	setup_kup();
>   }
>   
>   #ifdef CONFIG_SMP
>
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 0f4e06ab70a5..cc20dc3e7b69 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -331,6 +331,12 @@  void __init early_setup(unsigned long dt_ptr)
 	 */
 	configure_exceptions();
 
+	/*
+	 * Configure Kernel Userspace Protection. This needs to happen before
+	 * feature fixups for platforms that implement this using features.
+	 */
+	setup_kup();
+
 	/* Apply all the dynamic patching */
 	apply_feature_fixups();
 	setup_feature_keys();
@@ -372,7 +378,6 @@  void __init early_setup(unsigned long dt_ptr)
 	 */
 	btext_map();
 #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */
-	setup_kup();
 }
 
 #ifdef CONFIG_SMP