From patchwork Thu Jan 9 08:15:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 11325153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97D586C1 for ; Thu, 9 Jan 2020 08:15:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 63DAB2072A for ; Thu, 9 Jan 2020 08:15:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=c-s.fr header.i=@c-s.fr header.b="HQBqJeCO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63DAB2072A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=c-s.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 609218E0005; Thu, 9 Jan 2020 03:15:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5B9F88E0001; Thu, 9 Jan 2020 03:15:05 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A7CD8E0005; Thu, 9 Jan 2020 03:15:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 314EA8E0001 for ; Thu, 9 Jan 2020 03:15:05 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id C3BB7180AD80F for ; Thu, 9 Jan 2020 08:15:04 +0000 (UTC) X-FDA: 76357385328.23.pail56_66758badbf532 X-Spam-Summary: 13,1.2,0,729f8e1544d6bb09,d41d8cd98f00b204,christophe.leroy@c-s.fr,:benh@kernel.crashing.org:paulus@samba.org:mpe@ellerman.id.au:akpm@linux-foundation.org:keescook@chromium.org:linux-kernel@vger.kernel.org:linuxppc-dev@lists.ozlabs.org:,RULES_HIT:41:355:379:800:960:973:988:989:1260:1261:1345:1437:1534:1541:1711:1714:1730:1747:1777:1792:2393:2559:2562:2897:3138:3139:3140:3141:3142:3351:3865:3866:3867:3871:3874:4321:5007:6261:6653:7903:8634:9390:10008:11026:11473:11658:11914:12043:12048:12297:12438:12555:12895:12986:13069:13095:13255:13311:13357:14181:14384:14394:14721:21080:21212:21433:21451:21627:21966:30054,0,RBL:93.17.236.30:@c-s.fr:.lbl8.mailshell.net-62.2.5.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:1:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: pail56_66758badbf532 X-Filterd-Recvd-Size: 3544 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jan 2020 08:15:03 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 47tf6s3zYvz9v3KW; Thu, 9 Jan 2020 09:15:01 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=HQBqJeCO; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id Gi7YKr0mKWYK; Thu, 9 Jan 2020 09:15:01 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47tf6s2gGzz9v3KV; Thu, 9 Jan 2020 09:15:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1578557701; bh=aCJX3qfRGAn+3jSeLTC1vMzfBDwGoUIdPhX/7aLEOfc=; h=From:Subject:To:Cc:Date:From; b=HQBqJeCOIdc7xFwr0PRHYkj4U7bbp7zWf3xeRiO2hJAUEtL60jYN9+P1OJF6vinSV nyT7rLmW2/LHPUB+CNknG8UTjGOm5SyJC9B1RNM8gBNoKgp67fzQdnkDswZf1A0CZj 2+JzV/+Sp00UtvAhYVMkNPxsmLaHNYb2DpHj07Yg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 54C348B816; Thu, 9 Jan 2020 09:15:02 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id fEx0BEfzzKAO; Thu, 9 Jan 2020 09:15:02 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0EDCA8B769; Thu, 9 Jan 2020 09:15:02 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id B2EB063B8D; Thu, 9 Jan 2020 08:15:01 +0000 (UTC) Message-Id: <62477e446d9685459d4f27d193af6ff1bd69d55f.1578557581.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] init: fix misleading "This architecture does not have kernel memory protection" message To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , Kees Cook Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Date: Thu, 9 Jan 2020 08:15:01 +0000 (UTC) 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: 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 Acked-by: Kees Cook --- 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) {