From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84DE6C4727D for ; Wed, 23 Sep 2020 19:19:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12AF92145D for ; Wed, 23 Sep 2020 19:19:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BHBJ0/mM"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="R/f7vi7J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12AF92145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZovPMMUGcMsccFwHlVd0eDnJ43mc0FFG4c5W4ZjPh/Q=; b=BHBJ0/mMNeD4e9AFEwH42t9qG 9VwfbR4aVOMdcD1q3QvYM3b2C9NEBEFg0x1cgRbrRZzSHNzU4V/vFnn64ey9A/tai02wdSSVOMmd/ 3yRqrdboLyPGujhdCWxQxMuYUYhVEEG9EB+EI0ECDVwufrF5FZGvZ14ilDc4kFGjAH6TNeJJ1/9ZP LL4p5A+psmjxoqWazeWihic26R8fDCHN0JfAkDwKSnpxp0GXAA2ROmNOqqOJf/cCwOTWure7qtJzI Zhrsad7p5bCjJjcoXotQZGEhxh/ykzbVqHhO6em7Ldfhn6543G9ri5nNdkqWqejZnGTT/t8Sjz6pG pPshaKIeg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLAGl-00062O-VI; Wed, 23 Sep 2020 19:17:35 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLAGj-00061X-BI for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2020 19:17:34 +0000 Received: from [192.168.254.38] (unknown [47.187.206.220]) by linux.microsoft.com (Postfix) with ESMTPSA id CE99120B7179; Wed, 23 Sep 2020 12:17:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CE99120B7179 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1600888651; bh=3V9yRh0zCmTojKK1USEI2jDBEq7wh/QbrL/41M/+wzU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=R/f7vi7J2qckScOCWh3kF/qy9S0K/1T6lHGGHPjotwbfa9uILSrVnoq4jZ3kOTEvo nllS7aBXEK+MSRSIiDfi9E0VmYqam8vNJ2ZSS4AtYLBqZgF45tCOyMP35SAjXg2jnk Ji3oSzQihgZhuEoO5YOa1VhHw0IBIwzXgyXJJYkw= Subject: Re: [PATCH v2 0/4] [RFC] Implement Trampoline File Descriptor To: Arvind Sankar 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> From: "Madhavan T. Venkataraman" Message-ID: Date: Wed, 23 Sep 2020 14:17:30 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200923091125.GB1240819@rani.riverdale.lan> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_151733_462370_2BA7D354 X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, pavel@ucw.cz, kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, oleg@redhat.com, mic@digikod.net, linux-security-module@vger.kernel.org, Florian Weimer , luto@kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, David.Laight@ACULAB.COM, libffi-discuss@sourceware.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel