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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4CA30C43334 for ; Wed, 15 Jun 2022 04:34:09 +0000 (UTC) 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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w3yOLXRmSvLprN3xeuSq71yVBFQJ/0RIaR9pRZA4uAA=; b=Nh06peZgPA7qXW uNFF+AJG3BbH7cDjtS4D3IlNKvsjTbpGulFC+Jn/4pjxoCt12qaxqXGlvLlcvQdfzFAEUBd/Ek2d0 9R+JJCw133Ns+weG85CraQKMdSZw094ufQbM4VJC2rpLBEwBNsGALiAaXKTz69nuu8xJLzLYglANt p05k4GXbWSoX5l8WLOBb3w3bLYc/j7/nt5CCQuJ5CSrg6iN5jIsCb1BuOs9bpspsUMqT6yq/ZpH+w Pwvkn8JahSQC6b6fUAVw3lwnzWCA0rC3Gt9ehDrbCVYzcZda3wdvEdDKicDwV2gm8roBha0n+BLnP LpSymUYE0rPQ83AIIz5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1KiH-00CX3F-An; Wed, 15 Jun 2022 04:33:05 +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 1o1KiD-00CX2G-5c for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 04:33:03 +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 8112F175A; Tue, 14 Jun 2022 21:32:54 -0700 (PDT) Received: from [10.163.41.27] (unknown [10.163.41.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACB4B3F792; Tue, 14 Jun 2022 21:32:50 -0700 (PDT) Message-ID: <35a8be65-47d5-45b3-3917-44d559778d2a@arm.com> Date: Wed, 15 Jun 2022 10:02:47 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 08/26] arm64: kernel: drop unnecessary PoC cache clean+invalidate Content-Language: en-US To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Cc: linux-hardening@vger.kernel.org, Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown References: <20220613144550.3760857-1-ardb@kernel.org> <20220613144550.3760857-9-ardb@kernel.org> From: Anshuman Khandual In-Reply-To: <20220613144550.3760857-9-ardb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220614_213301_309843_A46503E2 X-CRM114-Status: GOOD ( 21.58 ) 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 6/13/22 20:15, Ard Biesheuvel wrote: > Some early boot code runs before the virtual placement of the kernel is > finalized, and we used to go back to the very start and recreate the ID > map along with the page tables describing the virtual kernel mapping, > and this involved setting some global variables with the caches off. > > In order to ensure that global state created by the KASLR code is not > corrupted by the cache invalidation that occurs in that case, we needed > to clean those global variables to the PoC explicitly. > > This is no longer needed now that the ID map is created only once (and > the associated global variable updates are no longer repeated). So drop > the cache maintenance that is no longer necessary. > > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/kernel/kaslr.c | 11 ----------- > 1 file changed, 11 deletions(-) > > diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c > index 418b2bba1521..d5542666182f 100644 > --- a/arch/arm64/kernel/kaslr.c > +++ b/arch/arm64/kernel/kaslr.c > @@ -13,7 +13,6 @@ > #include > #include > > -#include > #include > #include > #include > @@ -72,9 +71,6 @@ u64 __init kaslr_early_init(void) > * we end up running with module randomization disabled. > */ > module_alloc_base = (u64)_etext - MODULES_VSIZE; > - dcache_clean_inval_poc((unsigned long)&module_alloc_base, > - (unsigned long)&module_alloc_base + > - sizeof(module_alloc_base)); > > /* > * Try to map the FDT early. If this fails, we simply bail, > @@ -174,13 +170,6 @@ u64 __init kaslr_early_init(void) > module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; > module_alloc_base &= PAGE_MASK; > > - dcache_clean_inval_poc((unsigned long)&module_alloc_base, > - (unsigned long)&module_alloc_base + > - sizeof(module_alloc_base)); > - dcache_clean_inval_poc((unsigned long)&memstart_offset_seed, > - (unsigned long)&memstart_offset_seed + > - sizeof(memstart_offset_seed)); > - > return offset; > } > Reviewed-by: Anshuman Khandual _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel