Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4071260rwe; Mon, 17 Apr 2023 07:35:04 -0700 (PDT) X-Google-Smtp-Source: AKy350Y1DPkiJJ4zmJBj92HvTE9pcktRt0dawrWPMy7BNqIBIMb2M5ZJkY8/LmlRwyrpnlx7Ojth X-Received: by 2002:a05:6a20:cb5c:b0:d6:7b9b:f89 with SMTP id hd28-20020a056a20cb5c00b000d67b9b0f89mr11926324pzb.4.1681742103723; Mon, 17 Apr 2023 07:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681742103; cv=none; d=google.com; s=arc-20160816; b=zeGnQIRQ2c2FqV+P9CZ8tpi1ltAHWCkcfBW9tJJ1qCsW0D7jZ8X83ALoMPEn2ja1WS O+D6yIwu/mkANSlDZE9hrW44ZHiOkW3Rsql0aOlos9YmUgWFeKJXFfxnUuD/Jfxy06Ua MG6qkZtofQEzjwRXmp3bn86Zmfl6/oE+lv7tcgmMD7wSqCto6Ze74aBeQk01wr8LPL9q XOCquTUWCBPa3RtYqf8LlOpsc8xIh4aXQsRobAu252N9NFX7XJZy15Qx03GiYql5rNw8 UNifj7O0nR674T9+iQ5iKPiNFrAiWjlvuts2RQx99l8ripC0TGvjNeaziulAn1abeQqa PBlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=9TCcScne+aUqNIXCpB1zkXLmHNZT8GUopFmTp5lUZ5c=; b=rJoNc9tv0OoTK8fYyZTgkWYjLFPooiE6sZnTkfJ9Gpi6SsfyJ8bIbWZBi/gC1jbXoM sZvXghLFBg3CCZimpsb2jzS4SRLfUT1rB0KTGC+K2kt2OyXMr260vn0h2TJSbNxYFrdR Pe72PMKju+KSPqCH8V41DMUtntgw4UX7iPhmy3vSJlY77RZPWCVadtZMQHCTaYycX7ia AnPkrSl9bNilMQVynr3D2Y6paWRh0Wf93ESWh3Z0bRBOF7kF0umglHv/56yOg0wZCq9t Hv6+XtRiZUZ4KA7IJPJ6nqBhaw/Uut+Y/d6uWDQdDsCNtADIKjpYz7luzm578Db8QtMK +IDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a63f955000000b0051397d1ae3csi9868123pgk.168.2023.04.17.07.34.51; Mon, 17 Apr 2023 07:35:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbjDQO2x (ORCPT + 99 others); Mon, 17 Apr 2023 10:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbjDQO2v (ORCPT ); Mon, 17 Apr 2023 10:28:51 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81BDC5B9B for ; Mon, 17 Apr 2023 07:28:50 -0700 (PDT) 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 EDA7B1063; Mon, 17 Apr 2023 07:29:33 -0700 (PDT) Received: from [10.57.68.227] (unknown [10.57.68.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 08EBE3F5A1; Mon, 17 Apr 2023 07:28:48 -0700 (PDT) Message-ID: Date: Mon, 17 Apr 2023 15:28:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v3 30/60] arm64: idreg-override: Create a pseudo feature for rodata=off Content-Language: en-US To: Ard Biesheuvel , linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Anshuman Khandual , Kees Cook References: <20230307140522.2311461-1-ardb@kernel.org> <20230307140522.2311461-31-ardb@kernel.org> From: Ryan Roberts In-Reply-To: <20230307140522.2311461-31-ardb@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/2023 14:04, Ard Biesheuvel wrote: > Add rodata=off to the set of kernel command line options that is parsed > early using the CPU feature override detection code, so we can easily > refer to it when creating the kernel mapping. > > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/include/asm/cpufeature.h | 1 + > arch/arm64/kernel/pi/idreg-override.c | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index bc10098901808c00..edc7733aa49846b2 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -16,6 +16,7 @@ > #define cpu_feature(x) KERNEL_HWCAP_ ## x > > #define ARM64_SW_FEATURE_OVERRIDE_NOKASLR 0 > +#define ARM64_SW_FEATURE_OVERRIDE_RODATA_OFF 4 I assume these are bit numbers? Why not just use the next available bit (bit 1) for this new flag? > > #ifndef __ASSEMBLY__ > > diff --git a/arch/arm64/kernel/pi/idreg-override.c b/arch/arm64/kernel/pi/idreg-override.c > index 4e76db6eb72c2087..6c547cccaf6a9e9c 100644 > --- a/arch/arm64/kernel/pi/idreg-override.c > +++ b/arch/arm64/kernel/pi/idreg-override.c > @@ -151,6 +151,7 @@ static const struct ftr_set_desc sw_features __prel64_initconst = { > .override = &arm64_sw_feature_override, > .fields = { > FIELD("nokaslr", ARM64_SW_FEATURE_OVERRIDE_NOKASLR, NULL), > + FIELD("rodataoff", ARM64_SW_FEATURE_OVERRIDE_RODATA_OFF, NULL), > {} > }, > }; > @@ -183,6 +184,7 @@ static const struct { > "id_aa64isar2.gpa3=0 id_aa64isar2.apa3=0" }, > { "arm64.nomte", "id_aa64pfr1.mte=0" }, > { "nokaslr", "arm64_sw.nokaslr=1" }, > + { "rodata=off", "arm64_sw.rodataoff=1" }, > }; > > static int __init parse_hexdigit(const char *p, u64 *v)