Re: [PATCH RFC 3/4] barriers: convert a control to a data dependency

2019-01-06 Thread Jason Wang
On 2019/1/7 下午12:23, Michael S. Tsirkin wrote: On Mon, Jan 07, 2019 at 11:58:23AM +0800, Jason Wang wrote: On 2019/1/3 上午4:57, Michael S. Tsirkin wrote: It's not uncommon to have two access two unrelated memory locations in a specific order. At the moment one has to use a memory barrier for

Re: [PATCH RFC 3/4] barriers: convert a control to a data dependency

2019-01-06 Thread Michael S. Tsirkin
On Mon, Jan 07, 2019 at 11:58:23AM +0800, Jason Wang wrote: > > On 2019/1/3 上午4:57, Michael S. Tsirkin wrote: > > It's not uncommon to have two access two unrelated memory locations in a > > specific order. At the moment one has to use a memory barrier for this. > > > > However, if the first acc

Re: [PATCH] Documentation/filesystems: fix title underline lengths in path-lookup.rst

2019-01-06 Thread NeilBrown
On Sun, Jan 06 2019, Randy Dunlap wrote: > From: Randy Dunlap > > Fix Sphinx warnings in path-lookup.rst: > > Documentation/filesystems/path-lookup.rst:347: WARNING: Title underline too > short. > Documentation/filesystems/path-lookup.rst:358: WARNING: Title underline too > short. > Documentati

Re: [PATCH RFC 3/4] barriers: convert a control to a data dependency

2019-01-06 Thread Jason Wang
On 2019/1/3 上午4:57, Michael S. Tsirkin wrote: It's not uncommon to have two access two unrelated memory locations in a specific order. At the moment one has to use a memory barrier for this. However, if the first access was a read and the second used an address depending on the first one we w

[PATCH] Documentation/filesystems: fix title underline lengths in path-lookup.rst

2019-01-06 Thread Randy Dunlap
From: Randy Dunlap Fix Sphinx warnings in path-lookup.rst: Documentation/filesystems/path-lookup.rst:347: WARNING: Title underline too short. Documentation/filesystems/path-lookup.rst:358: WARNING: Title underline too short. Documentation/filesystems/path-lookup.rst:369: WARNING: Title underli

Re: [PATCH 2/2 v5] kdump,vmcoreinfo: Export the value of sme mask to vmcoreinfo

2019-01-06 Thread Baoquan He
On 01/07/19 at 09:47am, Lianbo Jiang wrote: > For AMD machine with SME feature, makedumpfile tools need to know > whether the crash kernel was encrypted or not. If SME is enabled ^ crashed > in the first kernel, the crash kernel's page table(pgd/pud/pmd/pte)

[PATCH 2/2 v5] kdump,vmcoreinfo: Export the value of sme mask to vmcoreinfo

2019-01-06 Thread Lianbo Jiang
For AMD machine with SME feature, makedumpfile tools need to know whether the crash kernel was encrypted or not. If SME is enabled in the first kernel, the crash kernel's page table(pgd/pud/pmd/pte) contains the memory encryption mask, so need to remove the sme mask to obtain the true physical addr

[PATCH 1/2 v5] kdump: add the vmcoreinfo documentation

2019-01-06 Thread Lianbo Jiang
This document lists some variables that export to vmcoreinfo, and briefly describles what these variables indicate. It should be instructive for many people who do not know the vmcoreinfo, and it also normalizes the exported variables as a convention between kernel and use-space. Suggested-by: Bor

[PATCH 0/2 v5] kdump,vmcoreinfo: Export the value of sme mask to vmcoreinfo

2019-01-06 Thread Lianbo Jiang
This patchset did two things: a. add a new document for vmcoreinfo This document lists some variables that export to vmcoreinfo, and briefly describles what these variables indicate. It should be instructive for many people who do not know the vmcoreinfo, and it also normalizes the exported variab

[PATCH V8 04/11] KVM: Document Memory ROE

2019-01-06 Thread Ahmed Abd El Mawgood
ROE version documented here is implemented in the next 2 patches Signed-off-by: Ahmed Abd El Mawgood --- Documentation/virtual/kvm/hypercalls.txt | 40 1 file changed, 40 insertions(+) diff --git a/Documentation/virtual/kvm/hypercalls.txt b/Documentation/virtual/kvm/hyp

[PATCH V8 07/11] KVM: Add support for byte granular memory ROE

2019-01-06 Thread Ahmed Abd El Mawgood
This patch documents and implements ROE_MPROTECT_CHUNK, a part of ROE hypercall designed to protect regions of a memory page with byte granularity. This feature provides a key primitive to protect against attacks involving pages remapping. Signed-off-by: Ahmed Abd El Mawgood --- include/linux/kv

[PATCH V8 10/11] KVM: Log ROE violations in system log

2019-01-06 Thread Ahmed Abd El Mawgood
Signed-off-by: Ahmed Abd El Mawgood --- virt/kvm/kvm_main.c| 3 ++- virt/kvm/roe.c | 25 + virt/kvm/roe_generic.h | 3 ++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index d92d300539..b3dc7255b0 1

[PATCH V8 08/11] KVM: X86: Port ROE_MPROTECT_CHUNK to x86

2019-01-06 Thread Ahmed Abd El Mawgood
Apply d->memslot->partial_roe_bitmap to shadow page table entries too. Signed-off-by: Ahmed Abd El Mawgood --- arch/x86/kvm/roe.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/roe.c b/arch/x86/kvm/roe.c index f787106be8..700f69823b 100644 --- a/arch/x86/kvm

[PATCH V8 09/11] KVM: Add new exit reason For ROE violations

2019-01-06 Thread Ahmed Abd El Mawgood
The problem is that qemu will not be able to detect ROE violations, so one option would be create host API to tell if a given page is ROE protected, or create ROE violation exit reason. Signed-off-by: Ahmed Abd El Mawgood --- arch/x86/kvm/x86.c | 10 +- include/kvm/roe.h| 1

[PATCH V8 06/11] KVM: X86: Enable ROE for x86

2019-01-06 Thread Ahmed Abd El Mawgood
This patch implements kvm_roe_arch_commit_protection and kvm_roe_arch_is_userspace for x86, and invoke kvm_roe via the appropriate vmcall. Signed-off-by: Ahmed Abd El Mawgood --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/Makefile | 4 +- arch/x86/kvm/mmu.c |

[PATCH V8 11/11] KVM: ROE: Store protected chunks in red black tree

2019-01-06 Thread Ahmed Abd El Mawgood
The old way of storing protected chunks was a linked list. That made linear overhead when searching for chunks. When reaching 2000 chunk, The time taken two read the last chunk was about 10 times slower than the first chunk. This patch stores the chunks as tree for faster search. Signed-off-by: Ah

[PATCH V8 05/11] KVM: Create architecture independent ROE skeleton

2019-01-06 Thread Ahmed Abd El Mawgood
This patch introduces a hypercall that can assist against subset of kernel rootkits, it works by place readonly protection in shadow PTE. The end result protection is also kept in a bitmap for each kvm_memory_slot and is used as reference when updating SPTEs. The whole goal is to protect the guest

[PATCH V8 03/11] KVM: X86: Add helper function to convert SPTE to GFN

2019-01-06 Thread Ahmed Abd El Mawgood
Signed-off-by: Ahmed Abd El Mawgood --- arch/x86/kvm/mmu.c | 7 +++ arch/x86/kvm/mmu.h | 1 + 2 files changed, 8 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 098df7d135..bbfe3f2863 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1053,6 +1053,13 @@ sta

[PATCH V8 02/11] KVM: X86: Add arbitrary data pointer in kvm memslot iterator functions

2019-01-06 Thread Ahmed Abd El Mawgood
This will help sharing data into the slot_level_handler callback. In my case I need to a share a counter for the pages traversed to use it in some bitmap. Being able to send arbitrary memory pointer into the slot_level_handler callback made it easy. Signed-off-by: Ahmed Abd El Mawgood --- arch/x

[PATCH V8 0/11] KVM: X86: Introducing ROE Protection Kernel Hardening

2019-01-06 Thread Ahmed Abd El Mawgood
-- Summary -- ROE is a hypercall that enables host operating system to restrict guest's access to its own memory. This will provide a hardening mechanism that can be used to stop rootkits from manipulating kernel static data structures and code. Once a memory region is protected the guest kernel c

[PATCH V8 01/11] KVM: State whether memory should be freed in kvm_free_memslot

2019-01-06 Thread Ahmed Abd El Mawgood
The conditions upon which kvm_free_memslot are kind of ad-hock, it will be hard to extend memslot with allocatable data that needs to be freed, so I replaced the current mechanism by clear flag that states if the memory slot should be freed. Signed-off-by: Ahmed Abd El Mawgood --- virt/kvm/kvm_m