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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 C5871C43462 for ; Fri, 16 Apr 2021 10:47:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 397A161103 for ; Fri, 16 Apr 2021 10:47:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 397A161103 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BD1756B0036; Fri, 16 Apr 2021 06:47:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA88D6B006C; Fri, 16 Apr 2021 06:47:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A98786B0070; Fri, 16 Apr 2021 06:47:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 8C0196B0036 for ; Fri, 16 Apr 2021 06:47:26 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 479D78248D52 for ; Fri, 16 Apr 2021 10:47:26 +0000 (UTC) X-FDA: 78037903692.02.9EC7469 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by imf11.hostedemail.com (Postfix) with ESMTP id 029892000261 for ; Fri, 16 Apr 2021 10:47:14 +0000 (UTC) X-Originating-IP: 81.185.167.252 Received: from [192.168.43.237] (252.167.185.81.rev.sfr.net [81.185.167.252]) (Authenticated sender: alex@ghiti.fr) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 62B3840011; Fri, 16 Apr 2021 10:47:18 +0000 (UTC) Subject: Re: [PATCH] riscv: Protect kernel linear mapping only if CONFIG_STRICT_KERNEL_RWX is set To: Anup Patel Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , linux-doc@vger.kernel.org, linux-riscv , "linux-kernel@vger.kernel.org List" , kasan-dev@googlegroups.com, linux-arch , Linux Memory Management List References: <20210415110426.2238-1-alex@ghiti.fr> From: Alex Ghiti Message-ID: Date: Fri, 16 Apr 2021 06:47:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: fr X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 029892000261 X-Stat-Signature: g7n61o5d67schqrq3wf7neij1ifxgjss Received-SPF: none (ghiti.fr>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=relay2-d.mail.gandi.net; client-ip=217.70.183.194 X-HE-DKIM-Result: none/none X-HE-Tag: 1618570034-321003 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000776, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Anup, Le 4/16/21 =E0 6:41 AM, Anup Patel a =E9crit=A0: > On Thu, Apr 15, 2021 at 4:34 PM Alexandre Ghiti wrote: >> >> If CONFIG_STRICT_KERNEL_RWX is not set, we cannot set different permis= sions >> to the kernel data and text sections, so make sure it is defined befor= e >> trying to protect the kernel linear mapping. >> >> Signed-off-by: Alexandre Ghiti >=20 > Maybe you should add "Fixes:" tag in commit tag ? Yes you're right I should have done that. Maybe Palmer will squash it as=20 it just entered for-next? >=20 > Otherwise it looks good. >=20 > Reviewed-by: Anup Patel Thank you! Alex >=20 > Regards, > Anup >=20 >> --- >> arch/riscv/kernel/setup.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c >> index 626003bb5fca..ab394d173cd4 100644 >> --- a/arch/riscv/kernel/setup.c >> +++ b/arch/riscv/kernel/setup.c >> @@ -264,12 +264,12 @@ void __init setup_arch(char **cmdline_p) >> >> sbi_init(); >> >> - if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) >> + if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) { >> protect_kernel_text_data(); >> - >> -#if defined(CONFIG_64BIT) && defined(CONFIG_MMU) >> - protect_kernel_linear_mapping_text_rodata(); >> +#ifdef CONFIG_64BIT >> + protect_kernel_linear_mapping_text_rodata(); >> #endif >> + } >> >> #ifdef CONFIG_SWIOTLB >> swiotlb_init(1); >> -- >> 2.20.1 >> >=20 > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >=20