From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A71CE606A322 for ; Thu, 3 Dec 2026 14:52:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HiRIJlfX; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RJpGo8IG DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Subject:References:In-Reply-To:Message-Id:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=6/qDsPo+BBchIYRCt9Pjpr6ssAp+xh5yGCBIGPn3Fc4=; b=HiRIJlfX280Cct GYnOWmxFwCm358LcHXciNvMG3yH34qxp76B1LRdLgGHIc0FJA/TgN77akRJ4ZTpCvG+xAhLJpPhsn exoAWWt79LPtvLY4GbHRjEyaqZbYfszwydwKrrVSLyWLX/SC3KAVPoTOCeIUn586QW9yQPL4+r5rn jsjO+ieLREbG9CUIkCVR9p0TcFY+dXC+iiuHlP5mSicLBXLEWs4geV7yPCCTzLRHe8vwb1eXGUyFi +sOcaiiZZ3xampfyeFdlGmfZlAARjKl7Rw8XTZhGqRziG+kEZD7LIC//UhEoRMHic+wxh5r0pvpZW bJyVoU6CWzBofz7CpS3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ7no-0000000Ewkk-3sGE; Thu, 03 Dec 2026 14:28:52 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ7nn-0000000Ewjc-3AnX for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 14:28:51 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id CB915410A6; Thu, 3 Dec 2026 14:28:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A53891F00896; Thu, 3 Dec 2026 14:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796308130; bh=6/qDsPo+BBchIYRCt9Pjpr6ssAp+xh5yGCBIGPn3Fc4=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=RJpGo8IGocopvkapiydajpA7F3NtijfeKEFMPZJLTtmwsF4BhegvBXgn6hPUWTRbM T7IqkTh8d5uCmLOGM5N2BYUbclfrhHhYs6WdSM1vvUn0Ri721335mc07ynEyD8DS0b 957qfhixlYbKzd0FSlK84OPSaTOq4rVVc2mtOxyTlo9/R/rAZu6SwikTLxbVkVEF9L hLMHhmcuXe3y556bnfG2hYoo0/5iylUHLdTNu03VgFi0TtKYaUPD64ND4VFxkiJ/W2 IZXNtyQ8QM2IuZcXJ/+IJTeAMqEzF3qylw4/DgU+JKb/fq7EMbcRUJpt57A4Og9eBs ehACGEU2Yar0Q== Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfauth.ams.internal (Postfix) with ESMTP id 03CEE198003A; Thu, 3 Dec 2026 09:28:48 -0500 (EST) Received: from ams-imap-11 ([10.64.2.31]) by ams-compute-02.internal (MEProxy); Thu, 03 Dec 2026 09:28:48 -0500 X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGMB2VEWWkHM8wU1dV8EZ9Uol+EkzeGGk5mzONGtFlPTkYRHC35EpwVd/F9onabPF NWUbeDf4qlVu90hY98htae3kdf8lp3lVeAUlVUJ+DnhQM+RhdYWsMjoBKX/2qaIfL6u2RB 9LRYThRFRvvVm2ywcfq0OUfwNA7htMuFoQQzZh2cJK2Qz4+Ja+pmnb2tDmfaFvQaB84Qgi wVLfiB0Qb+thRB4kBCBupph7KZdNp31961Ndjk2/3VyEGaDKKo/znL4AJKQD1uwZ35GYsN GZJkqPu7wpwNRzZR1/VFq8/qi23sqxtcHqDjmbIz7IlXaWtQ71bDYX+LEcaYNijL861EiP gl1gmW75pMrNZynu8GpjYA/lUcYdnvpODl0F+0tUe1r4yZiY3rswSG6wwRBt+KLllCqp/f MjuCd4K9SV0/q2dVnigiVNtanyC4x/DL3ocWXK/cDm2v+vfGv8AgyX4VF2Zzc0T82sq9mU hEjrzkfGmb4MiqIAdoRwor618PJ63bUFXGnhwoiSqANDIQpPgAYJkYjZolJO/pGaLoEWw7 mJjdvCyXk0htN/inUe5VViqiZxdulpqf8VJyAkjcLZidL1zPEZRyf9WUv+oqrUdiLf7kus ZWSccQOr317zSaIl13niiUhUER1/J1H6o5vy3J9OD1N1GBUnqwDwp/HKSaUw X-ME-Proxy: Feedback-ID: ice86485a:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id 07EF6F80096; Thu, 3 Dec 2026 09:28:45 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Archived-By: MIME-Version: 1.0 Date: Thu, 03 Dec 2026 15:28:24 +0100 From: "Ard Biesheuvel" To: "Fuad Tabba" , "Catalin Marinas" , "Will Deacon" Cc: "Mark Rutland" , "Ryan Roberts" , "Anshuman Khandual" , "Kevin Brodsky" , "Vladimir Murzin" , "Carl Worth" , "Linu Cherian" , "Yeoreum Yun" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Fuad Tabba" Message-Id: <87a8ab99-e4e9-42b1-b67d-10b8cbc8ba12@app.fastmail.com> In-Reply-To: <20261203132517.428942-1-fuad.tabba@linux.dev> References: <20261203132517.428942-1-fuad.tabba@linux.dev> Subject: Re: [PATCH 0/2] arm64: mm: Fix a TLBI operand and a TTBR1 write in the KPTI nG rewrite Content-Type: text/plain Content-Transfer-Encoding: 7bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, 3 Dec 2026, at 14:25, Fuad Tabba wrote: > Hi folks, > > This series fixes a TLBI operand and a TTBR1_EL1 write in > idmap_kpti_install_ng_mappings(). Both came up while I was working on > the ISB fix to the same code [1]. > > The first masks the TLBI operand in kpti_map_pgtbl(). Its upper bits > hold a wrong TTL hint on 4K and 16K kernels, which can leave kernel > mappings global. I couldn't find a CPU with FEAT_TTL that requires > KPTI, so hitting this takes kpti=on. The Falkor workaround in > tramp_map_kernel has the same unmasked operand. I left it alone, as > AFAICT the CPUs with that erratum predate FEAT_TTL. > > The second converts the temporary pgd's address before writing it to > TTBR1_EL1, which changes the value only for tables above 2^48 on a > 52-bit PA kernel. > > Both bugs were introduced by commit 47546a1912fc4 ("arm64: mm: install > KPTI nG mappings with MMU enabled"). I left out the Fixes: tags, as I > don't think either is worth a backport. > > Tested on QEMU (4K, and 64K with 52-bit PA) and on FVP, with "nokaslr > kpti=on". The second bug reproduces on QEMU with RAM placed at 2^48. > Without the patch the boot hangs, and with it the kernel boots. I > couldn't reproduce the first, as QEMU ignores the TTL hint and on FVP > the patch doesn't change which mappings end up global. > > Based on Linux 7.4-rc1 (6628e7d4c6b25; also applies to arm64 > for-next/fixes a7e632493acf3). > > Cheers, > /fuad > > [1] https://lore.kernel.org/all/20261120121638.194154-1-fuad.tabba@linux.dev/ > > Fuad Tabba (2): > arm64: mm: Mask the TLBI operand in kpti_map_pgtbl() > arm64: mm: Convert the temporary KPTI pgd address for TTBR1_EL1 > Reviewed-by: Ard Biesheuvel