From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 98D9D388393 for ; Fri, 13 Mar 2026 08:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773391964; cv=none; b=tY/3BSkbsSxbM6yVXPpoF2bGxhB+CNaH9FntBNJf3fPUmJOwVitHqKWO7L9ZbCl4nm4jDyFuPUYWEfMJ2Zm+bTvjqAujBuP/TOCUN83BqdtU8aoNmXRmRHCsmwAHVuCYgercCjb5zdKMUTHFVzKyiN1GOok2z7916PJ8/Fj8uV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773391964; c=relaxed/simple; bh=cT/rijgND5Qp3cvkZIs3z8BgZX3AdLPoOC2jNOaOUhg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rTAqU2geOMrUOYwMKli0su+CTUUmyZzPyA+xoahP71FMT0AkwGhGC1vChkrTWRqtNtnk+iz2cz6nPQZC2pwDYN/OLl8T/6TdCVdMcyhfnE67Zu7WVhK+KrsvSbX20TbsgMafWUIwsEHZ0D9G1fqHIdou+qxZb/bVYCqE0wp5yJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=k9BizMQj; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="k9BizMQj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fNn4XaZ2VS/zsHBYZQFDgNHq36gX0XLH6P9/sAQlBTs=; b=k9BizMQjRcxXSRxrmcBLQsGtE8 /8eSNUfEeYypk/SSHa9YJjp9vBT1b0ICYWDh1kX+XEzhfpE0M7zxWKJ4PyVNfO3+0UfOgm6KWhSkS XTOchJBJ2ZqGvt4X7FVNDKLhZ04DbhNxRFzkPCtLy4Er1rsGN06au4kPLBC1Pqmn+8InT6JkXEmMr ITEZATm4uV5RtjF4NiimiU7wDwfbJDKsrMHhULw4bm9tV+fY1IRAgveh8iwTABwqKnYV1Xw7jF1NO SVrZpY/66pmOoII+tLjvkx9x9Z3gMJuef+haCw1lZ0AFsv0lFhTVYJ3uYjpN/ETx1zXxXWOeTH94H NhpYsHjg==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w0yG0-00000002tqI-3vp6; Fri, 13 Mar 2026 08:52:33 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 62F78301BD5; Fri, 13 Mar 2026 09:52:32 +0100 (CET) Date: Fri, 13 Mar 2026 09:52:32 +0100 From: Peter Zijlstra To: Carlos Llamas Cc: linux-arm-kernel@lists.infradead.org, Sami Tolvanen , Catalin Marinas , Will Deacon , Josh Poimboeuf , Ard Biesheuvel , Mark Rutland , Kees Cook , Quentin Perret , Steven Rostedt , Will McVicker , Sean Christopherson , kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7] arm64: implement support for static call trampolines Message-ID: <20260313085232.GJ606826@noisy.programming.kicks-ass.net> References: <20260313061852.4025964-1-cmllamas@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260313061852.4025964-1-cmllamas@google.com> On Fri, Mar 13, 2026 at 06:18:52AM +0000, Carlos Llamas wrote: > From: Ard Biesheuvel > > 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. > > Since static call targets may be located in modules loaded out of direct > branching range, we need to use a ADRP/ADD pair to load the branch target > into R16 and use 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 .rodata, 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. > > Cc: Peter Zijlstra (Intel) > Signed-off-by: Ard Biesheuvel > Signed-off-by: Carlos Llamas Acked-by: Peter Zijlstra (Intel)