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 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 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 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

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 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 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 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 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 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: [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

[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 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 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

[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 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 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] 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 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 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.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

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 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 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: [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 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 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: [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: [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: [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 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 v4] i2c: virtio: add a virtio i2c frontend driver

2020-11-25 Thread Michael S. Tsirkin
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 communicates with the backend driver through

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

2020-11-25 Thread Michael S. Tsirkin
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 pinned pages is reverted > to what it was

Re: [PATCH v3] virtio-rng: return available data with O_NONBLOCK

2020-11-25 Thread Michael S. Tsirkin
On Tue, Sep 08, 2020 at 05:33:40PM +0200, Martin Wilck wrote: > On Tue, 2020-09-08 at 10:14 -0400, Michael S. Tsirkin wrote: > > On Mon, Aug 31, 2020 at 02:37:26PM +0200, Laurent Vivier wrote: > > > On 28/08/2020 23:34, Martin Wilck wrote: > > > > On Wed, 2020-08-26 at 08:26 -0400, Michael S.

[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 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 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 01/81] KVM: UAPI: add error codes used by the VM introspection code

2020-11-25 Thread Adalbert Lazăr
These new error codes help the introspection tool to identify the cause of the introspection command failure and to recover from some error cases or to give more information to the user. Signed-off-by: Adalbert Lazăr --- include/uapi/linux/kvm_para.h | 4 1 file changed, 4 insertions(+)

[PATCH v10 80/81] KVM: introspection: emulate a guest page table walk on SPT violations due to A/D bit updates

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu On SPT page faults caused by guest page table walks, use the existing guest page table walk code to make the necessary adjustments to the A/D bits and return to guest. This effectively bypasses the x86 emulator who was making the wrong modifications leading one OS (Windows 8.1

[PATCH v10 54/81] KVM: introspection: add KVMI_VCPU_SET_REGISTERS

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu During an introspection event, the introspection tool might need to change the vCPU state, for example, to skip the current instruction. This command is allowed only during vCPU events and the registers will be set when the reply has been received. Signed-off-by: Mihai Donțu

[PATCH v10 22/81] KVM: x86: export kvm_arch_vcpu_set_guest_debug()

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function is needed in order to notify the introspection tool through KVMI_VCPU_EVENT_BP events on guest breakpoints. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/x86.c | 18 +- include/linux/kvm_host.h | 2 ++ 2

[PATCH v10 71/81] KVM: introspection: restore the state of descriptor-table register 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 descriptor-table access 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 |

[PATCH v10 28/81] KVM: x86: page track: add track_create_slot() callback

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This is used to add page access notifications as soon as a slot appears or when a slot is moved. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_page_track.h | 13 - arch/x86/kvm/mmu/page_track.c | 17

[PATCH v10 42/81] KVM: introspection: add KVMI_VM_READ_PHYSICAL/KVMI_VM_WRITE_PHYSICAL

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu These commands allow the introspection tool to read/write from/to the guest memory. Signed-off-by: Mihai Donțu Co-developed-by: Adalbert Lazăr Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 68 ++ include/uapi/linux/kvmi.h

[PATCH v10 19/81] KVM: x86: save the error code during EPT/NPF exits handling

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This is needed for kvm_page_track_emulation_failure(). When the introspection tool {read,write,exec}-protect a guest memory page, it is notified from the read/write/fetch callbacks used by the KVM emulator. If the emulation fails it is possible that the read/write callbacks

[PATCH v10 44/81] KVM: introspection: add a jobs list to every introspected vCPU

2020-11-25 Thread Adalbert Lazăr
Every vCPU has a lock-protected list in which the receiving thread places the jobs that has to be done by the vCPU thread once it is kicked out of guest (KVM_REQ_INTROSPECTION). Co-developed-by: Nicușor Cîțu Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr ---

[PATCH v10 50/81] KVM: introspection: add KVMI_VCPU_EVENT_PAUSE

2020-11-25 Thread Adalbert Lazăr
This event is sent by the vCPU thread as a response to the KVMI_VM_PAUSE_VCPU command, but it has a lower priority, being sent after any other introspection event and when no other introspection command is queued. The number of KVMI_VCPU_EVENT_PAUSE will match the number of successful

[PATCH v10 12/81] KVM: svm: add support for descriptor-table VM-exits

2020-11-25 Thread Adalbert Lazăr
From: Nicușor Cîțu This function is needed for the KVMI_VCPU_EVENT_DESCRIPTOR event. Signed-off-by: Nicușor Cîțu Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/svm/svm.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index

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

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu The KVM introspection subsystem provides a facility for applications to control the execution of any running VMs (pause, resume, shutdown), query the state of the vCPUs (GPRs, MSRs etc.), alter the page access bits in the shadow page tables and receive notifications when events

[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 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 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 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 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 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 +

[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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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

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 >

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

[PATCH v10 38/81] KVM: introspection: add KVMI_VM_GET_INFO

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu This command returns the number of online vCPUs. The introspection tool uses the vCPU index to specify to which vCPU the introspection command applies to. Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst | 18

[PATCH v10 68/81] KVM: introspection: add KVMI_VCPU_SET_XSAVE

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 | 28 +++ arch/x86/include/uapi/asm/kvmi.h | 4 +++ arch/x86/kvm/kvmi_msg.c | 21

[PATCH v10 13/81] KVM: x86: add kvm_x86_ops.control_desc_intercept()

2020-11-25 Thread Adalbert Lazăr
This function is needed to intercept descriptor-table registers access. Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/svm/svm.c | 26 ++ arch/x86/kvm/vmx/vmx.c | 15 +-- 3 files changed, 40

[PATCH v10 34/81] KVM: introspection: add permission access ioctls

2020-11-25 Thread Adalbert Lazăr
KVM_INTROSPECTION_COMMAND and KVM_INTROSPECTION_EVENTS ioctls are used by the device manager to allow/disallow access to specific (or all) introspection commands and events. The introspection tool will get the KVM_EPERM error code on any attempt to use a disallowed command. By default, all events

[PATCH v10 76/81] KVM: introspection: extend KVMI_GET_VERSION with struct kvmi_features

2020-11-25 Thread Adalbert Lazăr
This is used by the introspection tool to check the hardware support for the single step feature. Signed-off-by: Adalbert Lazăr --- Documentation/virt/kvm/kvmi.rst| 15 +-- arch/x86/include/uapi/asm/kvmi.h | 5 + arch/x86/kvm/kvmi.c

[PATCH v10 05/81] KVM: x86: add kvm_arch_vcpu_get_regs() and kvm_arch_vcpu_get_sregs()

2020-11-25 Thread Adalbert Lazăr
From: Mihai Donțu These functions are used by the VM introspection code (for the KVMI_VCPU_GET_REGISTERS command and all events sending the vCPU registers to the introspection tool). Signed-off-by: Mihai Donțu Signed-off-by: Adalbert Lazăr --- arch/x86/kvm/x86.c | 10 ++

  1   2   >