From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74271C43331 for ; Fri, 6 Sep 2019 13:14:39 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 47F91206BB for ; Fri, 6 Sep 2019 13:14:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="NZs4T0sE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47F91206BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i6E3d-0000mo-5L; Fri, 06 Sep 2019 13:13:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i6E3c-0000mg-H8 for xen-devel@lists.xenproject.org; Fri, 06 Sep 2019 13:13:44 +0000 X-Inumbo-ID: 26e08b0e-d0a8-11e9-abf5-12813bfff9fa Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 26e08b0e-d0a8-11e9-abf5-12813bfff9fa; Fri, 06 Sep 2019 13:13:44 +0000 (UTC) Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAE95206BB; Fri, 6 Sep 2019 13:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567775623; bh=04VMkFAKwpuBxhJdJIYLigr+4AaTxM1JYsTMgdArZEQ=; h=From:To:Cc:Subject:Date:From; b=NZs4T0sE2RnKQkKahhNeB4+KuDgjS8z/UykH4cTyaD0PQ1MVUOymSG9DaLaHzbaKY 6hhhzFGTqnZwNtCbZHUxgK+Lh3U8tnuxEfjT/3cQB9ZckHnj9qxw+JndI+b/pa4dIP BBsBWpVCwCnvjEqMcpu5Iq/W4HK+wvoDI7ZKxXZw= From: Masami Hiramatsu To: Ingo Molnar Date: Fri, 6 Sep 2019 22:13:37 +0900 Message-Id: <156777561745.25081.1205321122446165328.stgit@devnote2> X-Mailer: git-send-email 2.20.1 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Xen-devel] [PATCH -tip v4 0/4] x86: kprobes: Prohibit kprobes on Xen/KVM emulate prefixes X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Peter Zijlstra , Andrew Cooper , Randy Dunlap , x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , Josh Poimboeuf , xen-devel@lists.xenproject.org, Boris Ostrovsky Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" SGksCgpIZXJlIGlzIHRoZSA0dGggdmVyc2lvbiBvZiBw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byBwYXNzIG1hY3JvcyB0byBfX0FTTV9GT1JNKCkKICAg ICAgeDg2OiB4ZW46IGt2bTogR2F0aGVyIHRoZSBkZWZpbml0aW9uIG9mIGVtdWxhdGUgcHJlZml4 ZXMKICAgICAgeDg2OiB4ZW46IGluc246IERlY29kZSBYZW4gYW5kIEtWTSBlbXVsYXRlLXByZWZp eCBzaWduYXR1cmUKICAgICAgeDg2OiBrcHJvYmVzOiBQcm9oaWJpdCBwcm9iaW5nIG9uIGluc3Ry dWN0aW9uIHdoaWNoIGhhcyBlbXVsYXRlIHByZWZpeAoKCiBhcmNoL3g4Ni9pbmNsdWRlL2FzbS9h c20uaCAgICAgICAgICAgICAgICAgIHwgICAgOCArKysrLS0KIGFyY2gveDg2L2luY2x1ZGUvYXNt L2VtdWxhdGVfcHJlZml4LmggICAgICAgfCAgIDE0ICsrKysrKysrKysrCiBhcmNoL3g4Ni9pbmNs dWRlL2FzbS9pbnNuLmggICAgICAgICAgICAgICAgIHwgICAgNiArKysrKwogYXJjaC94ODYvaW5j bHVkZS9hc20veGVuL2ludGVyZmFjZS5oICAgICAgICB8ICAgMTEgKysrLS0tLS0tCiBhcmNoL3g4 Ni9rZXJuZWwva3Byb2Jlcy9jb3JlLmMgICAgICAgICAgICAgIHwgICAgNCArKysKIGFyY2gveDg2 L2t2bS94ODYuYyAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICA0ICsrLQogYXJjaC94ODYv bGliL2luc24uYyAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgMzQgKysrKysrKysrKysrKysr KysrKysrKysrKysrCiB0b29scy9hcmNoL3g4Ni9pbmNsdWRlL2FzbS9lbXVsYXRlX3ByZWZpeC5o IHwgICAxNCArKysrKysrKysrKwogdG9vbHMvYXJjaC94ODYvaW5jbHVkZS9hc20vaW5zbi5oICAg ICAgICAgICB8ICAgIDYgKysrKysKIHRvb2xzL2FyY2gveDg2L2xpYi9pbnNuLmMgICAgICAgICAg ICAgICAgICAgfCAgIDM0ICsrKysrKysrKysrKysrKysrKysrKysrKysrKwogdG9vbHMvb2JqdG9v bC9zeW5jLWNoZWNrLnNoICAgICAgICAgICAgICAgICB8ICAgIDMgKysKIHRvb2xzL3BlcmYvY2hl Y2staGVhZGVycy5zaCAgICAgICAgICAgICAgICAgfCAgICAzICsrCiAxMiBmaWxlcyBjaGFuZ2Vk LCAxMjggaW5zZXJ0aW9ucygrKSwgMTMgZGVsZXRpb25zKC0pCiBjcmVhdGUgbW9kZSAxMDA2NDQg YXJjaC94ODYvaW5jbHVkZS9hc20vZW11bGF0ZV9wcmVmaXguaAogY3JlYXRlIG1vZGUgMTAwNjQ0 IHRvb2xzL2FyY2gveDg2L2luY2x1ZGUvYXNtL2VtdWxhdGVfcHJlZml4LmgKCi0tCk1hc2FtaSBI aXJhbWF0c3UgKExpbmFybykgPG1oaXJhbWF0QGtlcm5lbC5vcmc+CgpfX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpYZW4tZGV2ZWwgbWFpbGluZyBsaXN0Clhl bi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZwpodHRwczovL2xpc3RzLnhlbnByb2plY3Qub3Jn L21haWxtYW4vbGlzdGluZm8veGVuLWRldmVs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37C4DC43331 for ; Fri, 6 Sep 2019 13:13:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0EF442173B for ; Fri, 6 Sep 2019 13:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567775625; bh=04VMkFAKwpuBxhJdJIYLigr+4AaTxM1JYsTMgdArZEQ=; h=From:To:Cc:Subject:Date:List-ID:From; b=hTsx4k2bEAWyKkUTVreDSSAJEFwW14S8y38HDiy5B7/FjkCS6c1uoyByuJu2PHQHP W7ayXreV61KzHRgNMHzCaREh6JTw3i1QASPV3X9bOxVR2JeQOphyswu2LTJpFi6oHb u84W5OO3r7C7gUUL86d40KJcsL5599F/9CH5ymI4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392974AbfIFNNo (ORCPT ); Fri, 6 Sep 2019 09:13:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:34978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389197AbfIFNNo (ORCPT ); Fri, 6 Sep 2019 09:13:44 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAE95206BB; Fri, 6 Sep 2019 13:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567775623; bh=04VMkFAKwpuBxhJdJIYLigr+4AaTxM1JYsTMgdArZEQ=; h=From:To:Cc:Subject:Date:From; b=NZs4T0sE2RnKQkKahhNeB4+KuDgjS8z/UykH4cTyaD0PQ1MVUOymSG9DaLaHzbaKY 6hhhzFGTqnZwNtCbZHUxgK+Lh3U8tnuxEfjT/3cQB9ZckHnj9qxw+JndI+b/pa4dIP BBsBWpVCwCnvjEqMcpu5Iq/W4HK+wvoDI7ZKxXZw= From: Masami Hiramatsu To: Ingo Molnar Cc: Josh Poimboeuf , Andrew Cooper , Peter Zijlstra , Randy Dunlap , Borislav Petkov , Juergen Gross , Boris Ostrovsky , Stefano Stabellini , x86@kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH -tip v4 0/4] x86: kprobes: Prohibit kprobes on Xen/KVM emulate prefixes Date: Fri, 6 Sep 2019 22:13:37 +0900 Message-Id: <156777561745.25081.1205321122446165328.stgit@devnote2> X-Mailer: git-send-email 2.20.1 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Here is the 4th version of patches to handle Xen/KVM emulate prefix by x86 instruction decoder. These patches allow x86 instruction decoder to decode Xen and KVM emulate prefix correctly, and prohibit kprobes to probe on it. Previous version is here; https://lkml.kernel.org/r/156773433821.31441.2905951246664148487.stgit@devnote2 In this version, I added 2 patches, [1/4] fixes __ASM_FORM() to accept macros using __stringify(), [2/4] introduces new asm/emulate_prefix.h to initialize Xen and KVM emulate prefix at one place. [3/4] is updated to use new emulate_prefix.h and fix to add emulate_prefix.h to sync check list. This series can be applied on -tip master branch which has merged Josh's objtool/perf sharing common x86 insn decoder series. Thank you, --- 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 -- Masami Hiramatsu (Linaro)