From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by sourceware.org (Postfix) with ESMTPS id 6AC193857C52 for ; Thu, 24 Sep 2020 22:13:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6AC193857C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=pavel@ucw.cz Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 0D9A61C0BE0; Fri, 25 Sep 2020 00:13:43 +0200 (CEST) Date: Fri, 25 Sep 2020 00:13:42 +0200 From: Pavel Machek To: "Madhavan T. Venkataraman" Cc: Arvind Sankar , Florian Weimer , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, oleg@redhat.com, x86@kernel.org, libffi-discuss@sourceware.org, luto@kernel.org, David.Laight@ACULAB.COM, mark.rutland@arm.com, mic@digikod.net Subject: Re: [PATCH v2 0/4] [RFC] Implement Trampoline File Descriptor Message-ID: <20200924221342.GB13185@amd> References: <20200916150826.5990-1-madvenka@linux.microsoft.com> <87v9gdz01h.fsf@mid.deneb.enyo.de> <96ea02df-4154-5888-1669-f3beeed60b33@linux.microsoft.com> <20200923014616.GA1216401@rani.riverdale.lan> <20200923091125.GB1240819@rani.riverdale.lan> <20200923195147.GA1358246@rani.riverdale.lan> <2ed2becd-49b5-7e76-9836-6a43707f539f@linux.microsoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nVMJ2NtxeReIH9PS" Content-Disposition: inline In-Reply-To: <2ed2becd-49b5-7e76-9836-6a43707f539f@linux.microsoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_LIVE, SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libffi-discuss@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libffi-discuss mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2020 22:13:49 -0000 --nVMJ2NtxeReIH9PS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > PC-relative data referencing > ---------------------------- >=20 > I agree that the current PC value can be loaded in a GPR using the trick > of call, pop on i386. >=20 > Perhaps, on other architectures, we can do similar things. For instance, > in architectures that load the return address in a designated register > instead of pushing it on the stack, the trampoline could call a leaf func= tion > that moves the value of that register into data_reg so that at the locati= on > after the call instruction, the current PC is already loaded in data_reg. > SPARC is one example I can think of. >=20 > My take is - if the ISA supports PC-relative data referencing explicitly = (like > X64 or ARM64), then we can use it. Or, if the ABI specification documents= an > approved way to load the PC into a GPR, we can use it. >=20 > Otherwise, using an ABI quirk or a calling convention side effect to load= the > PC into a GPR is, IMO, non-standard or non-compliant or non-approved or > whatever you want to call it. I would be conservative and not use ISAs are very well defined, and basically not changing. If you want to argue we should not use something, you should have very clear picture _why_ it is bad. "Non-standard or non-approved or whatever" just does not cut it. And yes, certain tricks may be seriously slow on modern CPUs, and we might want to avoid those. But other than that... you should have better argument than "it is non-standard". Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --nVMJ2NtxeReIH9PS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl9tGhYACgkQMOfwapXb+vJZHwCfU5jKO40qUDcezUI+s8fyyfU7 zC8An2cC26db1I80i/2GbnoRTakpnf34 =8gy5 -----END PGP SIGNATURE----- --nVMJ2NtxeReIH9PS--