Re: [PATCH v1] Revert "KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR"

2015-09-22 Thread Marcelo Tosatti
On Tue, Sep 22, 2015 at 06:33:46PM +0200, Radim Krčmář wrote: > PVCLOCK_COUNTS_FROM_ZERO broke ABI and (at least) three things with it. > All problems stem from repeated writes to MSR_KVM_SYSTEM_TIME(_NEW). > The reverted patch treated the MSR write as a one-shot initializer: > any write from VCPU

Re: [PATCH] x86: vdso: fix pvclock races with task migration

2015-04-06 Thread Marcelo Tosatti
) || > + smp_rmb(); > + } while (unlikely((pvti->pvti.version & 1) || > pvti->pvti.version != version || > pvti->migrate_count != migrate_count)); > > -- > 2.3.4 > > -- > To unsubscribe fr

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-26 Thread Marcelo Tosatti
On Thu, Mar 26, 2015 at 04:28:37PM -0700, Andy Lutomirski wrote: > On Thu, Mar 26, 2015 at 4:22 PM, Marcelo Tosatti wrote: > > On Thu, Mar 26, 2015 at 04:09:53PM -0700, Andy Lutomirski wrote: > >> On Thu, Mar 26, 2015 at 3:56 PM, Marcelo Tosatti > >> wrote: > >

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-26 Thread Marcelo Tosatti
On Thu, Mar 26, 2015 at 04:09:53PM -0700, Andy Lutomirski wrote: > On Thu, Mar 26, 2015 at 3:56 PM, Marcelo Tosatti wrote: > > On Thu, Mar 26, 2015 at 01:58:25PM -0700, Andy Lutomirski wrote: > >> On Thu, Mar 26, 2015 at 1:31 PM, Radim Krcmar wrote: > >> > 2015-03-

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-26 Thread Marcelo Tosatti
On Thu, Mar 26, 2015 at 01:58:25PM -0700, Andy Lutomirski wrote: > On Thu, Mar 26, 2015 at 1:31 PM, Radim Krcmar wrote: > > 2015-03-26 11:51-0700, Andy Lutomirski: > >> On Thu, Mar 26, 2015 at 4:29 AM, Marcelo Tosatti > >> wrote: > >> > On Wed, Mar 25, 20

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-26 Thread Marcelo Tosatti
On Thu, Mar 26, 2015 at 03:24:10PM -0700, Andy Lutomirski wrote: > On Thu, Mar 26, 2015 at 3:22 PM, Marcelo Tosatti wrote: > > On Thu, Mar 26, 2015 at 09:59:24PM +0100, Radim Krčmář wrote: > >> 2015-03-23 20:21-0300, Marcelo Tosatti: > >> > > >> > The fol

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-26 Thread Marcelo Tosatti
On Thu, Mar 26, 2015 at 09:59:24PM +0100, Radim Krčmář wrote: > 2015-03-23 20:21-0300, Marcelo Tosatti: > > > > The following point: > > > > 2. per-CPU pvclock time info is updated if the > >underlying CPU changes. > > > > Is not true

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-26 Thread Marcelo Tosatti
On Wed, Mar 25, 2015 at 04:22:03PM -0700, Andy Lutomirski wrote: > On Wed, Mar 25, 2015 at 4:13 PM, Marcelo Tosatti wrote: > > On Wed, Mar 25, 2015 at 03:48:02PM -0700, Andy Lutomirski wrote: > >> On Wed, Mar 25, 2015 at 3:41 PM, Marcelo Tosatti > >> wrote: > >

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-25 Thread Marcelo Tosatti
On Wed, Mar 25, 2015 at 03:48:02PM -0700, Andy Lutomirski wrote: > On Wed, Mar 25, 2015 at 3:41 PM, Marcelo Tosatti wrote: > > On Wed, Mar 25, 2015 at 03:33:10PM -0700, Andy Lutomirski wrote: > >> On Mar 25, 2015 2:29 PM, "Marcelo Tosatti" wrote: > >> > &

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-25 Thread Marcelo Tosatti
On Wed, Mar 25, 2015 at 03:33:10PM -0700, Andy Lutomirski wrote: > On Mar 25, 2015 2:29 PM, "Marcelo Tosatti" wrote: > > > > On Wed, Mar 25, 2015 at 01:52:15PM +0100, Radim Krčmář wrote: > > > 2015-03-25 12:08+0100, Radim Krčmář: > > > > Reverting t

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-25 Thread Marcelo Tosatti
On Wed, Mar 25, 2015 at 01:52:15PM +0100, Radim Krčmář wrote: > 2015-03-25 12:08+0100, Radim Krčmář: > > Reverting the patch protects us from any migration, but I don't think we > > need to care about changing VCPUs as long as we read a consistent data > > from kvmclock. (VCPU can change outside o

Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-24 Thread Marcelo Tosatti
On Tue, Mar 24, 2015 at 04:34:12PM +0100, Radim Krčmář wrote: > 2015-03-23 20:21-0300, Marcelo Tosatti: > > The following point: > > > > 2. per-CPU pvclock time info is updated if the > >underlying CPU changes. > > > > Is not true anymo

x86: kvm: Revert "remove sched notifier for cross-cpu migrations"

2015-03-23 Thread Marcelo Tosatti
The following point: 2. per-CPU pvclock time info is updated if the underlying CPU changes. Is not true anymore since "KVM: x86: update pvclock area conditionally, on cpu migration". Add task migration notification back. Problem noticed by Andy Lutomirski. Signed-off-b

Re: [PATCH RESEND] KVM: nVMX: mask unrestricted_guest if disabled on L0

2015-03-17 Thread Marcelo Tosatti
On Tue, Mar 17, 2015 at 02:02:32PM +0100, Radim Krčmář wrote: > If EPT was enabled, unrestricted_guest was allowed in L1 regardless of > L0. L1 triple faulted when running L2 guest that required emulation. > > Another side effect was 'WARN_ON_ONCE(vmx->nested.nested_run_pending)' > in L0's dmesg:

Re: [PATCH] kvm: move advertising of KVM_CAP_IRQFD to common code

2015-03-10 Thread Marcelo Tosatti
On Thu, Mar 05, 2015 at 11:54:46AM +0100, Paolo Bonzini wrote: > POWER supports irqfds but forgot to advertise them. Some userspace does > not check for the capability, but others check it---thus they work on > x86 and s390 but not POWER. > > To avoid that other architectures in the future make t

Re: [PATCH] MIPS: KVM: Fix trace event to save PC directly

2015-03-02 Thread Marcelo Tosatti
On Tue, Feb 24, 2015 at 11:46:20AM +, James Hogan wrote: > Currently the guest exit trace event saves the VCPU pointer to the > structure, and the guest PC is retrieved by dereferencing it when the > event is printed rather than directly from the trace record. This isn't > safe as the printing

Re: [PATCH] KVM: x86: fix TSC matching

2014-09-03 Thread Marcelo Tosatti
On Tue, Aug 26, 2014 at 12:08:32PM +0300, Pekka Enberg wrote: > On Sun, Aug 17, 2014 at 11:54 AM, Paolo Bonzini wrote: > > Il 15/08/2014 18:54, Marcelo Tosatti ha scritto: > >> > >> Ping on integration. > > > > It's been in kvm/next for a while, and

Re: KVM: x86: handle idiv overflow at kvm_write_tsc for stable-3.10

2014-09-03 Thread Marcelo Tosatti
On Wed, Sep 03, 2014 at 10:16:40AM +0200, Philipp Hahn wrote: > Hello, > > can we please 8915aa27d5efbb9185357175b0acf884325565f9 get applied to > 3.10 too? > > > commit 8915aa27d5efbb9185357175b0acf884325565f9 > > Author: Marcelo Tosatti > > Date:

Re: [PATCH] KVM: lapic: sync highest ISR to hardware apic on EOI

2014-05-28 Thread Marcelo Tosatti
find_highest_vector(apic->regs + APIC_ISR); > - ASSERT(result == -1 || result >= 16); > - > - return result; > -} > - > void kvm_apic_update_tmr(struct kvm_vcpu *vcpu, u32 *tmr) > { > struct kvm_lapic *apic = vcpu->arch.apic; > @@ -1605,6 +1627,8

Re: [PATCH] KVM: SVM: fix cr8 intercept window

2014-03-12 Thread Marcelo Tosatti
On Wed, Mar 12, 2014 at 11:40:48AM +0100, Radim Krčmář wrote: > 2014-03-11 22:05-0300, Marcelo Tosatti: > > On Tue, Mar 11, 2014 at 07:11:18PM +0100, Radim Krčmář wrote: > > > We always disable cr8 intercept in its handler, but only re-enable it > > > if handling KVM_R

Re: [PATCH] KVM: SVM: fix cr8 intercept window

2014-03-11 Thread Marcelo Tosatti
On Tue, Mar 11, 2014 at 07:11:18PM +0100, Radim Krčmář wrote: > We always disable cr8 intercept in its handler, but only re-enable it > if handling KVM_REQ_EVENT, so there can be a window where we do not > intercept cr8 writes, which allows an interrupt to disrupt a higher > priority task. > > Fix

Re: [stable] KVM security fixes

2013-04-15 Thread Marcelo Tosatti
On Sun, Apr 14, 2013 at 07:17:22PM -0700, Greg KH wrote: > On Mon, Apr 15, 2013 at 03:12:24AM +0100, Ben Hutchings wrote: > > Brad Spengler pointed out that some KVM security fixes are missing from > > the 3.2 branches. Three recent commits were marked as such: > > > > c300aa64ddf5 KVM: x86: fix

Re: [PATCH 3.8 stable] x86/kvm: Fix pvclock vsyscall fixmap

2013-03-10 Thread Marcelo Tosatti
sh below when booting a next-20130204+ smp guest on a > 3.8-rc5+ KVM host. > > [0.666410] udevd[97]: starting version 175 > [0.674043] udevd[97]: udevd:[97]: segfault at ff5fd020 > ip 7fff069e277f sp 7fff068c9ef8 error d > > Acked-by: Marc

[PATCH 3.8 stable] x86: pvclock kvm: align allocation size to page size

2013-03-10 Thread Marcelo Tosatti
To match whats mapped via vsyscalls to userspace. Reported-by: Peter Hurley Signed-off-by: Marcelo Tosatti (cherry picked from commit ed55705dd5008b408c48a8459b8b34b01f3de985) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 220a360..5bedbdd 100644 --- a/arch/x86

Re: [PATCH 3.7.y] kvm: Fix irqfd resampler list walk

2013-01-28 Thread Marcelo Tosatti
On Mon, Jan 28, 2013 at 02:58:02PM -0700, Alex Williamson wrote: > Typo for the next pointer means we're walking random data here. > > Signed-off-by: Alex Williamson > Signed-off-by: Marcelo Tosatti > (cherry picked from commit 49f8a1a5394d8baee5e56fb71e5cf993c228689

Re: [PATCH] CVE-2012-4461 invalid opcode oops on SET_SREGS with OSXSAVE bit set

2012-11-22 Thread Marcelo Tosatti
On Thu, Nov 22, 2012 at 03:42:19PM +0100, Petr Matousek wrote: > On Wed, Nov 21, 2012 at 06:43:01AM -0800, Greg KH wrote: > > On Wed, Nov 21, 2012 at 11:40:27AM +0100, Petr Matousek wrote: > > > This has been accepted as > > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=

[PATCH 3/7] KVM: lock slots_lock around device assignment

2012-05-18 Thread Marcelo Tosatti
itial mappings as well as around iommu teardown to avoid this race. Signed-off-by: Alex Williamson Signed-off-by: Marcelo Tosatti Signed-off-by: Greg Kroah-Hartman --- virt/kvm/iommu.c | 23 +++ 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/virt/kvm/iommu.c b/vir

[PATCH 7/7] KVM: s390: Sanitize fpc registers for KVM_SET_FPU

2012-05-18 Thread Marcelo Tosatti
. Signed-off-by: Christian Borntraeger Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/kvm-s390.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index

[PATCH 2/7] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings

2012-05-18 Thread Marcelo Tosatti
From: Avi Kivity (cherry picked from commit 3e515705a1f46beb1c942bb8043c16f8ac7b1e9e) If some vcpus are created before KVM_CREATE_IRQCHIP, then irqchip_in_kernel() and vcpu->arch.apic will be inconsistent, leading to potential NULL pointer dereferences. Fix by: - ensuring that no vcpus are inst

[PATCH 6/7] KVM: s390: do store status after handling STOP_ON_STOP bit

2012-05-18 Thread Marcelo Tosatti
kvm store status since it calls gmap_fault() which might sleep. Since local_int.lock only protects local_int.* and not guest memory we can give up the lock. Signed-off-by: Jens Freimann Signed-off-by: Christian Borntraeger Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity Signed-off-by:

[PATCH 4/7] KVM: nVMX: Fix erroneous exception bitmap check

2012-05-18 Thread Marcelo Tosatti
From: Nadav Har'El (cherry picked from commit 9587190107d0c0cbaccbf7bf6b0245d29095a9ae) The code which checks whether to inject a pagefault to L1 or L2 (in nested VMX) was wrong, incorrect in how it checked the PF_VECTOR bit. Thanks to Dan Carpenter for spotting this. Signed-off-by: Nadav Har'E

[PATCH 5/7] KVM: VMX: vmx_set_cr0 expects kvm->srcu locked

2012-05-18 Thread Marcelo Tosatti
(cherry picked from commit 7a4f5ad051e02139a9f1c0f7f4b1acb88915852b) vmx_set_cr0 is called from vcpu run context, therefore it expects kvm->srcu to be held (for setting up the real-mode TSS). Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- a

[PATCH 1/7] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock

2012-05-18 Thread Marcelo Tosatti
From: Takuya Yoshikawa (cherry picked from commit 565f3be2174611f364405bbea2d86e153c2e7e78 Other threads may process the same page in that small window and skip TLB flush and then return before these functions do flush. Signed-off-by: Takuya Yoshikawa Signed-off-by: Marcelo Tosatti Signed

[PATCH 0/7] KVM fixes for 3.2.17

2012-05-18 Thread Marcelo Tosatti
): KVM: s390: do store status after handling STOP_ON_STOP bit Marcelo Tosatti (1): KVM: VMX: vmx_set_cr0 expects kvm->srcu locked Nadav Har'El (1): KVM: nVMX: Fix erroneous exception bitmap check Takuya Yoshikawa (1): KVM: mmu_notifier: Flush TLBs before releasing mmu_lock arch/ia64

Re: [v3.0.y 1/2] KVM: x86: extend "struct x86_emulate_ops" with "get_cpuid"

2012-03-23 Thread Marcelo Tosatti
ot;-opcode without changing the VM's context. > > [mtosatti: cleanup/beautify code] > > Signed-off-by: Stephan Baerwolf > Signed-off-by: Marcelo Tosatti > > (cherry-picked from commit bdb42f5afebe208eae90406959383856ae2caf2b upstream) > Signed-off-by: S

Re: [v3.0.y 2/2] KVM: x86: fix missing checks in syscall emulation

2012-03-23 Thread Marcelo Tosatti
have > like the CPUs physical counterparts. > > [mtosatti: cleanup/beautify code] > > Signed-off-by: Stephan Baerwolf > Signed-off-by: Marcelo Tosatti > > (backported from commit c2226fc9e87ba3da060e47333657cd6616652b84 upstream) > Signed-off-by: Stefan Bader >

Re: CVE-2012-0045 for 3.2.y, 3.0.y and 2.6.32.y (again)

2012-03-22 Thread Marcelo Tosatti
v3.0.y and v3.2.y patches are OK, i'll ACK individually once they're autotested. On Thu, Mar 22, 2012 at 09:50:40AM +0100, Stefan Bader wrote: > Resubmitting with more of the proper maintainers > subscribed (note that Marcelo is one of them)... > > --- > > The following patches fix a KVM guest

Re: [v2.6.32.y 2/2] KVM: x86: fix missing checks in syscall emulation

2012-03-22 Thread Marcelo Tosatti
have > like the CPUs physical counterparts. > > [mtosatti: cleanup/beautify code] > > Signed-off-by: Stephan Baerwolf > Signed-off-by: Marcelo Tosatti > > (backported from commit c2226fc9e87ba3da060e47333657cd6616652b84 upstream) > Signed-off-by: Stefan Bader