[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a742b9cd-4ffb-60e0-63b8-894800009700@linux.microsoft.com>
Date: Wed, 23 Sep 2020 14:17:30 -0500
From: "Madhavan T. Venkataraman" <madvenka@...ux.microsoft.com>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: Florian Weimer <fw@...eb.enyo.de>,
kernel-hardening@...ts.openwall.com, linux-api@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-fsdevel@...r.kernel.org, linux-integrity@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, oleg@...hat.com,
x86@...nel.org, libffi-discuss@...rceware.org, luto@...nel.org,
David.Laight@...LAB.COM, mark.rutland@....com, mic@...ikod.net,
pavel@....cz
Subject: Re: [PATCH v2 0/4] [RFC] Implement Trampoline File Descriptor
On 9/23/20 4:11 AM, Arvind Sankar wrote:
> For libffi, I think the proposed standard trampoline won't actually
> work, because not all ABIs have two scratch registers available to use
> as code_reg and data_reg. Eg i386 fastcall only has one, and register
> has zero scratch registers. I believe 32-bit ARM only has one scratch
> register as well.
The trampoline is invoked as a function call in the libffi case. Any
caller saved register can be used as code_reg, can it not? And the
scratch register is needed only to jump to the code. After that, it
can be reused for any other purpose.
However, for ARM, you are quite correct. There is only one scratch
register. This means that I have to provide two types of trampolines:
- If an architecture has enough scratch registers, use the currently
defined trampoline.
- If the architecture has only one scratch register, but has PC-relative
data references, then embed the code address at the bottom of the
trampoline and access it using PC-relative addressing.
Thanks for pointing this out.
Madhavan
Powered by blists - more mailing lists