xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/10] Implement support for external IPT monitoring
@ 2020-06-30 12:33 Michał Leszczyński
  2020-06-30 12:33 ` [PATCH v4 01/10] x86/vmx: add Intel PT MSR definitions Michał Leszczyński
                   ` (10 more replies)
  0 siblings, 11 replies; 75+ messages in thread
From: Michał Leszczyński @ 2020-06-30 12:33 UTC (permalink / raw)
  To: xen-devel
  Cc: Julien Grall, Kevin Tian, Stefano Stabellini, tamas.lengyel,
	Jun Nakajima, Wei Liu, Andrew Cooper, Michal Leszczynski,
	Ian Jackson, George Dunlap, Jan Beulich, Anthony PERARD,
	luwei.kang, Roger Pau Monné

From: Michal Leszczynski <michal.leszczynski@cert.pl>

Intel Processor Trace is an architectural extension available in modern Intel 
family CPUs. It allows recording the detailed trace of activity while the 
processor executes the code. One might use the recorded trace to reconstruct 
the code flow. It means, to find out the executed code paths, determine 
branches taken, and so forth.

The abovementioned feature is described in Intel(R) 64 and IA-32 Architectures 
Software Developer's Manual Volume 3C: System Programming Guide, Part 3, 
Chapter 36: "Intel Processor Trace."

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.

Also thanks to Tamas K Lengyel for a few preliminary hints before
first version of this patch was submitted to xen-devel.

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

Changed since v2:
  * trace buffer is now allocated on domain creation (in v2 it was
    allocated when hvm param was set)
  * restored 32-item limit in mfn/gfn arrays in acquire_resource
    and instead implemented hypercall continuations
  * code changes according to Jan's and Roger's review

Changed since v3:
  * vmtrace HVMOPs are not implemented as DOMCTLs
  * patches splitted up according to Andrew's comments
  * code changes according to v3 review on the mailing list


Michal Leszczynski (10):
  x86/vmx: add Intel PT MSR definitions
  x86/vmx: add IPT cpu feature
  tools/libxl: add vmtrace_pt_size parameter
  x86/vmx: implement processor tracing for VMX
  common/domain: allocate vmtrace_pt_buffer
  memory: batch processing in acquire_resource()
  x86/mm: add vmtrace_buf resource type
  x86/domctl: add XEN_DOMCTL_vmtrace_op
  tools/libxc: add xc_vmtrace_* functions
  tools/proctrace: add proctrace tool

 docs/man/xl.cfg.5.pod.in                    |  10 +
 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                    |  73 +++++
 tools/libxl/libxl.h                         |   8 +
 tools/libxl/libxl_create.c                  |   1 +
 tools/libxl/libxl_types.idl                 |   2 +
 tools/proctrace/COPYING                     | 339 ++++++++++++++++++++
 tools/proctrace/Makefile                    |  48 +++
 tools/proctrace/proctrace.c                 | 163 ++++++++++
 tools/xl/xl_parse.c                         |  20 ++
 xen/arch/x86/domain.c                       |  11 +
 xen/arch/x86/domctl.c                       |  48 +++
 xen/arch/x86/hvm/vmx/vmcs.c                 |   7 +-
 xen/arch/x86/hvm/vmx/vmx.c                  |  89 +++++
 xen/arch/x86/mm.c                           |  25 ++
 xen/common/domain.c                         |  46 +++
 xen/common/memory.c                         |  32 +-
 xen/include/asm-x86/cpufeature.h            |   1 +
 xen/include/asm-x86/domain.h                |   4 +
 xen/include/asm-x86/hvm/hvm.h               |  38 +++
 xen/include/asm-x86/hvm/vmx/vmcs.h          |   4 +
 xen/include/asm-x86/hvm/vmx/vmx.h           |  14 +
 xen/include/asm-x86/msr-index.h             |  37 +++
 xen/include/public/arch-x86/cpufeatureset.h |   1 +
 xen/include/public/domctl.h                 |  27 ++
 xen/include/public/memory.h                 |   1 +
 xen/include/xen/domain.h                    |   2 +
 xen/include/xen/sched.h                     |   4 +
 31 files changed, 1094 insertions(+), 4 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

-- 
2.20.1



^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2020-07-21 10:53 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 12:33 [PATCH v4 00/10] Implement support for external IPT monitoring Michał Leszczyński
2020-06-30 12:33 ` [PATCH v4 01/10] x86/vmx: add Intel PT MSR definitions Michał Leszczyński
2020-06-30 16:23   ` Jan Beulich
2020-06-30 17:37   ` Andrew Cooper
2020-06-30 18:03     ` Tamas K Lengyel
2020-06-30 18:27       ` Michał Leszczyński
2020-07-01 17:52   ` Andrew Cooper
2020-06-30 12:33 ` [PATCH v4 02/10] x86/vmx: add IPT cpu feature Michał Leszczyński
2020-07-01  9:49   ` Roger Pau Monné
2020-07-01 15:12   ` Julien Grall
2020-07-01 16:06     ` Andrew Cooper
2020-07-01 16:17       ` Julien Grall
2020-07-01 16:18         ` Julien Grall
2020-07-01 17:26           ` Andrew Cooper
2020-07-01 18:02             ` Julien Grall
2020-07-01 18:06               ` Andrew Cooper
2020-07-01 18:09                 ` Julien Grall
2020-07-02  8:29                   ` Jan Beulich
2020-07-02  8:42                     ` Julien Grall
2020-07-02  8:50                       ` Jan Beulich
2020-07-02  8:54                         ` Julien Grall
2020-07-02  9:18                           ` Jan Beulich
2020-07-02  9:57                             ` Julien Grall
2020-07-02 13:30                               ` Jan Beulich
2020-07-02 14:14                                 ` Julien Grall
2020-07-02 14:17                                   ` Jan Beulich
2020-07-02 14:31                                     ` Julien Grall
2020-07-02 20:28                                       ` Michał Leszczyński
2020-07-03  7:58                                         ` Julien Grall
2020-07-04 19:16                                           ` Michał Leszczyński
2020-07-01 21:42   ` Andrew Cooper
2020-07-02  8:10     ` Roger Pau Monné
2020-07-02  8:34       ` Jan Beulich
2020-07-02 20:29         ` Michał Leszczyński
2020-06-30 12:33 ` [PATCH v4 03/10] tools/libxl: add vmtrace_pt_size parameter Michał Leszczyński
2020-07-01 10:05   ` Roger Pau Monné
2020-07-02  9:00   ` Roger Pau Monné
2020-07-02 16:23     ` Michał Leszczyński
2020-07-03  9:44       ` Roger Pau Monné
2020-07-03  9:56         ` Jan Beulich
2020-07-03 10:11           ` Roger Pau Monné
2020-07-04 17:23             ` Julien Grall
2020-07-06  8:46               ` Jan Beulich
2020-07-07  8:44                 ` Julien Grall
2020-07-07  9:10                   ` Jan Beulich
2020-07-07  9:16                     ` Julien Grall
2020-07-07 11:17                       ` Michał Leszczyński
2020-07-07 11:21                         ` Jan Beulich
2020-07-07 11:35                           ` Michał Leszczyński
2020-07-02 10:24   ` Anthony PERARD
2020-07-04 17:48   ` Julien Grall
2020-06-30 12:33 ` [PATCH v4 04/10] x86/vmx: implement processor tracing for VMX Michał Leszczyński
2020-07-01 10:30   ` Roger Pau Monné
2020-06-30 12:33 ` [PATCH v4 05/10] common/domain: allocate vmtrace_pt_buffer Michał Leszczyński
2020-07-01 10:38   ` Roger Pau Monné
2020-07-01 15:35   ` Julien Grall
2020-06-30 12:33 ` [PATCH v4 06/10] memory: batch processing in acquire_resource() Michał Leszczyński
2020-07-01 10:46   ` Roger Pau Monné
2020-07-03 10:35   ` Julien Grall
2020-07-03 10:52     ` Paul Durrant
2020-07-03 11:17       ` Julien Grall
2020-07-03 11:22         ` Jan Beulich
2020-07-03 11:36           ` Julien Grall
2020-07-03 12:50             ` Jan Beulich
2020-07-03 11:40         ` Paul Durrant
2020-06-30 12:33 ` [PATCH v4 07/10] x86/mm: add vmtrace_buf resource type Michał Leszczyński
2020-07-01 10:52   ` Roger Pau Monné
2020-06-30 12:33 ` [PATCH v4 08/10] x86/domctl: add XEN_DOMCTL_vmtrace_op Michał Leszczyński
2020-07-01 11:00   ` Roger Pau Monné
2020-06-30 12:33 ` [PATCH v4 09/10] tools/libxc: add xc_vmtrace_* functions Michał Leszczyński
2020-07-21 10:52   ` Wei Liu
2020-06-30 12:33 ` [PATCH v4 10/10] tools/proctrace: add proctrace tool Michał Leszczyński
2020-07-02 15:10   ` Andrew Cooper
2020-07-21 10:52     ` Wei Liu
2020-06-30 12:48 ` [PATCH v4 00/10] Implement support for external IPT monitoring Hubert Jasudowicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).