Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1686379qtg; Tue, 21 Mar 2023 21:01:03 -0700 (PDT) X-Google-Smtp-Source: AK7set9U7aVph6GyDgiL5BsIwnqXKP2I7UlGNU5hm7YMeCszeOTcbfNnv2X4cnVcGM0JUj2BGLJU X-Received: by 2002:a62:17c9:0:b0:625:ce21:3b1b with SMTP id 192-20020a6217c9000000b00625ce213b1bmr1852140pfx.3.1679457663439; Tue, 21 Mar 2023 21:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679457663; cv=none; d=google.com; s=arc-20160816; b=f4+s+knorRNEZ6Fbk73rH7SmaAWCClAXE4jzQk/m9hYBF3OmYXNbhEITok/jfRg2bD kPRyxTHpxosTY/qPSYatRoY1bTJfQ581Y6aHTbdG2g7en8l0znQZECEZj0BvMZcr0ZHo ofp/td3EGWlXp6PCkA5mPzqXUpitijlm4UeP62YA2BvWcvOz2hJ67D6M3zHwrWlOQJGr jFljZItsGy5BVDSt3mh717/F0NC4s4cG+otr9PlnYIMCQsXFPhfg+gLG+C5O330B4+1q smgoVvu6P7ud8mH/Bio4dU6ecZldfTCFNKZBuHYZVMw46oJT8pD4UY3IMvGRhk0y8TB7 x/Nw== 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=di91JeLVw9ykyPqr9Rf6Ns4gQx7Wfg0kRWCWxfJmUYc=; b=hLgjsr1ofMtkoNWfM4vh7q83mpsZ4mv2p1+QpDWieGYAkrahXBMXRa7iSzzgPruGKY VXJLYytdgAvEPYwGwDCwyUZhvp5t1Kz38bv6muZ0IN8j+AvdHjacp9S+3EX+TmxtY0jB QMkDm8uNCsTybfRPke0VBGYfJ3btvd9Xyusr+gsRR3vKkZMvklbCpTESan+z8AWY5juO apHkWfHsYXliQKK/fpXD9jYsht5P6Jx8/vpBfWKl+v0Z0wl2Cx5MRChpe5zZDNi+gAlY lXJVwtqJFJQodEHTU0JJPASNxh1KVLyfRUrNBLRd6zb7EfMc/fz9gvp+auZktsseBsYj WJ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DtxPoVGI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fc34-20020a056a002e2200b00625c8edafbesi15857872pfb.375.2023.03.21.21.00.51; Tue, 21 Mar 2023 21:01:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DtxPoVGI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230259AbjCVEA0 (ORCPT + 99 others); Wed, 22 Mar 2023 00:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjCVEAY (ORCPT ); Wed, 22 Mar 2023 00:00:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11B9B474D4 for ; Tue, 21 Mar 2023 21:00:23 -0700 (PDT) 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 9EF3260BF0 for ; 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 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.39.2