Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2989189pxb; Fri, 5 Nov 2021 08:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFi4TxRNlmcfLo2nhgciHmIsPwE5zbUCqa8ihFXdw9/XlKNAkP3vg+Qq0sFifoBbef8wbW X-Received: by 2002:a05:6638:12cb:: with SMTP id v11mr9663922jas.13.1636124458912; Fri, 05 Nov 2021 08:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636124458; cv=none; d=google.com; s=arc-20160816; b=agmNmVDx8YLV/MAtx1+9oBb28PyAjs/NdvNINxm9tBO1pnLR+OxW5yA9N1/vbTTNVM B88TSOzddOaPhpisNSPu5EiQFxueniWPbr689TPR0bWgTTcqG2t7es+K629co+yYje+n 77jV1t4ddN1TEz5RtkYfzsSWtrLS5YeXkb7WbBYPZ6zHBN8ekMXFHI8aCh6X5M6dmGJl 5qx5a94BDxjT/CrSLZ11Ymn4F62EoiMRtkDTbSORUyrmEZS4wl1dsdrOTJRdTg1F+Zr+ NgBb5omG9NtiEzhniBPFYfLogguDlRjOWohtgu/NYAn+ojB+FH6qxeIA7mKW3/YtU9Fv 66mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zIrytwrRmvUlQRXI5wMgVIaVxbfIh1hsvJF7LV1FPCI=; b=LVfCp9FjtgFFXVh+IjV7rzodo/+G1m90Ns76RJGKTWrxePpxEei3QGog+jxXC0P4Bq MxPJ59J7BQ5evwcBI/fBiGFZQgJgZJy/KFVFhWe4Ah/FNDzbNRv0VuZz6ymPaR8bJzE8 cI1kfJeAAVOmF89YDa6CyP3Tagsemag90LbVHzWTQsS6acZud3HVAe1fmErdGiUQbP+g YqFXaHbYusbKIuNL/ePLYVRD3J0VGFU2gaLnWje+c+1RZ2/xMkI3V1wU6tarO7+6U0tC DsT9LQ5x+bDoOeqP/V733FaoOQLSKz3sCF62GUs7gzDgergaXp/n90l3GPLue60ZZJmi fJAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=STO1ghN4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si17213719jaj.98.2021.11.05.08.00.42; Fri, 05 Nov 2021 08:00:58 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=STO1ghN4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233319AbhKEPCE (ORCPT + 99 others); Fri, 5 Nov 2021 11:02:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:52104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233299AbhKEPCE (ORCPT ); Fri, 5 Nov 2021 11:02:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5F1EF611C0; Fri, 5 Nov 2021 14:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636124364; bh=pKL79R6e/6XFSt3xwJ9CLWqM2WH3RKaSvXVeu+Riva8=; h=From:To:Cc:Subject:Date:From; b=STO1ghN4zaCF5IOzyYOj6Ff3mkZPthU7Jl8FcSWcjF7begjBgU4eRF9AWyvCZlj2h /q2/7GHX0sPDqAIT7aLttfpmonsLzAOhXT26w3dzeFkFeimq3GmpNvjf33b63bofXe SQmLWGYS6qmw2lFUrpBMOITGM1ZIvECPprmLTpNFVucBlhETHzmn26/vOxm3smwXmh 8PmIlxm2j9sD2bMN8dErb4ZtjGw0o2Os0eQ1/ZIJZFihREQVwC7IQHD7/1tBHZD7mM rMekz8dZD2XIT5l+8tr4v3vWzDNz2hdo1/pd7asr6rwG4gLSm4QqJCZ4M2bbtJxLQu bortuVTSAA9fQ== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Mark Rutland , Quentin Perret , Catalin Marinas , James Morse , Will Deacon , Frederic Weisbecker , Peter Zijlstra , Kees Cook , Sami Tolvanen , Andy Lutomirski , Josh Poimboeuf , Steven Rostedt Subject: [PATCH v6 0/2] static call support for arm64 Date: Fri, 5 Nov 2021 15:59:15 +0100 Message-Id: <20211105145917.2828911-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2148; h=from:subject; bh=pKL79R6e/6XFSt3xwJ9CLWqM2WH3RKaSvXVeu+Riva8=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhhUbAj5SBIcvjKtxaOssCNZgQWw/pHGgDQICvYqHa 6zjLF4+JAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYYVGwAAKCRDDTyI5ktmPJBUdC/ 0T1Dc01GVgdNiLpzvWkonon53HTdb9vEYTLLXfwNKsjnI3kcz6LRWtjpSTcxNcryANcq7X+L9ofz59 6E+iEqAMlAKovbJlF4E99DPgtpEM50bn96RAk7eDbESggSRW5JD4OHK/6HlHPk3rjrGLrDPIeC5PJy noVUMVClmR07CPEniOq4FDwBTkEfEk9LwKjCfsQu0gAozt9APTnk0xKi/GkJriwKnozkrEWbSnwuZy qmuLorCxBAZmxWVG4Uh4XPBWNPHruLB4PAcxXrp1Dz+P1w8NOs2mt6pOxxecVCiPK+ITkhmOwyTgVc pTsWlmWrtXdOH4qKr4LGph0PQwVFJhBRWbMlQq8W/2ZLeHDcAsl0WiGnvM1EVW17al/Xs0S/05l6Ne PINHHrYdhlHKXjDK6WTAoroh8Sq9it5dG2FyihmJqyINHjNju/4zGHrHUYzeuAcYadHUJad+pz7KOd kHuYusJV+htQgWVsSyvXE648BA98I+8649MFyyadZRSMc= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This implements non-inline static calls for arm64. This is rather straight-forward, as we don't rely on any tooling to look for static call sites etc. The only minor complication is Clang CFI, which is already in mainline for arm64, and requires a little tweak to ensure that we don't end up patching the CFI jump table instead of the static call trampoline itself. Changes since v5: - drop the patch that works around issues with references to symbols with static linkage from asm blocks; this is specific to Clang+ThinLTO in versions before 13, so we can just decide not to support that config. - add a patch to use non-function type symbols for the trampolines, to ensure that taking the address gives us the trampoline itself rather than the address of a CFI jump table entry that branches to it. Changes since v4: - add preparatory patch to address generic CFI/LTO issues with static calls - add comment to patch #2 describing the trampoline layout - add handling of Clang CFI jump table entries - add PeterZ's ack to patch #2 Cc: Mark Rutland Cc: Quentin Perret Cc: Catalin Marinas Cc: James Morse Cc: Will Deacon Cc: Frederic Weisbecker Cc: Peter Zijlstra Cc: Kees Cook Cc: Sami Tolvanen Cc: Andy Lutomirski Cc: Josh Poimboeuf Cc: Steven Rostedt Ard Biesheuvel (2): static_call: use non-function types to refer to the trampolines arm64: implement support for static call trampolines arch/arm64/Kconfig | 2 + arch/arm64/include/asm/static_call.h | 40 ++++++++++ arch/arm64/kernel/patching.c | 77 +++++++++++++++++++- arch/arm64/kernel/vmlinux.lds.S | 1 + include/linux/static_call.h | 4 +- include/linux/static_call_types.h | 11 ++- 6 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 arch/arm64/include/asm/static_call.h -- 2.30.2