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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2416DC77B77 for ; Mon, 17 Apr 2023 14:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbjDQOeB (ORCPT ); Mon, 17 Apr 2023 10:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjDQOd6 (ORCPT ); Mon, 17 Apr 2023 10:33:58 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66E1A92 for ; Mon, 17 Apr 2023 07:33:57 -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 DA0611063; Mon, 17 Apr 2023 07:34:40 -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 8ACD33F5A1; Mon, 17 Apr 2023 07:33:55 -0700 (PDT) Message-ID: Date: Mon, 17 Apr 2023 15:33:53 +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 Cc: linux-kernel@vger.kernel.org, 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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/04/2023 15:30, Ard Biesheuvel wrote: > On Mon, 17 Apr 2023 at 16:28, Ryan Roberts wrote: >> >> 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? >> > > This (ab)uses the CPU feature framework, which is based on 4-bit > quantities. I don't remember if it matters or not, but IIRC the > default macros use 4-bit wide values. OK, thanks.