Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2567056pxb; Sat, 25 Sep 2021 10:47:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6H973Bas5yj863JvEjOw5LQAeKUZSi+GJ9Vn/SJg43bzrI1kz3NO7GFEnRfEGUOTsdzB+ X-Received: by 2002:a5e:c20c:: with SMTP id v12mr13710695iop.46.1632592067805; Sat, 25 Sep 2021 10:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632592067; cv=none; d=google.com; s=arc-20160816; b=OTJrfBFq+RKxbKiHqRDMCFFpDqo9UtQeuLF9tsEO/Hh8nFG5DV0sFUTLqlp9AH5noO HTYwepwk+z7GZ03WQmzz71FGnsPaiSzK0YjBx0MRW2sxAgnipESZiOF17VCt9IritiXx /2QQLQgf4gj0+uKOfD4VQmtPaTFT3YRplOhyWI2C09dn8p4xPqtM01bBDEc2Uu/1b46E z9dN8Oyo1olFcVYvN3i/TPMv01q2Va4euPtaR9bCw6kWYzpvVHZsZYYSX5tZnmXKZrO+ CEZJpvGb1lSF0LYw2mfYdC0mpjIRudXaMOqaVy3c/mj8tYIclZXVjVlahws2ICudWezu QzSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=yRGpPJ3SrJUV2UVR3Mm9rzKsuDCIIbQ/i1//KeMQg8s=; b=LTBWVo5xfMfr2FaUuxh5opmrN5A2PN7H/rrORFLL8PFsmsY/KVGRhhv8yrLz3Bg4ek zGIKsxfWEUybFm1Eii05e5+vFm3rUnOZ9sEKX0WKMPj2reVSlu25vZStW4Z0w7g19zOc YTTC3926vVM2YdPfVBtrMRElDyKfuCBoVZj3vZg9MfEY2vwibYF77FnIsMwiKzcXXmRf /TIRQm9zC1rCDIiAm0ZuqyHrV67MwrtU4fVXNCteO5URfamQbRSF/FUIjuqejLJu08hW hwmr7cM8gsAsTJGiRQbz50Ug6EyS/aZ8tRYbHoVnbf/uiaE5esKeTga/PiUj/38WuLKp /Qxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si14546955ilh.150.2021.09.25.10.47.37; Sat, 25 Sep 2021 10:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbhIYRsD convert rfc822-to-8bit (ORCPT + 99 others); Sat, 25 Sep 2021 13:48:03 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]:26270 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbhIYRsC (ORCPT ); Sat, 25 Sep 2021 13:48:02 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-156-ewJMD0BWPVa3vtUVviHdjQ-1; Sat, 25 Sep 2021 18:46:24 +0100 X-MC-Unique: ewJMD0BWPVa3vtUVviHdjQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Sat, 25 Sep 2021 18:46:23 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.023; Sat, 25 Sep 2021 18:46:23 +0100 From: David Laight To: 'Mark Rutland' , Ard Biesheuvel CC: Peter Zijlstra , Frederic Weisbecker , Catalin Marinas , Will Deacon , LKML , James Morse , Quentin Perret , Christophe Leroy Subject: RE: [PATCH 2/4] arm64: implement support for static call trampolines Thread-Topic: [PATCH 2/4] arm64: implement support for static call trampolines Thread-Index: AQHXrwWrezksd71Yok+e/XO37WsWo6u1CydQ Date: Sat, 25 Sep 2021 17:46:23 +0000 Message-ID: <944ef479f1104c4a97d0e3f629a9b765@AcuMS.aculab.com> References: <20210920233237.90463-1-frederic@kernel.org> <20210920233237.90463-3-frederic@kernel.org> <20210921153352.GC35846@C02TD0UTHF1T.local> <20210921162804.GD35846@C02TD0UTHF1T.local> In-Reply-To: <20210921162804.GD35846@C02TD0UTHF1T.local> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland > Sent: 21 September 2021 17:28 > > On Tue, Sep 21, 2021 at 05:55:11PM +0200, Ard Biesheuvel wrote: > > On Tue, 21 Sept 2021 at 17:33, Mark Rutland wrote: > > > > > > On Tue, Sep 21, 2021 at 04:44:56PM +0200, Ard Biesheuvel wrote: > > > > On Tue, 21 Sept 2021 at 09:10, Peter Zijlstra wrote: > > ... ... > > > > > > I think so, yes. We can do sligntly better with an inline literal pool > > > and a PC-relative LDR to fold the ADRP+LDR, e.g. > > > > > > .align 3 > > > tramp: > > > BTI C > > > {B | RET | NOP} > > > LDR X16, 1f > > > BR X16 > > > 1: .quad > > > > > > Since that's in the .text, it's RO for regular accesses anyway. > > > > > > > I tried to keep the literal in .rodata to avoid inadvertent gadgets > > and/or anticipate exec-only mappings of .text, but that may be a bit > > overzealous. > > I think that in practice the risk of gadgetisation is minimal, and > having it inline means we only need to record a single address per > trampoline, so there's less risk that we get the patching wrong. But doesn't that mean that it is almost certainly a data cache miss? You really want an instruction that reads the constant from the I-cache. Or at least be able to 'bunch together' the constants so they stand a chance of sharing a D-cache line. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)