Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp798804pxm; Thu, 3 Mar 2022 05:02:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuGMe4C67ZNqXl/mGm8CWBRaqvYVcPaM1YtswmbtZFaa3r2ot4Jb0xcOX2iPKMnGChzZvy X-Received: by 2002:a17:90a:71c1:b0:1be:7da1:85dc with SMTP id m1-20020a17090a71c100b001be7da185dcmr5205671pjs.221.1646312529993; Thu, 03 Mar 2022 05:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646312529; cv=none; d=google.com; s=arc-20160816; b=gNn7LXGOsq9tTtH+gWjngLIWkF+jI94gIsaNWkDpL4dRWHkRIfSpcEwvENkqCfVvRb nX4oSPNI8QOW+idi7350xUA0OMxuAu2DXuMVZ9zMXl5HV9SCJAT/SZr8ClEWviaJMsHb QK6/Xqtanmh24Tz6/T1lNILwHBAWD8IWWY1aOKNNtr0prqAhsdU5mHaCeqqZgAmMDNZ4 aboc5KT5/EBMcn6M1Ike3e+IXec9afa/qMBs8ua0jEGdI0vVarnh7cojcpF2X5NH9Kx0 o5aQoIbdSVz1HfkxnNXxmb3lMTyyoTXgXm3R5ImbRZuiF1SBHHBI1PMomvCp7XVQ17HW Pj/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=ubKvPzHSTf9I/HpHJnBuEu/vAwkkIzBDgMQoNkBO5jQ=; b=eCpHK/v//R0017KCyg+lUZsraL7IQMql2LQZJWO6thNCoXTbHwU+JjAhHXPN+eYBTQ XMNVIK8Y2Y7LtMsF0Dq79e1YuGzdoTyxucGq2ac7onOIrfumciTJspNohNc7UjHB4vq/ lJPrJRp4zvbAY0Fcfqwuo3ePiKln5UzN6DVLi/YNZh4TbAolHd2S64az2ZvmXLXLgeM4 MjmlNB4o+bEB1PfFOoajAXCPX4cByJv5G6/LwP4lfLlCb7i8BLmcLHTglAiqjxHKqzVX XVJEJjiCx7iFA91BBtX2XMr+nlPfFFweE4Y2fCPiDRXp8yCMHYsNMumrppbhLQg+AcC8 GUmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Cpd4Z+fB; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020a056a00190500b004c277bfcf86si2072263pfi.49.2022.03.03.05.01.53; Thu, 03 Mar 2022 05:02:09 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=Cpd4Z+fB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbiCCLdt (ORCPT + 99 others); Thu, 3 Mar 2022 06:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232783AbiCCLbR (ORCPT ); Thu, 3 Mar 2022 06:31:17 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE66417CC6B for ; Thu, 3 Mar 2022 03:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=ubKvPzHSTf9I/HpHJnBuEu/vAwkkIzBDgMQoNkBO5jQ=; b=Cpd4Z+fBvh/XBPp/d+iv0sACfG +bIeBLbVSZwAomx/06nH8vMFm+Mnv8BsoRH+eL8sRmKCo3ksG5ra2NwU6HM4Vz9C1xgf1NZW/5TqJ tcYpQeA47rw3gBJ7nV/wLqtz9yYHUCGfXwZkaW/4soRK/QdjFkiXcNa0CusZFxHcGc9vGU6rNgHSB +kGVgCEgdG1z8zb2nAgrtiviwaal1J4GsyXQ0l12Wu5txqg+sG71njgThs3dSIUYonuoAybj7HdXp TlsRdITTfH/2XzY82wEEMcj/pp2+T8pvVKtonRVj2QIdVZu8obFQutIFztVsdfMCUPMfl7LuDewKI QvMEiCuQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjeh-00BaH3-G3; Thu, 03 Mar 2022 11:30:01 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 05D33302AD4; Thu, 3 Mar 2022 12:29:57 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 72F2130126648; Thu, 3 Mar 2022 12:29:56 +0100 (CET) Message-ID: <20220303112826.360149715@infradead.org> User-Agent: quilt/0.66 Date: Thu, 03 Mar 2022 12:23:44 +0100 From: Peter Zijlstra To: x86@kernel.org, joao@overdrivepizza.com, hjl.tools@gmail.com, jpoimboe@redhat.com, andrew.cooper3@citrix.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, ndesaulniers@google.com, keescook@chromium.org, samitolvanen@google.com, mark.rutland@arm.com, alyssa.milburn@intel.com, mbenes@suse.cz, rostedt@goodmis.org, mhiramat@kernel.org, alexei.starovoitov@gmail.com Subject: [PATCH v3 23/39] x86/alternative: Simplify int3_selftest_ip References: <20220303112321.422525803@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Similar to ibt_selftest_ip, apply the same pattern. Suggested-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/kernel/alternative.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -719,7 +719,7 @@ asm ( " .popsection\n" ); -extern __initdata unsigned long int3_selftest_ip; /* defined in asm below */ +extern void int3_selftest_ip(void); /* defined in asm below */ static int __init int3_exception_notify(struct notifier_block *self, unsigned long val, void *data) @@ -733,7 +733,7 @@ int3_exception_notify(struct notifier_bl if (val != DIE_INT3) return NOTIFY_DONE; - if (regs->ip - INT3_INSN_SIZE != int3_selftest_ip) + if (regs->ip - INT3_INSN_SIZE != (unsigned long)&int3_selftest_ip) return NOTIFY_DONE; int3_emulate_call(regs, (unsigned long)&int3_magic); @@ -757,14 +757,7 @@ static void __init int3_selftest(void) * then trigger the INT3, padded with NOPs to match a CALL instruction * length. */ - asm volatile ("1: int3; nop; nop; nop; nop\n\t" - ".pushsection .init.data,\"aw\"\n\t" - ".align " __ASM_SEL(4, 8) "\n\t" - ".type int3_selftest_ip, @object\n\t" - ".size int3_selftest_ip, " __ASM_SEL(4, 8) "\n\t" - "int3_selftest_ip:\n\t" - __ASM_SEL(.long, .quad) " 1b\n\t" - ".popsection\n\t" + asm volatile ("int3_selftest_ip: int3; nop; nop; nop; nop\n\t" : ASM_CALL_CONSTRAINT : __ASM_SEL_RAW(a, D) (&val) : "memory");