linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] init: fix misleading "This architecture does not have kernel memory protection" message
@ 2020-01-09  8:15 Christophe Leroy
  2020-01-10  5:12 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2020-01-09  8:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Andrew Morton, Kees Cook
  Cc: linux-kernel, linuxppc-dev, linux-mm

This message leads to think that memory protection is not implemented
for the said architecture, whereas absence of CONFIG_STRICT_KERNEL_RWX
only means that memory protection has not been selected at
compile time.

Don't print this message when CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is
selected by the architecture. Instead, print "Kernel memory protection
not selected by kernel config."

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 init/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/init/main.c b/init/main.c
index 2cd736059416..fd31b15cc910 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1090,6 +1090,11 @@ static void mark_readonly(void)
 	} else
 		pr_info("Kernel memory protection disabled.\n");
 }
+#elif defined(CONFIG_ARCH_HAS_STRICT_KERNEL_RWX)
+static inline void mark_readonly(void)
+{
+	pr_warn("Kernel memory protection not selected by kernel config.\n");
+}
 #else
 static inline void mark_readonly(void)
 {
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] init: fix misleading "This architecture does not have kernel memory protection" message
  2020-01-09  8:15 [PATCH] init: fix misleading "This architecture does not have kernel memory protection" message Christophe Leroy
@ 2020-01-10  5:12 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2020-01-10  5:12 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Andrew Morton, linux-kernel, linuxppc-dev, linux-mm

On Thu, Jan 09, 2020 at 08:15:01AM +0000, Christophe Leroy wrote:
> This message leads to think that memory protection is not implemented
> for the said architecture, whereas absence of CONFIG_STRICT_KERNEL_RWX
> only means that memory protection has not been selected at
> compile time.
> 
> Don't print this message when CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is
> selected by the architecture. Instead, print "Kernel memory protection
> not selected by kernel config."
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Oh, yes, I like this. Should the message include a hint to the config
name?

Regardless:

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  init/main.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/init/main.c b/init/main.c
> index 2cd736059416..fd31b15cc910 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1090,6 +1090,11 @@ static void mark_readonly(void)
>  	} else
>  		pr_info("Kernel memory protection disabled.\n");
>  }
> +#elif defined(CONFIG_ARCH_HAS_STRICT_KERNEL_RWX)
> +static inline void mark_readonly(void)
> +{
> +	pr_warn("Kernel memory protection not selected by kernel config.\n");
> +}
>  #else
>  static inline void mark_readonly(void)
>  {
> -- 
> 2.13.3
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-10  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  8:15 [PATCH] init: fix misleading "This architecture does not have kernel memory protection" message Christophe Leroy
2020-01-10  5:12 ` Kees Cook

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).