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=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 57F97C43462 for ; Fri, 16 Apr 2021 16:34:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D288561002 for ; Fri, 16 Apr 2021 16:34:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D288561002 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 569966B0071; Fri, 16 Apr 2021 12:34:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5196F6B0072; Fri, 16 Apr 2021 12:34:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B9A26B0074; Fri, 16 Apr 2021 12:34:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 1BB0E6B0071 for ; Fri, 16 Apr 2021 12:34:03 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CD8626D78 for ; Fri, 16 Apr 2021 16:34:02 +0000 (UTC) X-FDA: 78038777124.10.B7A4AB7 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf18.hostedemail.com (Postfix) with ESMTP id 79042200027B for ; Fri, 16 Apr 2021 16:34:01 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id m11so18691729pfc.11 for ; Fri, 16 Apr 2021 09:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=z2OC1cEMuhrClU6NrKEbwSpdwK0Wyx5ycssXYh5zYaY=; b=maRGpOFYp6s48tNdoBVkOiMrziCDdLhM4rOR4KgB9GJvXiT8JjXZsphgurWw2bPWv7 T5PmtSkO23D/cTi94/mAgEq4NUhHpgQtZl19zHHCiq5UAZ0xovLHauhJ8RBh5WBs/Bcn 3Oe01YPXH7SHcAyhK4SJQicy/x5bRnFEmUsJGjT5Suly3fBl+LJ6ZF1wLUy5qI/r0bPK N63cln/k0URTbRZY6VJSuHOl6icLs8DZYwyIyqXF9BwDODSg5nSZq9fHAu4+SGL/jyO/ JwceGbPavk6Y5mwG5AwJRUe3/DV0/1d402Q0hzRBACqRXaMGQgsQARzbY8IkYSIuaNZp bZIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=z2OC1cEMuhrClU6NrKEbwSpdwK0Wyx5ycssXYh5zYaY=; b=moPHQPH8omi12nBqPc6SNBxDjOcNYBLiPNrZD3qZXc49A4KaYzm8OOEy/3QheWXtfv 281/3lIdL4s55QYY+OYr+NE+X78AtlSGATRZL9DsMPRYg4sk77oS4nC5mufL0x3pXy6N Nvn+IUdivUl5D7f99lmcSXNFK0m2z+aGagczE0So5QocFNOeB2OG3HruPX5Xf21M8YBF ZSmGfXe4nWTCphp9IiZ4zRIHJxza4waJEsV9xhAnkq/5YDiqUUkqMHgSCnsZuCu28sSd 54HZRWZcPAoy+vgu6AiZGta1wfZbsOXAKG2nmmMCu3j17om7JnjGVGYlhawMwnYv9gu3 YvsQ== X-Gm-Message-State: AOAM530W4RjLsscd6xzyef3unYwFJHZ0/ihf0SUthRhwL5yy86ZynA5K XMsjG0227/gC8q+Fhi78vDZFsw== X-Google-Smtp-Source: ABdhPJzdY9tt29/kSdPIjvZ8m8hDMZjPk11Or4POyQbLXVYX/vFpzeXAjr2YcYHuaICJvA4Pcb3ljw== X-Received: by 2002:a63:570e:: with SMTP id l14mr8746668pgb.159.1618590839027; Fri, 16 Apr 2021 09:33:59 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id b7sm5760468pgs.62.2021.04.16.09.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 09:33:58 -0700 (PDT) Date: Fri, 16 Apr 2021 09:33:58 -0700 (PDT) X-Google-Original-Date: Fri, 16 Apr 2021 09:33:56 PDT (-0700) Subject: Re: [PATCH] riscv: Protect kernel linear mapping only if CONFIG_STRICT_KERNEL_RWX is set In-Reply-To: CC: anup@brainfault.org, corbet@lwn.net, Paul Walmsley , aou@eecs.berkeley.edu, Arnd Bergmann , aryabinin@virtuozzo.com, glider@google.com, dvyukov@google.com, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-mm@kvack.org From: Palmer Dabbelt To: alex@ghiti.fr Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 79042200027B X-Stat-Signature: z1wqcakro1sus9t8t7bjcwtbsjfs7wf9 Received-SPF: none (dabbelt.com>: No applicable sender policy available) receiver=imf18; identity=mailfrom; envelope-from=""; helo=mail-pf1-f177.google.com; client-ip=209.85.210.177 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618590841-963968 Content-Transfer-Encoding: quoted-printable 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 Fri, 16 Apr 2021 03:47:19 PDT (-0700), alex@ghiti.fr wrote: > Hi Anup, > > Le 4/16/21 =C3=A0 6:41 AM, Anup Patel a =C3=A9crit=C2=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 permi= ssions >>> to the kernel data and text sections, so make sure it is defined befo= re >>> 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 a= s > it just entered for-next? Ya, I'll do it. My testing box was just tied up last night for the rc8=20 PR, so I threw this on for-next to get the buildbots to take a look. =20 It's a bit too late to take something for this week, as I try to be=20 pretty conservative this late in the cycle. There's another kprobes fix=20 on the list so if we end up with an rc8 I might send this along with=20 that, otherwise this'll just go onto for-next before the linear map=20 changes that exercise the bug. You're more than welcome to just dig up the fixes tag and reply, my=20 scripts pull all tags from replies (just like Revieweb-by). Otherwise=20 I'll do it myself, most people don't really post Fixes tags that=20 accurately so I go through it for pretty much everything anyway. Thanks for sorting this out so quickly! > >> >> 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 >>