From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 704F5C33CA2 for ; Fri, 10 Jan 2020 05:13:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3624120721 for ; Fri, 10 Jan 2020 05:13:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dqJTwC9n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3624120721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BF5558E0007; Fri, 10 Jan 2020 00:13:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA5A68E0001; Fri, 10 Jan 2020 00:13:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A943A8E0007; Fri, 10 Jan 2020 00:13:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 6102E8E0001 for ; Fri, 10 Jan 2020 00:13:03 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 1FB615820 for ; Fri, 10 Jan 2020 05:13:03 +0000 (UTC) X-FDA: 76360555446.25.bears46_1a933d04d372f X-HE-Tag: bears46_1a933d04d372f X-Filterd-Recvd-Size: 4299 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Jan 2020 05:13:02 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id b22so373862pls.12 for ; Thu, 09 Jan 2020 21:13:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Tmf+Kxucvb62NiCjSTWMZBNjJ8UNF1K5QBIAcifMgQI=; b=dqJTwC9nF+cQfR6H5U3TZiI9pnBoPZjL1vGQJveXhqrGGKv+0e0PiUtmGFRLEVIi9H PSrgKfip+Q8V76oK2lCMuGJnruqiAcJBDkHaKQgBPMN7yNGnReo2sKZldcep+jgXgpm4 1X4p7ZaUv18Ed3P6kabJ4llMEdx8+fvGPmLjQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Tmf+Kxucvb62NiCjSTWMZBNjJ8UNF1K5QBIAcifMgQI=; b=IeqpLoV52DpEWZRG4cO+VY0/wYAqhWFIQq0gl4WuhUb+HJv68IuanXppm3UygE4p2F vpZLEPfI7EqkcH80mBrRBzx8qtxQTer05HIEVStvtNDkVXlYYZAPwqZTLtnBw4II7uIP jI+o4evZEaSwSMdrATjPdbGK6OR1BvmP+x6rSwXx+OP4voLVm3shRq0IS4ip/YxGWDvQ KC3jj7yn3tfNC4ldctBf9g4MDLPlO6ldjeZab0KRTKBkQyQZUdAdniSDphQmz70OiYJo QjcGhBDD7+F0LhFlfdGLolONhW6niAqyE8q/bCTe44h166ZcSQZwW8uTohy98OQDdJg5 P9og== X-Gm-Message-State: APjAAAUe8k7jGZvEXeunJjmjosV2RLLIzjptLDOXouB6No8HFzJpyEBa Cav8Mz9sbX6CQyrS0ociObnFQA== X-Google-Smtp-Source: APXvYqya22I94aB51t/b5586U5xsAVsE1JwObmcgOBjtPfTa0YzbMamXcKH1ztnT77pUjbQTqlTx0Q== X-Received: by 2002:a17:90b:8b:: with SMTP id bb11mr2367447pjb.27.1578633181385; Thu, 09 Jan 2020 21:13:01 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g19sm847886pfh.134.2020.01.09.21.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 21:13:00 -0800 (PST) Date: Thu, 9 Jan 2020 21:12:59 -0800 From: Kees Cook To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Subject: Re: [PATCH] init: fix misleading "This architecture does not have kernel memory protection" message Message-ID: <202001092112.14F20C4DCE@keescook> References: <62477e446d9685459d4f27d193af6ff1bd69d55f.1578557581.git.christophe.leroy@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62477e446d9685459d4f27d193af6ff1bd69d55f.1578557581.git.christophe.leroy@c-s.fr> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Oh, yes, I like this. Should the message include a hint to the config name? Regardless: Acked-by: Kees Cook -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