Re: [RFC PATCH 00/27] vDPA software assisted live migration

2020-11-25 Thread Jason Wang
On 2020/11/25 下午8:03, Eugenio Perez Martin wrote: On Wed, Nov 25, 2020 at 8:09 AM Jason Wang wrote: On 2020/11/21 上午2:50, Eugenio Pérez wrote: This series enable vDPA software assisted live migration for vhost-net devices. This is a new method of vhost devices migration: Instead of relay on

Re: [PATCH v4] i2c: virtio: add a virtio i2c frontend driver

2020-11-25 Thread Jie Deng
On 2020/11/25 17:35, Michael S. Tsirkin wrote: On Mon, Oct 12, 2020 at 09:55:55AM +0800, Jie Deng wrote: Add an I2C bus driver for virtio para-virtualization. The controller can be emulated by the backend driver in any device model software by following the virtio protocol. This driver

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Nick Desaulniers via Virtualization
On Wed, Nov 25, 2020 at 8:24 AM Jakub Kicinski wrote: > > Applying a real patch set and then getting a few follow ups the next day > for trivial coding things like fallthrough missing or static missing, > just because I didn't have the full range of compilers to check with > before applying makes

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Nick Desaulniers via Virtualization
On Wed, Nov 25, 2020 at 1:33 PM Finn Thain wrote: > > Or do you think that a codebase can somehow satisfy multiple checkers and > their divergent interpretations of the language spec? Have we found any cases yet that are divergent? I don't think so. It sounds to me like GCC's cases it warns for

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Kees Cook
On Tue, Nov 24, 2020 at 11:05:35PM -0800, James Bottomley wrote: > Now, what we have seems to be about 6 cases (at least what's been shown > in this thread) where a missing break would cause potentially user > visible issues. That means the value of this isn't zero, but it's not > a no-brainer

Re: [PATCH v3] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-25 Thread si-wei liu
On 11/25/2020 1:30 AM, Michael S. Tsirkin wrote: On Thu, Nov 05, 2020 at 06:26:33PM -0500, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping

Re: [PATCH AUTOSEL 5.9 22/33] vhost scsi: add lun parser helper

2020-11-25 Thread Paolo Bonzini
On 25/11/20 19:01, Sasha Levin wrote: On Wed, Nov 25, 2020 at 06:48:21PM +0100, Paolo Bonzini wrote: On 25/11/20 16:35, Sasha Levin wrote: From: Mike Christie [ Upstream commit 18f1becb6948cd411fd01968a0a54af63732e73c ] Move code to parse lun from req's lun_buf to helper, so tmf code can

Re: [PATCH AUTOSEL 5.9 22/33] vhost scsi: add lun parser helper

2020-11-25 Thread Sasha Levin
On Wed, Nov 25, 2020 at 06:48:21PM +0100, Paolo Bonzini wrote: On 25/11/20 16:35, Sasha Levin wrote: From: Mike Christie [ Upstream commit 18f1becb6948cd411fd01968a0a54af63732e73c ] Move code to parse lun from req's lun_buf to helper, so tmf code can use it in the next patch. Signed-off-by:

Re: [PATCH AUTOSEL 5.9 22/33] vhost scsi: add lun parser helper

2020-11-25 Thread Paolo Bonzini
On 25/11/20 16:35, Sasha Levin wrote: From: Mike Christie [ Upstream commit 18f1becb6948cd411fd01968a0a54af63732e73c ] Move code to parse lun from req's lun_buf to helper, so tmf code can use it in the next patch. Signed-off-by: Mike Christie Reviewed-by: Paolo Bonzini Acked-by: Jason Wang

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Miguel Ojeda
On Wed, Nov 25, 2020 at 5:24 PM Jakub Kicinski wrote: > > And just to spell it out, > > case ENUM_VALUE1: > bla(); > break; > case ENUM_VALUE2: > bla(); > default: > break; > > is a fairly idiomatic way of indicating that not all values of the enum > are expected

Re: [PATCH v10 32/81] KVM: introduce VM introspection

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Yet something to improve: [auto build test ERROR on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e config:

Re: [PATCH v10 79/81] KVM: introspection: add KVMI_VCPU_TRANSLATE_GVA

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

[PATCH AUTOSEL 5.4 17/23] vhost scsi: Add support for LUN resets.

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit efd838fec17bd8756da852a435800a7e6281bfbc ] In newer versions of virtio-scsi we just reset the timer when an a command times out, so TMFs are never sent for the cmd time out case. However, in older kernels and for the TMF inject cases, we can still get

[PATCH AUTOSEL 5.4 15/23] vhost scsi: fix cmd completion race

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit 47a3565e8bb14ec48a75b48daf57aa830e2691f8 ] We might not do the final se_cmd put from vhost_scsi_complete_cmd_work. When the last put happens a little later then we could race where vhost_scsi_complete_cmd_work does vhost_signal, the guest runs and sends

[PATCH AUTOSEL 5.4 16/23] vhost scsi: add lun parser helper

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit 18f1becb6948cd411fd01968a0a54af63732e73c ] Move code to parse lun from req's lun_buf to helper, so tmf code can use it in the next patch. Signed-off-by: Mike Christie Reviewed-by: Paolo Bonzini Acked-by: Jason Wang Link:

[PATCH AUTOSEL 5.9 22/33] vhost scsi: add lun parser helper

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit 18f1becb6948cd411fd01968a0a54af63732e73c ] Move code to parse lun from req's lun_buf to helper, so tmf code can use it in the next patch. Signed-off-by: Mike Christie Reviewed-by: Paolo Bonzini Acked-by: Jason Wang Link:

[PATCH AUTOSEL 5.9 23/33] vhost scsi: Add support for LUN resets.

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit efd838fec17bd8756da852a435800a7e6281bfbc ] In newer versions of virtio-scsi we just reset the timer when an a command times out, so TMFs are never sent for the cmd time out case. However, in older kernels and for the TMF inject cases, we can still get

[PATCH AUTOSEL 5.9 20/33] vhost scsi: alloc cmds per vq instead of session

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit 25b98b64e28423b0769313dcaf96423836b1f93d ] We currently are limited to 256 cmds per session. This leads to problems where if the user has increased virtqueue_size to more than 2 or cmd_per_lun to more than 256 vhost_scsi_get_tag can fail and the guest will

[PATCH AUTOSEL 5.9 21/33] vhost scsi: fix cmd completion race

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit 47a3565e8bb14ec48a75b48daf57aa830e2691f8 ] We might not do the final se_cmd put from vhost_scsi_complete_cmd_work. When the last put happens a little later then we could race where vhost_scsi_complete_cmd_work does vhost_signal, the guest runs and sends

[PATCH AUTOSEL 5.9 19/33] vhost: add helper to check if a vq has been setup

2020-11-25 Thread Sasha Levin
From: Mike Christie [ Upstream commit 6bcf34224ac1e94103797fd68b9836061762f2b2 ] This adds a helper check if a vq has been setup. The next patches will use this when we move the vhost scsi cmd preallocation from per session to per vq. In the per vq case, we only want to allocate cmds for vqs

[PATCH AUTOSEL 5.9 18/33] vdpasim: fix "mac_pton" undefined error

2020-11-25 Thread Sasha Levin
From: Laurent Vivier [ Upstream commit a312db697cb05dfa781848afe8585a1e1f2a5a99 ] ERROR: modpost: "mac_pton" [drivers/vdpa/vdpa_sim/vdpa_sim.ko] undefined! mac_pton() is defined in lib/net_utils.c and is not built if NET is not set. Select GENERIC_NET_UTILS as vdpasim doesn't depend on

Re: [PATCH v10 66/81] KVM: introspection: add KVMI_VCPU_GET_XCR

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Yet something to improve: [auto build test ERROR on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e config: x

Re: [PATCH v10 75/81] KVM: introspection: add KVMI_VCPU_EVENT_PF

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

Re: [PATCH 11/15] drm/radeon: Remove references to struct drm_device.pdev

2020-11-25 Thread Alex Deucher
On Tue, Nov 24, 2020 at 6:39 AM Thomas Zimmermann wrote: > > Using struct drm_device.pdev is deprecated. Convert radeon to struct > drm_device.dev. No functional changes. > > Signed-off-by: Thomas Zimmermann > Cc: Alex Deucher > Cc: Christian König There are a few unrelated whitespace

Re: [PATCH 01/15] drm/amdgpu: Remove references to struct drm_device.pdev

2020-11-25 Thread Alex Deucher
On Tue, Nov 24, 2020 at 6:38 AM Thomas Zimmermann wrote: > > Using struct drm_device.pdev is deprecated. Convert amdgpu to struct > drm_device.dev. No functional changes. > > Signed-off-by: Thomas Zimmermann > Cc: Alex Deucher > Cc: Christian König There are a few unrelated whitespace

Re: [PATCH v10 67/81] KVM: introspection: add KVMI_VCPU_GET_XSAVE

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

Re: [PATCH v10 32/81] KVM: introduce VM introspection

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Yet something to improve: [auto build test ERROR on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

[PATCH] virtio-input: add multi-touch support

2020-11-25 Thread Vasyl Vavrychuk
From: Mathias Crombez Without multi-touch slots allocated, ABS_MT_SLOT events will be lost by input_handle_abs_event. Signed-off-by: Mathias Crombez Signed-off-by: Vasyl Vavrychuk Tested-by: Vasyl Vavrychuk --- drivers/virtio/Kconfig| 11 +++ drivers/virtio/virtio_input.c |

Re: [PATCH v10 63/81] KVM: introspection: add KVMI_VCPU_INJECT_EXCEPTION + KVMI_VCPU_EVENT_TRAP

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

Re: [PATCH v10 32/81] KVM: introduce VM introspection

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Yet something to improve: [auto build test ERROR on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e config:

Re: [PATCH v10 25/81] KVM: x86: export kvm_vcpu_ioctl_x86_get_xsave()

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Nick Desaulniers via Virtualization
On Tue, Nov 24, 2020 at 11:05 PM James Bottomley wrote: > > On Tue, 2020-11-24 at 13:32 -0800, Kees Cook wrote: > > We already enable -Wimplicit-fallthrough globally, so that's not the > > discussion. The issue is that Clang is (correctly) even more strict > > than GCC for this, so these are the

Re: [PATCH v10 25/81] KVM: x86: export kvm_vcpu_ioctl_x86_get_xsave()

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

Re: [PATCH v10 33/81] KVM: introspection: add hook/unhook ioctls

2020-11-25 Thread kernel test robot
Hi "Adalbert, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on dc924b062488a0376aae41d3e0a27dc99f852a5e] url: https://github.com/0day-ci/linux/commits/Adalbert-Laz-r/VM-introspection/20201125-174530 base:dc924b062488a0376aae41d3e0a27dc99f852a5e c

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Andy Shevchenko
On Mon, Nov 23, 2020 at 10:39 PM James Bottomley wrote: > On Mon, 2020-11-23 at 19:56 +0100, Miguel Ojeda wrote: > > On Mon, Nov 23, 2020 at 4:58 PM James Bottomley > > wrote: ... > > But if we do the math, for an author, at even 1 minute per line > > change and assuming nothing can be

Re: [PATCH v3 16/17] x86/ioapic: export a few functions and data structures via io_apic.h

2020-11-25 Thread Andy Shevchenko
On Wed, Nov 25, 2020 at 1:46 AM Wei Liu wrote: > > We are about to implement an irqchip for IO-APIC when Linux runs as root > on Microsoft Hypervisor. At the same time we would like to reuse > existing code as much as possible. > > Move mp_chip_data to io_apic.h and make a few helper functions >

[PATCH v10 46/81] KVM: introspection: handle vCPU commands

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu Based on the common structure (kvmi_vcpu_hdr) used for all vCPU commands, the receiving thread validates and dispatches the message to the proper vCPU (adding the handling function to its jobs list). Signed-off-by: Mihai Donțu Co-developed-by: Nicușor Cîțu Signed-off-by:

[PATCH v10 40/81] KVM: introspection: add KVMI_VM_EVENT_UNHOOK

2020-11-25 Thread Adalbert Lazăr
This event is sent when the guest is about to be paused/suspended/migrated. The introspection tool has the chance to remove its hooks (e.g. breakpoints) while the guest is still running. Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 31 +

[PATCH v10 75/81] KVM: introspection: add KVMI_VCPU_EVENT_PF

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This event is sent when a #PF occurs due to a failed permission check in the shadow page tables, for a page in which the introspection tool has shown interest. Signed-off-by: Mihai Donțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr ---

[PATCH v10 64/81] KVM: introspection: add KVMI_VM_GET_MAX_GFN

2020-11-25 Thread Adalbert Lazăr
From: Ștefan Șicleru The introspection tool will use this command to get the memory address range for which it can set access restrictions. Signed-off-by: Ștefan Șicleru Co-developed-by: Nicușor Cîțu Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr ---

[PATCH v10 73/81] KVM: introspection: restore the state of MSR interception on unhook

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This commit also ensures that the introspection tool and the userspace do not disable each other the MSR access VM-exit. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvmi_host.h | 12 +++ arch/x86/kvm/kvmi.c | 124

[PATCH v10 69/81] KVM: introspection: add KVMI_VCPU_GET_MTRR_TYPE

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This command returns the memory type for a guest physical address. Signed-off-by: Mihai Donțu Co-developed-by: Nicușor Cîțu Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 32 +++

[PATCH v10 58/81] KVM: introspection: add cleanup support for vCPUs

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu On unhook the introspection channel is closed. This will signal the receiving thread to call kvmi_put() and exit. There might be vCPU threads handling introspection commands or waiting for event replies. These will also call kvmi_put() and re-enter in guest. Once the reference

[PATCH v10 33/81] KVM: introspection: add hook/unhook ioctls

2020-11-25 Thread Adalbert Lazăr
On hook, a new thread is created to handle the messages coming from the introspection tool (commands or event replies). The VM related commands are handled by this thread, while the vCPU commands and events replies are dispatched to the vCPU threads. On unhook, the socket is shut down, which will

[PATCH v10 26/81] KVM: x86: export kvm_vcpu_ioctl_x86_set_xsave()

2020-11-25 Thread Adalbert Lazăr
This function is needed for the KVMI_VCPU_SET_XSAVE command. Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[PATCH v10 70/81] KVM: introspection: add KVMI_VCPU_EVENT_DESCRIPTOR

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This event is sent when IDTR, GDTR, LDTR or TR are accessed. These could be used to implement a tiny agent which runs in the context of an introspected guest and uses virtualized exceptions (#VE) and alternate EPT views (VMFUNC #0) to filter converted VMEXITS. The events of

[PATCH v10 00/81] VM introspection

2020-11-25 Thread Adalbert Lazăr
The KVM introspection subsystem provides a facility for applications running on the host or in a separate VM, to control the execution of other VMs (pause, resume, shutdown), query the state of the vCPUs (GPRs, MSRs etc.), alter the page access bits in the shadow page tables (only for the hardware

[PATCH v10 45/81] KVM: introspection: handle vCPU introspection requests

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu The receiving thread dispatches the vCPU introspection commands by adding them to the vCPU's jobs list and kicking the vCPU. Before entering in guest, the vCPU thread checks the introspection request (KVM_REQ_INTROSPECTION) and runs its queued jobs. Signed-off-by: Mihai Donțu

[PATCH v10 63/81] KVM: introspection: add KVMI_VCPU_INJECT_EXCEPTION + KVMI_VCPU_EVENT_TRAP

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu The KVMI_VCPU_INJECT_EXCEPTION command is used by the introspection tool to inject exceptions, for example, to get a page from swap. The exception is injected right before entering in guest unless there is already an exception pending. The introspection tool is notified with

[PATCH v10 02/81] KVM: add kvm_vcpu_kick_and_wait()

2020-11-25 Thread Adalbert Lazăr
This function is needed for the KVMI_VM_PAUSE_VCPU command, which sets the introspection request flag, kicks the vCPU out of guest and returns a success error code (0). The vCPU will send the KVMI_VCPU_EVENT_PAUSE event as soon as possible. Once the introspection tool receives the event, it knows

[PATCH v10 81/81] KVM: x86: call the page tracking code on emulation failure

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu The information we can provide this way is incomplete, but current users of the page tracking code can work with it. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/x86.c | 49 ++ 1 file changed, 49

[PATCH v10 11/81] KVM: x86: add kvm_x86_ops.desc_ctrl_supported()

2020-11-25 Thread Adalbert Lazăr
When the introspection tool tries to enable the KVMI_VCPU_EVENT_DESCRIPTOR event, this function is used to check if the control of VM-exits caused by descriptor-table registers access is supported. Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/svm/svm.c

[PATCH v10 15/81] KVM: x86: add kvm_x86_ops.msr_write_intercepted()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function will be used to check if the write access for a specific MSR is already intercepted. The information will be used to restore the interception status when the introspection tool is no longer interested in that MSR. Signed-off-by: Nicușor Cîțu Signed-off-by:

[PATCH v10 56/81] KVM: introspection: add KVMI_VCPU_EVENT_HYPERCALL

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This event is sent on a specific hypercall. It is used by the code residing inside the introspected guest to call the introspection tool and to report certain details about its operation. For example, a classic antimalware remediation tool can report what it has found during a

[PATCH v10 35/81] KVM: introspection: add the read/dispatch message function

2020-11-25 Thread Adalbert Lazăr
Based on the common header (struct kvmi_msg_hdr), the receiving thread will read/validate all messages, execute the VM introspection commands (eg. KVMI_VM_GET_INFO) and dispatch the vCPU introspection commands (eg. KVMI_VCPU_GET_REGISTERS) to the vCPU threads. The vCPU threads will reply to vCPU

[PATCH v10 25/81] KVM: x86: export kvm_vcpu_ioctl_x86_get_xsave()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function is needed for the KVMI_VCPU_GET_XSAVE command. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c

[PATCH v10 31/81] KVM: x86: disable gpa_available optimization for fetch and page-walk SPT violations

2020-11-25 Thread Adalbert Lazăr
From: Mircea Cîrjaliu This change is needed because the introspection tool can write-protect guest page tables or exec-protect heap/stack pages. Signed-off-by: Mircea Cîrjaliu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 5 +

[PATCH v10 04/81] KVM: doc: fix the hypercalls numbering

2020-11-25 Thread Adalbert Lazăr
The next hypercalls will be correctly numbered. Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/hypercalls.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/virt/kvm/hypercalls.rst b/Documentation/virt/kvm/hypercalls.rst index

[PATCH v10 09/81] KVM: x86: add kvm_x86_ops.control_cr3_intercept()

2020-11-25 Thread Adalbert Lazăr
This function is needed for the KVMI_VCPU_CONTROL_CR command, when the introspection tool has to intercept the read/write access to CR3. Co-developed-by: Nicușor Cîțu Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 6 ++

[PATCH v10 37/81] KVM: introspection: add KVMI_VM_CHECK_COMMAND and KVMI_VM_CHECK_EVENT

2020-11-25 Thread Adalbert Lazăr
These commands are used to check what introspection commands and events are supported (kernel) and allowed (device manager). These are alternative methods to KVMI_GET_VERSION in checking if the introspection supports a specific command/event. As with the KVMI_GET_VERSION command, these two

[PATCH v10 16/81] KVM: x86: svm: use the vmx convention to control the MSR interception

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This is a preparatory patch in order to use a common interface to enable/disable the MSR interception. Also, it will allow to independently control the read and write interceptions. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr ---

[PATCH v10 18/81] KVM: x86: vmx: use a symbolic constant when checking the exit qualifications

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This should make the code more readable. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/vmx/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index

[PATCH v10 67/81] KVM: introspection: add KVMI_VCPU_GET_XSAVE

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This vCPU command is used to get the XSAVE area. Signed-off-by: Mihai Donțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 29 +++ arch/x86/include/uapi/asm/kvmi.h | 4 +++

[PATCH v10 79/81] KVM: introspection: add KVMI_VCPU_TRANSLATE_GVA

2020-11-25 Thread Adalbert Lazăr
This helps the introspection tool with the GVA to GPA translations without the need to read or monitor the guest page tables. Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 32 +++ arch/x86/kvm/kvmi_msg.c | 15 +

[PATCH v10 10/81] KVM: x86: add kvm_x86_ops.cr3_write_intercepted()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function will be used to allow the introspection tool to disable the CR3-write interception when it is no longer interested in these events, but only if nothing else depends on these VM-exits. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr ---

[PATCH v10 51/81] KVM: introspection: add the crash action handling on the event reply

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This action is used in extreme cases such as blocking the spread of malware as fast as possible. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- virt/kvm/introspection/kvmi.c | 4 1 file changed, 4 insertions(+) diff --git a/virt/kvm/introspection/kvmi.c

[PATCH v10 57/81] KVM: introspection: add KVMI_VCPU_EVENT_BREAKPOINT

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This event is sent when a breakpoint was reached. The introspection tool can place breakpoints and use them as notification for when the OS or an application has reached a certain state or is trying to perform a certain operation (eg. create a process). Signed-off-by: Mihai

[PATCH v10 03/81] KVM: add kvm_get_max_gfn()

2020-11-25 Thread Adalbert Lazăr
From: Ștefan Șicleru This function is needed for the KVMI_VM_GET_MAX_GFN command. Signed-off-by: Ștefan Șicleru Signed-off-by: Adalbert Lazăr --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 25 + 2 files changed, 26 insertions(+) diff --git

[PATCH v10 20/81] KVM: x86: add kvm_x86_ops.fault_gla()

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This function is needed for kvmi_update_ad_flags() and kvm_page_track_emulation_failure(). kvmi_update_ad_flags() uses the existing guest page table walk code to update the A/D bits and return to guest (when the introspection tool write-protects the guest page tables).

[PATCH v10 06/81] KVM: x86: add kvm_arch_vcpu_set_regs()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This is needed for the KVMI_VCPU_SET_REGISTERS command, which allows an introspection tool to override the kvm_regs structure for a specific vCPU without clearing the pending exception. In most cases this is used to increment the program counter. Signed-off-by: Nicușor Cîțu

[PATCH v10 55/81] KVM: introspection: add KVMI_VCPU_GET_CPUID

2020-11-25 Thread Adalbert Lazăr
From: Marian Rotariu This command returns a CPUID leaf (as seen by the guest OS). Signed-off-by: Marian Rotariu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 36 +++ arch/x86/include/uapi/asm/kvmi.h

[PATCH v10 27/81] KVM: x86: page track: provide all callbacks with the guest virtual address

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This is needed because the emulator calls the page tracking code irrespective of the current VM-exit reason or available information. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 2 +-

[PATCH v10 47/81] KVM: introspection: add KVMI_VCPU_GET_INFO

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This command returns the TSC frequency (in HZ) for the specified vCPU if available (otherwise it returns zero). Signed-off-by: Mihai Donțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 29

[PATCH v10 30/81] KVM: x86: wire in the preread/prewrite/preexec page trackers

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu These are needed in order to notify the introspection tool when read/write/execute access happens on one of the tracked memory pages. Also, this patch adds the case when the introspection tool requests that the vCPU re-enter in guest (and abort the emulation of the current

[PATCH v10 23/81] KVM: x86: extend kvm_mmu_gva_to_gpa_system() with the 'access' parameter

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This is needed for kvmi_update_ad_flags() to emulate a guest page table walk on SPT violations due to A/D bit updates. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/x86.c | 6 +++--- 2 files

[PATCH v10 36/81] KVM: introspection: add KVMI_GET_VERSION

2020-11-25 Thread Adalbert Lazăr
When handling introspection commands from tools built with older or newer versions of the introspection API, the receiving thread silently accepts smaller/larger messages, but it replies with messages related to current/kernel version. Smaller introspection event replies are accepted too. However,

[PATCH v10 66/81] KVM: introspection: add KVMI_VCPU_GET_XCR

2020-11-25 Thread Adalbert Lazăr
This can be used by the introspection tool to emulate SSE instructions. Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 33 +++ arch/x86/include/uapi/asm/kvmi.h | 9 + arch/x86/kvm/kvmi_msg.c | 21

[PATCH v10 48/81] KVM: introspection: add KVMI_VM_PAUSE_VCPU

2020-11-25 Thread Adalbert Lazăr
This command increments a pause requests counter for a vCPU and kicks it out of guest. The introspection tool can pause a VM by sending this command for all vCPUs. If it sets 'wait=1', it can consider that the VM is paused when it receives the reply for the last KVMI_VM_PAUSE_VCPU command.

[PATCH v10 60/81] KVM: introspection: add KVMI_VM_CONTROL_CLEANUP

2020-11-25 Thread Adalbert Lazăr
This command will allow more control over the guest state on unhook. However, the memory restrictions (e.g. those set with KVMI_VM_SET_PAGE_ACCESS) will be removed on unhook. Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 28 +++

[PATCH v10 49/81] KVM: introspection: add support for vCPU events

2020-11-25 Thread Adalbert Lazăr
This is the common code used by vCPU threads to send events and wait for replies (received and dispatched by the receiving thread). While waiting for an event reply, the vCPU thread will handle any introspection command already queued or received during this period. Signed-off-by: Adalbert Lazăr

[PATCH v10 77/81] KVM: introspection: add KVMI_VCPU_CONTROL_SINGLESTEP

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu The next commit that adds the KVMI_VCPU_EVENT_SINGLESTEP event will make this command more useful. Signed-off-by: Nicușor Cîțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 33 +++

[PATCH v10 53/81] KVM: introspection: add KVMI_VCPU_GET_REGISTERS

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This command is used to get kvm_regs and kvm_sregs structures, plus a list of struct kvm_msrs from a specific vCPU. While the kvm_regs and kvm_sregs structures are included with every event, this command allows reading any MSR. Signed-off-by: Mihai Donțu Co-developed-by:

[PATCH v10 78/81] KVM: introspection: add KVMI_VCPU_EVENT_SINGLESTEP

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This event is sent after each instruction when the singlestep has been enabled for a vCPU. Signed-off-by: Nicușor Cîțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 31 +++ arch/x86/kvm/kvmi.c

[PATCH v10 61/81] KVM: introspection: add KVMI_VCPU_CONTROL_CR and KVMI_VCPU_EVENT_CR

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu Using the KVMI_VCPU_CONTROL_CR command, the introspection tool subscribes to KVMI_VCPU_EVENT_CR events that will be sent when a control register (CR0, CR3 or CR4) is going to be changed. Signed-off-by: Mihai Donțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr

[PATCH v10 59/81] KVM: introspection: restore the state of #BP interception on unhook

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This commit also ensures that only the userspace or the introspection tool can control the #BP interception exclusively at one time. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvmi_host.h | 18 ++ arch/x86/kvm/kvmi.c

[PATCH v10 17/81] KVM: x86: add kvm_x86_ops.control_msr_intercept()

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This is needed for the KVMI_VCPU_EVENT_MSR event, which is used notify the introspection tool about any change made to a MSR of interest. Signed-off-by: Mihai Donțu Co-developed-by: Nicușor Cîțu Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr ---

[PATCH v10 24/81] KVM: x86: export kvm_inject_pending_exception()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function is needed for the KVMI_VCPU_INJECT_EXCEPTION command. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 52 +++-- 2 files changed, 31

[PATCH v10 21/81] KVM: x86: add kvm_x86_ops.control_singlestep()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function is needed for KVMI_VCPU_CONTROL_SINGLESTEP. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/vmx.c | 11 +++ 2 files changed, 12 insertions(+) diff --git

[PATCH v10 29/81] KVM: x86: page_track: add support for preread, prewrite and preexec

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu The access to a tracked memory page leads to two types of actions from the introspection tool: either the access is allowed (maybe with different data for the source operand) or the vCPU should re-enter in guest (the page is not tracked anymore, the instruction was

[PATCH v10 65/81] KVM: introspection: add KVMI_VCPU_EVENT_XSETBV

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This event is sent when an extended control register XCR is going to be changed. Signed-off-by: Mihai Donțu Co-developed-by: Nicușor Cîțu Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 34

[PATCH v10 74/81] KVM: introspection: add KVMI_VM_SET_PAGE_ACCESS

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This command sets the spte access bits (rwx) for an array of guest physical addresses (through the page tracking subsystem). These GPAs, with the requested access bits, are also kept in a radix tree in order to filter out the #PF events which are of no interest to the

[PATCH v10 72/81] KVM: introspection: add KVMI_VCPU_CONTROL_MSR and KVMI_VCPU_EVENT_MSR

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This command is used to enable/disable introspection for a specific MSR. The KVMI_VCPU_EVENT_MSR event is sent when the tracked MSR is going to be changed. The introspection tool can respond by allowing the guest to continue with normal execution or by discarding the change.

[PATCH v10 07/81] KVM: x86: avoid injecting #PF when emulate the VMCALL instruction

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu It can happened to end up emulating the VMCALL instruction as a result of the handling of an EPT write fault. In this situation, the emulator will try to unconditionally patch the correct hypercall opcode bytes using emulator_write_emulated(). However, this last call uses the

[PATCH v10 52/81] KVM: introspection: add KVMI_VCPU_CONTROL_EVENTS

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu By default, all introspection events are disabled. The introspection tool must explicitly enable the events it wants to receive. With this command (KVMI_VCPU_CONTROL_EVENTS) it can enable/disable any vCPU event allowed by the device manager. Some vCPU events doesn't have to be

[PATCH v10 41/81] KVM: introspection: add KVMI_VM_CONTROL_EVENTS

2020-11-25 Thread Adalbert Lazăr
By default, all introspection VM events are disabled. The introspection tool must explicitly enable the VM events it wants to receive. With this command it can enable/disable any VM event (e.g. KVMI_VM_EVENT_UNHOOK) if allowed by the device manager. Signed-off-by: Adalbert Lazăr ---

[PATCH v10 39/81] KVM: introspection: add KVM_INTROSPECTION_PREUNHOOK

2020-11-25 Thread Adalbert Lazăr
In certain situations (when the guest has to be paused, suspended, migrated, etc.), the device manager will use this new ioctl in order to trigger the KVMI_VM_EVENT_UNHOOK event. If the event is sent successfully (the VM has an active introspection channel), the device manager should delay the

[PATCH v10 14/81] KVM: x86: add kvm_x86_ops.desc_intercepted()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function will be used to test if the descriptor-table registers access is already tracked by userspace. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/svm/svm.c | 15 +++

[PATCH v10 62/81] KVM: introspection: restore the state of CR3 interception on unhook

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This commit also ensures that the introspection tool and the userspace do not disable each other the CR3-write VM-exit. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvmi_host.h | 4 ++ arch/x86/kvm/kvmi.c | 67

[PATCH v10 43/81] KVM: introspection: add vCPU related data

2020-11-25 Thread Adalbert Lazăr
From: Mircea Cîrjaliu Add an introspection structure to all vCPUs when the VM is hooked. Signed-off-by: Mircea Cîrjaliu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvmi_host.h | 3 ++ include/linux/kvm_host.h | 1 + include/linux/kvmi_host.h| 6

[PATCH v10 08/81] KVM: x86: add kvm_x86_ops.bp_intercepted()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu Both, the introspection tool and the device manager can request #BP interception. This function will be used to check if this interception is already enabled by either side. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 +

  1   2   >