From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15B35351C39 for ; Thu, 12 Mar 2026 18:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773340557; cv=none; b=KEPUtzVwrbf5I13dGOD5KxL9WZcx4O3rGo5+PcxAOnGcxdii94FIBahnHvW+Cqy2TwfKWveUE4x4raQ8cH0L4QOQ8t2ZlT1yt4v/Ql/aNwCR/CAY6X070tbLXvDphBpvDxDG20h3XpY1dUCMcQ5dZ9vakD8DY43ZUj/ErpBoVks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773340557; c=relaxed/simple; bh=f0ZimfGbQPBnbAQ7OvTTb30QQF/vnBQr3IOLZihzVJA=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=YEzWKK7yaSMdPLedvyYtOx8UmsTqLwUg6+ak9uu5o9/rxcCfFnbABucLFrQAMeg9pAf+cRJFfcOf2wuK+58RQWM9MOzVRmPwW1jbd9HVLT/kHInis17u4txNJPgWdR+4lpfo0U0BanI01cwpq1uXPlyPAZTvnQrkmxHuGYB4QH8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bg+Aj46C; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bg+Aj46C" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C6C9C4AF09; Thu, 12 Mar 2026 18:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773340556; bh=f0ZimfGbQPBnbAQ7OvTTb30QQF/vnBQr3IOLZihzVJA=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=bg+Aj46CYyIjYm9nmhEDyxLSroiQxXAbURXjtfU+DGHz0qDus/Qnd2LGvZ8BYkmAa 9vER0hw8kuhuO0SPDtx1qWN7K8HKwZc+DdnXhMgYcGzVQho8J4Sy4Axjn+bY2IkSYA yoVnL4o7BHis1OMJ/g3ZNsfjPuN9EVravXuTH5XJKgzbbB3usGH7UIBdyvpaJbSvqZ stx+b7Icbxe9OFZa9gl0akdnCP+eOMB6o9bFaW4sysY/CMivGgvnurcliyOVfKWa1X R+QMkHlTS09m6wTu11+d5iw7vwiG9+F0Eak572DszpcAFwbPEIVe1EA7EbdD2YhXCP 6tZq+gqnacplw== Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfauth.phl.internal (Postfix) with ESMTP id 45196F4006C; Thu, 12 Mar 2026 14:35:55 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-01.internal (MEProxy); Thu, 12 Mar 2026 14:35:55 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvkeejheduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedftehrugcu uehivghshhgvuhhvvghlfdcuoegrrhgusgeskhgvrhhnvghlrdhorhhgqeenucggtffrrg htthgvrhhnpeekvdffkefhgfegveekfedtieffhfelgeetiedvieffhfekfeeikeetueeg teetteenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghrugdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqudeijedthedttdejledqfeefvdduieegudehqdgrrhgusgeppe hkvghrnhgvlhdrohhrghesfihorhhkohhfrghrugdrtghomhdpnhgspghrtghpthhtohep udehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegtrghtrghlihhnrdhmrghrih hnrghssegrrhhmrdgtohhmpdhrtghpthhtohepjhgrmhgvshdrmhhorhhsvgesrghrmhdr tghomhdprhgtphhtthhopehmrghrkhdrrhhuthhlrghnugesrghrmhdrtghomhdprhgtph htthhopehkvggvshgtohhokhestghhrhhomhhiuhhmrdhorhhgpdhrtghpthhtoheprhho shhtvgguthesghhoohgumhhishdrohhrghdprhgtphhtthhopegtmhhllhgrmhgrshesgh hoohhglhgvrdgtohhmpdhrtghpthhtohepqhhpvghrrhgvthesghhoohhglhgvrdgtohhm pdhrtghpthhtohepshgrmhhithholhhvrghnvghnsehgohhoghhlvgdrtghomhdprhgtph htthhopehpvghtvghriiesihhnfhhrrgguvggrugdrohhrgh X-ME-Proxy: Feedback-ID: ice86485a:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 1AC38700069; Thu, 12 Mar 2026 14:35:55 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ThreadId: ABOARHXOdhSZ Date: Thu, 12 Mar 2026 19:35:34 +0100 From: "Ard Biesheuvel" To: "Carlos Llamas" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Mark Rutland" , "Quentin Perret" , "Catalin Marinas" , "James Morse" , "Will Deacon" , "Frederic Weisbecker" , "Peter Zijlstra" , "Kees Cook" , "Sami Tolvanen" , "Andy Lutomirski" , "Josh Poimboeuf" , "Steven Rostedt" Message-Id: <83c36b0a-7e7d-4651-8e2c-86452c3bd96b@app.fastmail.com> In-Reply-To: References: <20211105145917.2828911-1-ardb@kernel.org> <20211105145917.2828911-3-ardb@kernel.org> Subject: Re: [PATCH v6 2/2] arm64: implement support for static call trampolines Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi Carlos, On Thu, 12 Mar 2026, at 19:02, Carlos Llamas wrote: > On Fri, Nov 05, 2021 at 03:59:17PM +0100, Ard Biesheuvel wrote: >> Implement arm64 support for the 'unoptimized' static call variety, which >> routes all calls through a single trampoline that is patched to perform a >> tail call to the selected function. >> >> It is expected that the direct branch instruction will be able to cover >> the common case. However, given that static call targets may be located >> in modules loaded out of direct branching range, we need a fallback path >> that loads the address into R16 and uses a branch-to-register (BR) >> instruction to perform an indirect call. >> >> Unlike on x86, there is no pressing need on arm64 to avoid indirect >> calls at all cost, but hiding it from the compiler as is done here does >> have some benefits: >> - the literal is located in .text, which gives us the same robustness >> advantage that code patching does; >> - no performance hit on CFI enabled Clang builds that decorate compiler >> emitted indirect calls with branch target validity checks. >> >> Acked-by: Peter Zijlstra >> Signed-off-by: Ard Biesheuvel >> --- > > I'm starting to testing this out on top of 7.0-rc3... > Please use the v3 I referred to on the thread. The code patching is a bit hairy, and so we should only consider that if there is a real use case for it. Same goes for the special handling of the ret0 case - AFAIR, the v3 handles that transparently as it will just use the generic RET0 handler as the target. ... > > A CFI crash was reported in [1]. Also, I was able to reproduce a CFI > failure with just a simple "linux-perf" command. With this patchset I no > longer see these issues. Awesome! > > [1] https://lore.kernel.org/all/YfrQzoIWyv9lNljh@google.com/ > Awesome!