Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6007757iob; Tue, 10 May 2022 08:22:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQzFh2LEOi3ibJj2A46g4Egdunn5UFUg+fdKzK/EzJmsWPZGnAHw4US8G5MUbiGG8CmyoO X-Received: by 2002:a05:6638:14d1:b0:32b:bd9c:3f17 with SMTP id l17-20020a05663814d100b0032bbd9c3f17mr9900849jak.309.1652196130735; Tue, 10 May 2022 08:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652196130; cv=none; d=google.com; s=arc-20160816; b=aBBa9L0LR9PIBaNNqlVPYi6R/sXfIWDSSd9MKYFaYZc2x6ruLG2oYzaOkLhDqAxGXn tJKlWujrxGRViIufNDfRKa2OCvHAWltGO3Y/Vl4YAG+RpBknSPmOj+xaEBtiz32XYMuF znvS+aw1T7zfabBLRDQXSFpXF0lwbGFB3IYD9CSlkcaEMLr7CB4EDHYbad7nnTX7NFy9 l60JLipky4LrBxOm+iGZi4QilwItmVWaKLsn+wzCdxzrpKamDIUM/E5+WdqUas+VkGUm nIFCilq9RpBF0TXlW5Up9CpExhgrSvna6ELxJIgw4wNssvxVAXUv/GSgpmwtbl6OBNkd 0Uzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=ZcFtI8jvSLQdq7u3zXtig0/LPNcCJ80T1zsBtiZt0Y0=; b=gDq5Tz2X0cFWCAp0Vxho8hnOcDdga5Xoi7f2cj+dS14FM9GPBxmFqHCRejyOi28gDS RYP3Rqaufxzfx6LQRzCo+h7oZuW8sBxW3kGQEdEEaEDg6m9oZQfW7gRM2867dmnVMdFb Ou9SkJ067Wo6y5hO79jmv5DLzm9CEVdyEkwrB0ia1P7KCU6YD75t4FXNRqJnIYoWtG2y 7r9cUjeZY3JsCft5/M/AauJ+83fRGWuNTm7duyDDjY8OsKNliH4vEGT11aF6uysTgs2f CdsZA6ayLSxj3pE5Bkr5vkWvhF++m2rGc4gwYQHTfGCBobauOIqKau9EyqP3ZqfhaDco E7Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@amazon.de header.s=amazon201209 header.b=K+tUP34v; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a0566022e8700b00657d0ceb0f6si10280284iow.36.2022.05.10.08.21.55; Tue, 10 May 2022 08:22:10 -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=fail header.i=@amazon.de header.s=amazon201209 header.b=K+tUP34v; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243370AbiEJORG (ORCPT + 99 others); Tue, 10 May 2022 10:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244698AbiEJNq5 (ORCPT ); Tue, 10 May 2022 09:46:57 -0400 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC5517706D; Tue, 10 May 2022 06:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1652189516; x=1683725516; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZcFtI8jvSLQdq7u3zXtig0/LPNcCJ80T1zsBtiZt0Y0=; b=K+tUP34vPsG3N6BK0C+FFM6UBOrmmYm06dbTjSE4cb5ASqduYARNxGLZ SEtWg11aB1W+gPIxo15jWYcDVTxHz69rgUCpoOSviLnOpkY8dFGRXjBtz qiYbDUETZ4cGriXgyo6WkvfG8FHIuqA8djhnbCAjzXXwCsSTdpBLLqwR+ A=; X-IronPort-AV: E=Sophos;i="5.91,214,1647302400"; d="scan'208";a="200152145" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-iad-1e-90d70b14.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP; 10 May 2022 13:31:31 +0000 Received: from EX13D08EUB003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1e-90d70b14.us-east-1.amazon.com (Postfix) with ESMTPS id 14F59C08D3; Tue, 10 May 2022 13:31:23 +0000 (UTC) Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D08EUB003.ant.amazon.com (10.43.166.117) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 10 May 2022 13:31:03 +0000 Received: from dev-dsk-mheyne-1b-c1524648.eu-west-1.amazon.com (10.15.60.66) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.32 via Frontend Transport; Tue, 10 May 2022 13:31:02 +0000 Received: by dev-dsk-mheyne-1b-c1524648.eu-west-1.amazon.com (Postfix, from userid 5466572) id 3590B41131; Tue, 10 May 2022 13:31:02 +0000 (UTC) From: Maximilian Heyne CC: Maximilian Heyne , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Josh Poimboeuf , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Masami Hiramatsu , Sasha Levin , , , Subject: [PATCH 0/4] x86: decode Xen/KVM emulate prefixes Date: Tue, 10 May 2022 13:30:29 +0000 Message-ID: <20220510133036.46767-1-mheyne@amazon.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a backport of a patch series for 5.4.x. The patch series allows the x86 decoder to decode the Xen and KVM emulate prefixes. In particular this solves the following issue that appeared when commit db6c6a0df840 ("objtool: Fix noreturn detection for ignored functions") was backported to 5.4.69: arch/x86/xen/enlighten_pv.o: warning: objtool: xen_cpuid()+0x25: can't find jump dest instruction at .text+0x9c Also now that this decoding is possible, also backport the commit which prevents kprobes on probing such prefixed instructions. This was also part of the original series. The series applied mostly cleanly on 5.4.192 except for a contextual problem in the 3rd patch ("x86: xen: insn: Decode Xen and KVM emulate-prefix signature"). Masami Hiramatsu (4): x86/asm: Allow to pass macros to __ASM_FORM() x86: xen: kvm: Gather the definition of emulate prefixes x86: xen: insn: Decode Xen and KVM emulate-prefix signature x86: kprobes: Prohibit probing on instruction which has emulate prefix arch/x86/include/asm/asm.h | 8 +++-- arch/x86/include/asm/emulate_prefix.h | 14 +++++++++ arch/x86/include/asm/insn.h | 6 ++++ arch/x86/include/asm/xen/interface.h | 11 +++---- arch/x86/kernel/kprobes/core.c | 4 +++ arch/x86/kvm/x86.c | 4 ++- arch/x86/lib/insn.c | 34 +++++++++++++++++++++ tools/arch/x86/include/asm/emulate_prefix.h | 14 +++++++++ tools/arch/x86/include/asm/insn.h | 6 ++++ tools/arch/x86/lib/insn.c | 34 +++++++++++++++++++++ tools/objtool/sync-check.sh | 3 +- tools/perf/check-headers.sh | 3 +- 12 files changed, 128 insertions(+), 13 deletions(-) create mode 100644 arch/x86/include/asm/emulate_prefix.h create mode 100644 tools/arch/x86/include/asm/emulate_prefix.h base-commit: 1d72b776f6dc973211f5d153453cf8955fb3d70a -- 2.32.0 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879