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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 A7AC7C433F5 for ; Wed, 15 Sep 2021 09:21:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 65CF2610D1 for ; Wed, 15 Sep 2021 09:21:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 65CF2610D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2pdnRdddCeoLG1nNLdK7JanLg5sJNhQ3Xmu/lF9Cumw=; b=y/FFfIYV3OYIoI UuJL95kyPQzgWW2yxlXaO+elM59AGIkg3w2rdBlfPXxjWI/od+UAQ/WfDKtRLq5eJIb5OfklQ/08Y axcia4NwRa7MV5xNqBA7aZDBRyasNJEBLxY7mW7cAtY8HGa2qsFS0bD8lkWg+kqgu5JOLMSpYHY4q 1kX6OZpN7dA77xaCJ1gcaZU1vdV563pn+tnz9fmqNN3cmxQC3JrE2TKOnRFUJddt4l/XC/5mpUIr4 lufT2PBUkzzyjz0M/lcUp71soRwfaUvbhH6EOln1+nXOEfulEI3PcGqIA3jFz5eWR32hGc8X7iIOc Zjfbvf4+srxRTs+Kl1Sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQR5E-008f5o-Im; Wed, 15 Sep 2021 09:20:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQR56-008f41-Iz for linux-arm-kernel@lists.infradead.org; Wed, 15 Sep 2021 09:19:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D2FF6D; Wed, 15 Sep 2021 02:19:51 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CBFF43F5A1; Wed, 15 Sep 2021 02:19:49 -0700 (PDT) Date: Wed, 15 Sep 2021 10:19:43 +0100 From: Mark Rutland To: ashimida Cc: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Laura Abbott Subject: Re: [PATCH] [RFC]arm64:Mark __stack_chk_guard as __ro_after_init Message-ID: <20210915091943.GA47689@C02TD0UTHF1T.local> References: <1631612642-102881-1-git-send-email-ashimida@linux.alibaba.com> <20210914101709.GA29127@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210915_021952_734705_BFB18919 X-CRM114-Status: GOOD ( 31.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 15, 2021 at 09:57:14AM +0800, ashimida wrote: > Hi King, Rutland: > > Thanks for the reply and let me understand the reason here. > > Then may I first submit a patch to modify the attributes of > __stack_chk_guard of the arm/aarch64 platform? This patch looks fine as-is (hence the Acked-by). Doing the same for arch/arm makes sense, but that should be a separate patch. I was suggesting that in future we should probably do the same in more places, not that you need to do so now. Thanks, Mark. > > On 9/14/21 6:17 PM, Mark Rutland wrote: > > On Tue, Sep 14, 2021 at 05:44:02PM +0800, Dan Li wrote: > > > __stack_chk_guard is setup once while init stage and never changed > > > after that. > > > > > > Although the modification of this variable at runtime will usually > > > cause the kernel to crash (so dose the attacker), it should be marked > > > as _ro_after_init, and it should not affect performance if it is > > > placed in the ro_after_init section. > > > > > > This should also be the case on the ARM platform, or am I missing > > > something? > > > > > > Signed-off-by: Dan Li > > > > FWIW, this makes sense to me: > > > > Acked-by: Mark Rutland > > > > Looking at the history, this was added to arm64 in commit: > > > > c0c264ae5112d1cd ("arm64: Add CONFIG_CC_STACKPROTECTOR") > > > > ... whereas __ro_after_init was introduced around 2 years later in > > commit: > > > > c74ba8b3480da6dd ("arch: Introduce post-init read-only memory") > > > > ... so we weren't deliberately avoiding __ro_after_init, and there are > > probably a significant number of other variables we could apply it to. > > > > Mark. > > > > > --- > > > arch/arm64/kernel/process.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > > > index c8989b9..c858b85 100644 > > > --- a/arch/arm64/kernel/process.c > > > +++ b/arch/arm64/kernel/process.c > > > @@ -60,7 +60,7 @@ > > > #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) > > > #include > > > -unsigned long __stack_chk_guard __read_mostly; > > > +unsigned long __stack_chk_guard __ro_after_init; > > > EXPORT_SYMBOL(__stack_chk_guard); > > > #endif > > > -- > > > 2.7.4 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel