Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp217712pxb; Fri, 16 Apr 2021 04:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEYfngE5jwPRHwB494W7y3S36Y/orfpAUKmMb7jyYjALmKHYdi8wnqXoFTsqn+mq/VdpgO X-Received: by 2002:a17:90a:bf84:: with SMTP id d4mr8872827pjs.118.1618570907600; Fri, 16 Apr 2021 04:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618570907; cv=none; d=google.com; s=arc-20160816; b=tIS5ckTeAcZ075lUnT75APoMVg3b+yRWf+TEhkkwqkUGB+MPuYgPct0z0CeAqbeiLf XqxIVrqgvOAGIcM1TwIMSFcSsgp0r+fEtKGLGumiSl6o4hJ8oA+2U8oF7NJvmzkRN80h bctf6v93fP2+TyWsKej39nPLakKIoN+zrbxIPWHzd4ATGvLtaTq06ceqpaCW7VrGdc1b ENIciQntSh59/JcOU3OGE0HJeihsJFyTtrHsbl/sQ6Y0qm6Jk/3XjEMffRnnPlTq8+tz e1e78wqX81wai6uki+7ApcpCr7XSApQUMKNU6aCnT1iiXEXqC1KT4EFiMWgezZXa491k b6bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Nb4eAVWb/jm8f0DTNdfSUaAZRgWKjTREkrcPE0XfuQs=; b=atlBOefIjlUsVcAfgde3PXeomNleS3HpAvQtYMsec3Xc8918KHHDY3yPSaBbR3py4M ZEUZinCU3JI9MGiKT+IcpnXb0uayEC5u3iw+nYaAPHIR74bBqd/Jig6fIpZPlEcp0k1z KTMzsenBVkOj2+IyxvhDlq5CV45xgFC/VRbuHTkNKx73tkvaF+5r2Hs6bec/JLzEsmjW ZzstVf/TZ2qQf//AwQn8abIJieJMqA6KPxVb/PHSPAoeLA4K2b0CACBPTrOkz+D4/hIp shRw5SsffTuXJYl6XV8uG5akkPKcV8sRiol7k1smxFQ+Jg9jAs0Mr0uYUvonKnPzx8Ks wG1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si6190934pgq.300.2021.04.16.04.01.35; Fri, 16 Apr 2021 04:01:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241983AbhDPKrt (ORCPT + 99 others); Fri, 16 Apr 2021 06:47:49 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:36217 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235225AbhDPKrt (ORCPT ); Fri, 16 Apr 2021 06:47:49 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anup, Le 4/16/21 ? 6:41 AM, Anup Patel a ?crit?: > On Thu, Apr 15, 2021 at 4:34 PM Alexandre Ghiti wrote: >> >> If CONFIG_STRICT_KERNEL_RWX is not set, we cannot set different permissions >> to the kernel data and text sections, so make sure it is defined before >> trying to protect the kernel linear mapping. >> >> Signed-off-by: Alexandre Ghiti > > Maybe you should add "Fixes:" tag in commit tag ? Yes you're right I should have done that. Maybe Palmer will squash it as it just entered for-next? > > Otherwise it looks good. > > Reviewed-by: Anup Patel Thank you! Alex > > Regards, > Anup > >> --- >> 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 >> > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >