Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796308131; b=39BkbqtJ//2WJTxnyuimgdaZMSVEqEWN+JU87kpXlGM9Cb0DE+Q/ctaug1Q0TBi8EshA dOMxo2iJJmhkcE8WbHKswYwQ2+f5ogcN489sKXIPfhLzDNC/M+XpbR0N3e6EKYuLpXCdT KqDJ6ThgMHo2gsPwmZkxnrHCh9xEZjwGYcI4Rw9bJfmf+RkfzGgyFJF+0RKNeAbywiGvi EesBa1AJmd9VES6dSl1CUspPN/K2A8K1XvYggjpEXWQDfkl2LwOd8OhDF+LdMS62SjR4H LUnyD0UL49HV2RN5a06xc1dkChuazNClvzlpIJr7Sxl8Fk2cf2Ih10BHtGyS4VLnn5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796308131; h=Received:DKIM-Signature:Received:Received:X-ME-Sender: X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer: MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type:Content-Transfer-Encoding; bh=6/qDsPo+BBchIYRCt9Pjpr6ssAp+xh5yGCBIGPn3Fc4=; b=sPuyYS+/Qne1gAPmicduH8FcRNG+Up0+ZQrtZoqorKhAr3Gpx1ah76DBgsous/D1fiqq X231hsILVAX1yiBWYvx0Xnj2tD4Nox8aKPWYc2MSvGjxyyBPbCJOOEZwaQO9+ENyI0XbO ZyX84j0IfAqSaxW1gzfibPDV1w0KyfSLHb9CmLZUhVffavgKHMRodeeIwzAtk3aCrAz0D MqTTss/uTwfkM2jAno4VEPSiC9BsXoVOW2NOcGQPAYT1s3llrd81y8sEXGx5eB09dXce9 SsiX7BputCqZncRiiv4bZVEYQzUZsNviYVbbOnVl/jP0PzjtMvV0AJPpju5aTzHQEIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="I/4Skste"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8730F606A32C for ; Thu, 3 Dec 2026 14:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=I/4Skste Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35541F00899; 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=1796308131; bh=6/qDsPo+BBchIYRCt9Pjpr6ssAp+xh5yGCBIGPn3Fc4=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=I/4SksteWuoIdmGGC/VsNYpKPguMBDcVWp0w0EC1+ofSBdEF9Qv6L2nFasTP1ttCF 3HfF70/mH/LaF0Wb2s47xh0AMofkY5MiXEwb/TP24J6w5tJzfLBjicDe02XxXwnOAy C1lAbwdHn9HneZZ23VaQo+bZupiEmctyIVUEhEq7US0uEnAECVb5XmkaHP8OKF5Wu6 8kmkvgn42DknQ1k5YCTyDbTR2IBMClGrEyKnNEXrJFl+odXUmhAv94YWEbXAFgDj0h EMSzbL8tcHlFWxSCmr1dMXdFrEjru8w0xePuGn/qSuysQ4UQxt+J3GJU8Kzrh2d978 aNvg8cHBdk/fQ== 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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