From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Brown Subject: Re: [PATCH v4 04/12] arm64: Basic Branch Target Identification support Date: Mon, 13 Jan 2020 14:00:51 +0000 Message-ID: <20200113140051.GI3897@sirena.org.uk> References: <20191211154206.46260-1-broonie@kernel.org> <20191211154206.46260-5-broonie@kernel.org> <20200110182800.GI8786@arrakis.emea.arm.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="h22Fi9ANawrtbNPX" Return-path: Received: from heliosphere.sirena.org.uk ([172.104.155.198]:55380 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728810AbgAMOBM (ORCPT ); Mon, 13 Jan 2020 09:01:12 -0500 Content-Disposition: inline In-Reply-To: <20200110182800.GI8786@arrakis.emea.arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Catalin Marinas Cc: Will Deacon , Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H.J. Lu" , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , Kristina =?utf-8?Q?Mart=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.orgli --h22Fi9ANawrtbNPX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 10, 2020 at 06:28:00PM +0000, Catalin Marinas wrote: > On Wed, Dec 11, 2019 at 03:41:58PM +0000, Mark Brown wrote: > > /* Additional SPSR bits not exposed in the UABI */ > > +#define PSR_BTYPE_SHIFT 10 > > + > > #define PSR_IL_BIT (1 << 20) > > =20 > > +/* Convenience names for the values of PSTATE.BTYPE */ > > +#define PSR_BTYPE_NONE (0b00 << PSR_BTYPE_SHIFT) > > +#define PSR_BTYPE_JC (0b01 << PSR_BTYPE_SHIFT) > > +#define PSR_BTYPE_C (0b10 << PSR_BTYPE_SHIFT) > > +#define PSR_BTYPE_J (0b11 << PSR_BTYPE_SHIFT) > Would these be better placed in the uapi/ptrace.h? Seems reasonable, they might be useful to virt stuff and they're part of the architecture so it's not like we might change them. > > + /* > > + * BTI note: > > + * The architecture does not guarantee that SPSR.BTYPE is zero > > + * on taking an SVC, so we could return to userspace with a > > + * non-zero BTYPE after the syscall. > On page 2580 of the ARM ARM there is a statement that "any instruction > other than BR, ..." sets BTYPE to 0. Wouldn't SVC fall into the same > category? I think what Dave was referring to there is that (unless I'm misreading things) that section of the ARM says that BTYPE is set at the end of the execution of the instruction but since SVC is specified as generating an exception that means that when we enter the kernel the instruction won't have ended yet and we still have the BTYPE from the previous instruction. > Reviewed-by: Catalin Marinas Thanks. --h22Fi9ANawrtbNPX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl4ceBAACgkQJNaLcl1U h9DLSQf6Apx/rsxXW/+0SHiXPGDJpdzgdlaKg/WkwvZD5tKjvP5SnU3YQ8L96jEk YLvo3VX4o6G174B4i7eQvKINZJOQXPzcgYtwV8LjZIxfg7qSygSFOlfxqXPxYoh1 M3UeD4sFYwQcvvuisyxxehY7F2Qpy7r2AGPcEz/lIgJBK/afVqze34aedkAc8USs RiEH1OneNIi0iiKiqrJTEjTNNH4eXokXteOoWKCQONDeMkBQUyGSJB09LKZibH/+ n1bqPuST5v4Qtag8JcHi9/z/xytJf6oO1QLWnXTqpUR3IUem+LucwksP8+xXIlXC vchzbBePuEZheDLobl52IOjKdmX2Vg== =X4rD -----END PGP SIGNATURE----- --h22Fi9ANawrtbNPX-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from heliosphere.sirena.org.uk ([172.104.155.198]:55380 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728810AbgAMOBM (ORCPT ); Mon, 13 Jan 2020 09:01:12 -0500 Date: Mon, 13 Jan 2020 14:00:51 +0000 From: Mark Brown Subject: Re: [PATCH v4 04/12] arm64: Basic Branch Target Identification support Message-ID: <20200113140051.GI3897@sirena.org.uk> References: <20191211154206.46260-1-broonie@kernel.org> <20191211154206.46260-5-broonie@kernel.org> <20200110182800.GI8786@arrakis.emea.arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="h22Fi9ANawrtbNPX" Content-Disposition: inline In-Reply-To: <20200110182800.GI8786@arrakis.emea.arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Catalin Marinas Cc: Will Deacon , Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H.J. Lu" , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , Kristina =?utf-8?Q?Mart=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Dave Martin Message-ID: <20200113140051.h7puWO7TQW3qHh8gs9KtwjjRsGKHYLFNdsFAI2i2H04@z> --h22Fi9ANawrtbNPX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 10, 2020 at 06:28:00PM +0000, Catalin Marinas wrote: > On Wed, Dec 11, 2019 at 03:41:58PM +0000, Mark Brown wrote: > > /* Additional SPSR bits not exposed in the UABI */ > > +#define PSR_BTYPE_SHIFT 10 > > + > > #define PSR_IL_BIT (1 << 20) > > =20 > > +/* Convenience names for the values of PSTATE.BTYPE */ > > +#define PSR_BTYPE_NONE (0b00 << PSR_BTYPE_SHIFT) > > +#define PSR_BTYPE_JC (0b01 << PSR_BTYPE_SHIFT) > > +#define PSR_BTYPE_C (0b10 << PSR_BTYPE_SHIFT) > > +#define PSR_BTYPE_J (0b11 << PSR_BTYPE_SHIFT) > Would these be better placed in the uapi/ptrace.h? Seems reasonable, they might be useful to virt stuff and they're part of the architecture so it's not like we might change them. > > + /* > > + * BTI note: > > + * The architecture does not guarantee that SPSR.BTYPE is zero > > + * on taking an SVC, so we could return to userspace with a > > + * non-zero BTYPE after the syscall. > On page 2580 of the ARM ARM there is a statement that "any instruction > other than BR, ..." sets BTYPE to 0. Wouldn't SVC fall into the same > category? I think what Dave was referring to there is that (unless I'm misreading things) that section of the ARM says that BTYPE is set at the end of the execution of the instruction but since SVC is specified as generating an exception that means that when we enter the kernel the instruction won't have ended yet and we still have the BTYPE from the previous instruction. > Reviewed-by: Catalin Marinas Thanks. --h22Fi9ANawrtbNPX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl4ceBAACgkQJNaLcl1U h9DLSQf6Apx/rsxXW/+0SHiXPGDJpdzgdlaKg/WkwvZD5tKjvP5SnU3YQ8L96jEk YLvo3VX4o6G174B4i7eQvKINZJOQXPzcgYtwV8LjZIxfg7qSygSFOlfxqXPxYoh1 M3UeD4sFYwQcvvuisyxxehY7F2Qpy7r2AGPcEz/lIgJBK/afVqze34aedkAc8USs RiEH1OneNIi0iiKiqrJTEjTNNH4eXokXteOoWKCQONDeMkBQUyGSJB09LKZibH/+ n1bqPuST5v4Qtag8JcHi9/z/xytJf6oO1QLWnXTqpUR3IUem+LucwksP8+xXIlXC vchzbBePuEZheDLobl52IOjKdmX2Vg== =X4rD -----END PGP SIGNATURE----- --h22Fi9ANawrtbNPX--