From patchwork Wed Mar 22 04:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Poimboeuf X-Patchwork-Id: 13183521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C2D0C6FD1F for ; Wed, 22 Mar 2023 04:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eAiQqG7jnJjA7q1WRrNQbxCaXU2f57do73voTxHuB9k=; b=oq4fFcymzRBDlO G2qCMX/+YnrsEPaHiY6DFXy+h/ycd3tv83CGcoWJUqm7ZNPFjZTOZQPTyi5Qq9Ab1R83YhzZL7Oom 6sM7IrWBxhhcKuyy0mvSMzNi+ChYOOHTlDGprvn+7fCmDvfBDvENpmYfR9RKMQ8M7lbvi8GbyZ7TS k0F3k9sHv9AQqwtMAW/RlEMaVt2Ry2dRv5Zar/Eh9iSBiqkybG70HnqZSbzV3isHdGTqW3oCbxbCH fs1f/4j5HGAH3c34LJ94M7WBBzdpiB6dPnHsIzYXlkSP8qnkp/PERtwTKfc4umxzLQNhGTq0don9l sa3saLhH10KRs6+gq85Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pepeF-00EVCy-1W; Wed, 22 Mar 2023 04:00:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pepeC-00EV90-0W for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 04:00:25 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A24CE61E6B; Wed, 22 Mar 2023 04:00:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E5DAC433D2; Wed, 22 Mar 2023 04:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679457622; bh=i6IhVzT9OpzVoQyspMPLq+3N5zYy9EEMRpCDmXH98t4=; h=From:To:Cc:Subject:Date:From; b=DtxPoVGI4mjrJY0/CaMvvbpoAj9zmMGMUVZZkeFvN4b0EDxeUYodHoc+uSAgG7EMg md/SXA60oJPCZ3BM9einpvw9EdzWsAC5hT3eh6QxvfxqWiC+4ZkCgQDnKNI5LbOub6 8LhJPx+CL7C8weP3Nx+B6RiTiP5w7gl6ZQrufWyyZo40uw4wJKjEfEUmvjZOsreduk vAfCbhb7zCixqjKMoBMqSEN2hydxpPQqBrS8mLGw0HaDuUX7y2RhvNw+KV8Cy6FV32 Y6P+kOPY2///MNOis55LgPXkMeeEYiWo3jNtV61ZTtv5A2CMQevKVWRjwuDjPxf0Yg +5jkKhCtD1wQA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Mark Rutland , Jason Baron , Steven Rostedt , Ard Biesheuvel , Christophe Leroy , Paolo Bonzini , Sean Christopherson , Sami Tolvanen , Nick Desaulniers , Will McVicker , Kees Cook , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 00/11] static_call: Improve NULL/ret0 handling Date: Tue, 21 Mar 2023 21:00:06 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_210024_286485_C97AB778 X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Peter pointed out that v1 had CFI violations on arm64 with CONFIG_CFI_CLANG. Then I realized there are already CFI violations today in the existing code. So this ended up turning into a complete rewrite of v1. Highlights include: - Several cleanups - Fix arm64 CFI violations - Make NULL pointer behavior consistent across configs - Merge NULL and RET0 into a single concept v1 can be found here: https://lkml.kernel.org/lkml/cover.1678474914.git.jpoimboe@kernel.org Josh Poimboeuf (11): static_call: Improve key type abstraction static_call: Flip key type union bit static_call: Remove static_call_mod_init() declaration static_call: Remove static_call.h dependency on cpu.h static_call: Make ARCH_ADD_TRAMP_KEY() generic static_call: "EXPORT_STATIC_CALL_TRAMP" -> "EXPORT_STATIC_CALL_RO" static_call: Reorganize static call headers arm64/static_call: Fix static call CFI violations static_call: Make NULL static calls consistent static_call: Remove static_call_cond() static_call: Remove DEFINE_STATIC_CALL_RET0() arch/Kconfig | 4 + arch/arm/include/asm/paravirt.h | 2 +- arch/arm64/include/asm/paravirt.h | 2 +- arch/arm64/include/asm/static_call.h | 29 ++ arch/powerpc/include/asm/static_call.h | 1 - arch/powerpc/kernel/irq.c | 2 +- arch/powerpc/kernel/static_call.c | 6 +- arch/x86/events/amd/brs.c | 2 +- arch/x86/events/amd/core.c | 2 +- arch/x86/events/core.c | 29 +- arch/x86/include/asm/kvm-x86-ops.h | 6 +- arch/x86/include/asm/kvm-x86-pmu-ops.h | 3 +- arch/x86/include/asm/kvm_host.h | 4 +- arch/x86/include/asm/paravirt.h | 2 +- arch/x86/include/asm/perf_event.h | 2 +- arch/x86/include/asm/preempt.h | 6 +- arch/x86/include/asm/static_call.h | 22 +- arch/x86/kernel/alternative.c | 6 - arch/x86/kernel/paravirt.c | 1 + arch/x86/kernel/static_call.c | 89 +----- arch/x86/kvm/irq.c | 2 +- arch/x86/kvm/lapic.c | 22 +- arch/x86/kvm/pmu.c | 4 +- arch/x86/kvm/x86.c | 28 +- block/bio.c | 1 + include/linux/entry-common.h | 2 +- include/linux/entry-kvm.h | 2 +- include/linux/kernel.h | 4 +- include/linux/module.h | 2 +- include/linux/sched.h | 2 +- include/linux/static_call.h | 369 ++++++++++------------ include/linux/static_call_types.h | 74 +---- kernel/Makefile | 2 +- kernel/cgroup/cgroup.c | 1 + kernel/events/core.c | 15 +- kernel/sched/core.c | 18 +- kernel/static_call.c | 13 + kernel/static_call_inline.c | 64 +++- security/keys/trusted-keys/trusted_core.c | 2 +- sound/soc/intel/avs/trace.c | 1 + tools/include/linux/static_call_types.h | 74 +---- 41 files changed, 369 insertions(+), 553 deletions(-) create mode 100644 arch/arm64/include/asm/static_call.h