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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 58190C433E0 for ; Thu, 18 Jun 2020 23:52:59 +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 30255207D8 for ; Thu, 18 Jun 2020 23:52:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30255207D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cert.pl Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jm4Ka-0002sA-EN; Thu, 18 Jun 2020 23:52:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jm4KZ-0002s5-Gv for xen-devel@lists.xenproject.org; Thu, 18 Jun 2020 23:52:27 +0000 X-Inumbo-ID: c2c31594-b1be-11ea-bb8b-bc764e2007e4 Received: from bagnar.nask.net.pl (unknown [195.187.242.196]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c2c31594-b1be-11ea-bb8b-bc764e2007e4; Thu, 18 Jun 2020 23:52:26 +0000 (UTC) Received: from bagnar.nask.net.pl (unknown [172.16.9.10]) by bagnar.nask.net.pl (Postfix) with ESMTP id 47E1AA3131; Fri, 19 Jun 2020 01:52:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id 2EE21A312D; Fri, 19 Jun 2020 01:52:24 +0200 (CEST) Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DR3LhTfkcpdE; Fri, 19 Jun 2020 01:52:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id B18F2A3131; Fri, 19 Jun 2020 01:52:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at bagnar.nask.net.pl Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TCKmSYjHPzGH; Fri, 19 Jun 2020 01:52:22 +0200 (CEST) Received: from belindir.nask.net.pl (belindir-ext.nask.net.pl [195.187.242.210]) by bagnar.nask.net.pl (Postfix) with ESMTP id 8D449A312D; Fri, 19 Jun 2020 01:52:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 7A01D2059A; Fri, 19 Jun 2020 01:51:52 +0200 (CEST) Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id dUW_3J0fmgSG; Fri, 19 Jun 2020 01:51:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id D49EF215FA; Fri, 19 Jun 2020 01:51:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at belindir.nask.net.pl Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iiAAqbqYF5FN; Fri, 19 Jun 2020 01:51:46 +0200 (CEST) Received: from belindir.nask.net.pl (belindir.nask.net.pl [172.16.10.10]) by belindir.nask.net.pl (Postfix) with ESMTP id A22402059A; Fri, 19 Jun 2020 01:51:46 +0200 (CEST) Date: Fri, 19 Jun 2020 01:51:46 +0200 (CEST) From: =?utf-8?Q?Micha=C5=82_Leszczy=C5=84ski?= To: Xen-devel Message-ID: <782191628.9821033.1592524306516.JavaMail.zimbra@cert.pl> In-Reply-To: <122238637.9820857.1592523264685.JavaMail.zimbra@cert.pl> References: <122238637.9820857.1592523264685.JavaMail.zimbra@cert.pl> Subject: Re: [PATCH v2 0/7] Implement support for external IPT monitoring MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.16.10.10] X-Mailer: Zimbra 8.6.0_GA_1194 (ZimbraWebClient - GC83 (Win)/8.6.0_GA_1194) Thread-Topic: Implement support for external IPT monitoring Thread-Index: hSzh8Vr462omVBiCuz/GiNtdRkOdyINWwTy9 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Stefano Stabellini , Julien Grall , Jan Beulich , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , Jun Nakajima , Tamas K Lengyel , Anthony PERARD , "Kang, Luwei" , Roger Pau =?utf-8?Q?Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" ----- 19 cze 2020 o 1:34, Micha=C5=82 Leszczy=C5=84ski michal.leszczynski@c= ert.pl napisa=C5=82(a): > Intel Processor Trace is an architectural extension available in modern I= ntel > family CPUs. It allows recording the detailed trace of activity while the > processor executes the code. One might use the recorded trace to reconstr= uct > the code flow. It means, to find out the executed code paths, determine > branches taken, and so forth. >=20 > The abovementioned feature is described in Intel(R) 64 and IA-32 Architec= tures > Software Developer's Manual Volume 3C: System Programming Guide, Part 3, > Chapter 36: "Intel Processor Trace." >=20 > This patch series implements an interface that Dom0 could use in order to > enable IPT for particular vCPUs in DomU, allowing for external monitoring= . Such > a feature has numerous applications like malware monitoring, fuzzing, or > performance testing. >=20 > Also thanks to Tamas K Lengyel for a few preliminary hints before > first version of this patch was submitted to xen-devel. >=20 > Changed since v1: > * MSR_RTIT_CTL is managed using MSR load lists > * other PT-related MSRs are modified only when vCPU goes out of context > * trace buffer is now acquired as a resource > * added vmtrace_pt_size parameter in xl.cfg, the size of trace buffer > must be specified in the moment of domain creation > * trace buffers are allocated on domain creation, destructed on > domain destruction > * HVMOP_vmtrace_ipt_enable/disable is limited to enabling/disabling PT > these calls don't manage buffer memory anymore > * lifted 32 MFN/GFN array limit when acquiring resources > * minor code style changes according to review >=20 > Michal Leszczynski (7): > xen/mm: lift 32 item limit from mfn/gfn arrays > x86/vmx: add Intel PT MSR definitions > x86/vmx: add IPT cpu feature > x86/vmx: add do_vmtrace_op > tools/libxc: add xc_vmtrace_* functions > tools/libxl: add vmtrace_pt_size parameter > tools/proctrace: add proctrace tool >=20 > tools/golang/xenlight/helpers.gen.go | 2 + > tools/golang/xenlight/types.gen.go | 1 + > tools/libxc/Makefile | 1 + > tools/libxc/include/xenctrl.h | 39 +++ > tools/libxc/xc_vmtrace.c | 97 ++++++ > tools/libxl/libxl_types.idl | 2 + > tools/libxl/libxl_x86.c | 5 + > tools/proctrace/COPYING | 339 ++++++++++++++++++++ > tools/proctrace/Makefile | 50 +++ > tools/proctrace/proctrace.c | 153 +++++++++ > tools/xl/xl_parse.c | 4 + > xen/arch/x86/hvm/hvm.c | 167 ++++++++++ > xen/arch/x86/hvm/vmx/vmcs.c | 4 + > xen/arch/x86/hvm/vmx/vmx.c | 24 ++ > xen/arch/x86/mm.c | 37 +++ > xen/common/domain.c | 1 + > xen/common/memory.c | 39 +-- > xen/include/asm-x86/cpufeature.h | 1 + > xen/include/asm-x86/hvm/hvm.h | 9 + > xen/include/asm-x86/hvm/vmx/vmcs.h | 17 + > xen/include/asm-x86/msr-index.h | 37 +++ > xen/include/public/arch-x86/cpufeatureset.h | 1 + > xen/include/public/hvm/hvm_op.h | 23 ++ > xen/include/public/hvm/params.h | 5 +- > xen/include/public/memory.h | 1 + > xen/include/xen/sched.h | 3 + > 26 files changed, 1039 insertions(+), 23 deletions(-) > create mode 100644 tools/libxc/xc_vmtrace.c > create mode 100644 tools/proctrace/COPYING > create mode 100644 tools/proctrace/Makefile > create mode 100644 tools/proctrace/proctrace.c >=20 > -- > 2.20.1 Thanks for all comments related to v1. I did my best to address all of them= and thus almost all code was altered. Due to that, I've decided to post the nex= t version at this stage.