From patchwork Fri Sep 6 00:50:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11134161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A259614B4 for ; Fri, 6 Sep 2019 00:52:11 +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 5AB03207E0 for ; Fri, 6 Sep 2019 00:52:11 +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="UN6gjf5i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AB03207E0 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 1i62S8-0005aR-Mc; Fri, 06 Sep 2019 00:50:16 +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 1i62S7-0005aM-47 for xen-devel@lists.xenproject.org; Fri, 06 Sep 2019 00:50:15 +0000 X-Inumbo-ID: 4984e406-d040-11e9-abe4-12813bfff9fa Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4984e406-d040-11e9-abe4-12813bfff9fa; Fri, 06 Sep 2019 00:50:14 +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 2CD03207E0; Fri, 6 Sep 2019 00:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567731013; bh=PY5drBH1zWFrEYPfV+oCstIfCDYlYiPcrbXnEC2lJxo=; h=From:To:Cc:Subject:Date:From; b=UN6gjf5ihOZgtK7TP0AEgYjcs0dZJPYgRgyWrlrq4aqte2Q0Re3LmWWPDTaZJwewp Ciub5a0ZNGXdFzuRjZtkIXZwOvefGoGg5TPHJNeJ+PMRiQyP1bpfsVhjfcc/Xa2CjR RCoj5W4/H+z6B3Zm45v/vvaQXjM0t3RERJm9joFY= From: Masami Hiramatsu To: Ingo Molnar Date: Fri, 6 Sep 2019 09:50:08 +0900 Message-Id: <156773100816.29031.12557431294039450779.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 v2 0/2] 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 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hi, Here is the 2nd 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. Josh reported that the objtool can not decode such special prefixed instructions, and I found that we also have to prohibit kprobes to probe on such instruction. This series can be applied on -tip master branch which has merged Josh's objtool/perf sharing common x86 insn decoder series. In this version, I added KVM emulate prefix support and generalized the interface. (insn_has_xen_prefix -> insn_has_emulate_prefix) Also, I added insn.emulate_prefix_size for those prefixes because that prefix is NOT an x86 instruction prefix, and the next instruction of those emulate prefixes can have x86 instruction prefix. So we can not use insn.prefix for it. Thank you, --- Masami Hiramatsu (2): x86: xen: insn: Decode Xen and KVM emulate-prefix signature x86: kprobes: Prohibit probing on instruction which has emulate prefix arch/x86/include/asm/insn.h | 6 +++++ arch/x86/include/asm/xen/interface.h | 7 ++++-- arch/x86/include/asm/xen/prefix.h | 10 +++++++++ arch/x86/kernel/kprobes/core.c | 4 +++ arch/x86/lib/insn.c | 36 +++++++++++++++++++++++++++++++ tools/arch/x86/include/asm/insn.h | 6 +++++ tools/arch/x86/include/asm/xen/prefix.h | 10 +++++++++ tools/arch/x86/lib/insn.c | 36 +++++++++++++++++++++++++++++++ tools/objtool/sync-check.sh | 3 ++- 9 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 arch/x86/include/asm/xen/prefix.h create mode 100644 tools/arch/x86/include/asm/xen/prefix.h -- Masami Hiramatsu (Linaro)