Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 072ED80603 for ; Thu, 23 May 2024 18:19:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716488341; cv=none; b=L13t61g4Yp58bW4gXaz+5xHd79sX3S/+2q4m+Vi0HNRSjL5wfXnuSe3Ws1ZSpLIJfvsqjZ1rKZJsaHhypbmHXKxWGpb/78PHSyIVOdTguteS0QzVPBSDxD4RR493axfdv4PXv9OypBwhS9mUbNtCcP4lw+k9qI/O+CpqIllBGQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716488341; c=relaxed/simple; bh=gw8y3FfzavCiPRp+Tzm9CwPAxk4GsPXQvMhRKDlNdYg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=PeqPMe4syEHyVv1s4C3nObj5EDKUWfIZOKeYEgpEEBQmKX7zUFvgA+FbuahIPxbk8IPXblB7Me00evvqglHZ8o7crp0LyL6SukIVXt3Pr3Jx+xWGU7ujI+v1I20mTZUh/3o9TPkTqrPI6NAMWL1DWz0m6t9S59JFXyq3zWOw+rw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RPWcuG1c; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RPWcuG1c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71691C2BD10; Thu, 23 May 2024 18:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716488340; bh=gw8y3FfzavCiPRp+Tzm9CwPAxk4GsPXQvMhRKDlNdYg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RPWcuG1c9ZXSiqZ6kgqpgEc6UqGOEvg00HOYJFMHPOwkV0qK18umMx+qZ3l4cKR5d uobq6yxkuELsAdbMu1ccapk9Dp5RHWch71q110w5Lar/s5l8Orel8w/6QHZ22B42mN RVl0jF1+sikAYDQyCsQj6OMSUQaC1PTtqJZfL1/2DRp7/ZHIzT3iaLwOCE+a90QcbZ bIDpN39jhjcjB/+fZ0q1/ciKafg0ymtCwVBvb23xuGksN5fikItGl/xlg9/y75fKlc Syr9IeYk+yVaqM6FzKbvZw0Neg3JEwZfQ1dPSWAAlNm+d7mf/v5yZDgknctMxQB3tv 78AsflaOPqAjg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sAD1l-00FGMG-QA; Thu, 23 May 2024 19:18:57 +0100 Date: Thu, 23 May 2024 19:18:57 +0100 Message-ID: <86jzjkmlwu.wl-maz@kernel.org> From: Marc Zyngier To: Nina Schoetterl-Glausch Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Andrew Scull , Will Deacon , Mark Rutland , Quentin Perret , David Brazdil , kernel-team@android.com Subject: Re: [PATCH v2 11/11] KVM: arm64: Get rid of the AArch32 register mapping code In-Reply-To: <678f6b8fe42f7a39eba4090a12a618cdbc710fa5.camel@linux.ibm.com> References: <20201102164045.264512-1-maz@kernel.org> <20201102164045.264512-12-maz@kernel.org> <66a7077c5df86d0a541237996382ae583d690a14.camel@linux.ibm.com> <86le40ms5m.wl-maz@kernel.org> <678f6b8fe42f7a39eba4090a12a618cdbc710fa5.camel@linux.ibm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: nsg@linux.ibm.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, ascull@google.com, will@kernel.org, mark.rutland@arm.com, qperret@google.com, dbrazdil@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 23 May 2024 17:19:38 +0100, Nina Schoetterl-Glausch wrote: > > On Thu, 2024-05-23 at 17:04 +0100, Marc Zyngier wrote: > > > Amazing. Thanks for spotting this. This is indeed broken. I guess this > > was not spotted because userspace is not totally broken itself. > > So it's an actual bug and not just doing more work than necessary? Definitely. > Could corrupt the regs of a 64bit kernel? Yup. If you have a 64bit guest with a 32bit userspace, and that you restore the state at the point where the latter is live, with any PSTATE bit set other than those in PSTATE.M, you corrupt the 64bit GPRs by zeroing the top 32bit. Linux as a guest is probably fine as it doesn't try to optimise the GPR save/restore for a 32bit userspace and will restore the registers from its stack (which itself is not corrupted), but that's still a pretty bad situation. > > Do you want to submit a fix adding the masking back? or should I do it > > myself? > > You go ahead and do it :) Will do shortly. Thanks again, M. -- Without deviation from the norm, progress is not possible.