1. 01 5月, 2020 4 次提交
  2. 22 4月, 2020 8 次提交
  3. 21 4月, 2020 2 次提交
    • P
      KVM: PPC: Book3S HV: Handle non-present PTEs in page fault functions · ae49deda
      Paul Mackerras 提交于
      Since cd758a9b "KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot in HPT
      page fault handler", it's been possible in fairly rare circumstances to
      load a non-present PTE in kvmppc_book3s_hv_page_fault() when running a
      guest on a POWER8 host.
      
      Because that case wasn't checked for, we could misinterpret the non-present
      PTE as being a cache-inhibited PTE.  That could mismatch with the
      corresponding hash PTE, which would cause the function to fail with -EFAULT
      a little further down.  That would propagate up to the KVM_RUN ioctl()
      generally causing the KVM userspace (usually qemu) to fall over.
      
      This addresses the problem by catching that case and returning to the guest
      instead.
      
      For completeness, this fixes the radix page fault handler in the same
      way.  For radix this didn't cause any obvious misbehaviour, because we
      ended up putting the non-present PTE into the guest's partition-scoped
      page tables, leading immediately to another hypervisor data/instruction
      storage interrupt, which would go through the page fault path again
      and fix things up.
      
      Fixes: cd758a9b "KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot in HPT page fault handler"
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820402Reported-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Tested-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      ae49deda
    • J
      kvm: Disable objtool frame pointer checking for vmenter.S · 7f4b5cde
      Josh Poimboeuf 提交于
      Frame pointers are completely broken by vmenter.S because it clobbers
      RBP:
      
        arch/x86/kvm/svm/vmenter.o: warning: objtool: __svm_vcpu_run()+0xe4: BP used as a scratch register
      
      That's unavoidable, so just skip checking that file when frame pointers
      are configured in.
      
      On the other hand, ORC can handle that code just fine, so leave objtool
      enabled in the !FRAME_POINTER case.
      Reported-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Message-Id: <01fae42917bacad18be8d2cbc771353da6603473.1587398610.git.jpoimboe@redhat.com>
      Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
      Fixes: 199cd1d7 ("KVM: SVM: Split svm_vcpu_run inline assembly to separate file")
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7f4b5cde
  4. 20 4月, 2020 1 次提交
    • E
      KVM: s390: Fix PV check in deliverable_irqs() · d47c4c45
      Eric Farman 提交于
      The diag 0x44 handler, which handles a directed yield, goes into a
      a codepath that does a kvm_for_each_vcpu() and ultimately
      deliverable_irqs().  The new check for kvm_s390_pv_cpu_is_protected()
      contains an assertion that the vcpu->mutex is held, which isn't going
      to be the case in this scenario.
      
      The result is a plethora of these messages if the lock debugging
      is enabled, and thus an implication that we have a problem.
      
        WARNING: CPU: 9 PID: 16167 at arch/s390/kvm/kvm-s390.h:239 deliverable_irqs+0x1c6/0x1d0 [kvm]
        ...snip...
        Call Trace:
         [<000003ff80429bf2>] deliverable_irqs+0x1ca/0x1d0 [kvm]
        ([<000003ff80429b34>] deliverable_irqs+0x10c/0x1d0 [kvm])
         [<000003ff8042ba82>] kvm_s390_vcpu_has_irq+0x2a/0xa8 [kvm]
         [<000003ff804101e2>] kvm_arch_dy_runnable+0x22/0x38 [kvm]
         [<000003ff80410284>] kvm_vcpu_on_spin+0x8c/0x1d0 [kvm]
         [<000003ff80436888>] kvm_s390_handle_diag+0x3b0/0x768 [kvm]
         [<000003ff80425af4>] kvm_handle_sie_intercept+0x1cc/0xcd0 [kvm]
         [<000003ff80422bb0>] __vcpu_run+0x7b8/0xfd0 [kvm]
         [<000003ff80423de6>] kvm_arch_vcpu_ioctl_run+0xee/0x3e0 [kvm]
         [<000003ff8040ccd8>] kvm_vcpu_ioctl+0x2c8/0x8d0 [kvm]
         [<00000001504ced06>] ksys_ioctl+0xae/0xe8
         [<00000001504cedaa>] __s390x_sys_ioctl+0x2a/0x38
         [<0000000150cb9034>] system_call+0xd8/0x2d8
        2 locks held by CPU 2/KVM/16167:
         #0: 00000001951980c0 (&vcpu->mutex){+.+.}, at: kvm_vcpu_ioctl+0x90/0x8d0 [kvm]
         #1: 000000019599c0f0 (&kvm->srcu){....}, at: __vcpu_run+0x4bc/0xfd0 [kvm]
        Last Breaking-Event-Address:
         [<000003ff80429b34>] deliverable_irqs+0x10c/0x1d0 [kvm]
        irq event stamp: 11967
        hardirqs last  enabled at (11975): [<00000001502992f2>] console_unlock+0x4ca/0x650
        hardirqs last disabled at (11982): [<0000000150298ee8>] console_unlock+0xc0/0x650
        softirqs last  enabled at (7940): [<0000000150cba6ca>] __do_softirq+0x422/0x4d8
        softirqs last disabled at (7929): [<00000001501cd688>] do_softirq_own_stack+0x70/0x80
      
      Considering what's being done here, let's fix this by removing the
      mutex assertion rather than acquiring the mutex for every other vcpu.
      
      Fixes: 201ae986 ("KVM: s390: protvirt: Implement interrupt injection")
      Signed-off-by: NEric Farman <farman@linux.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Link: https://lore.kernel.org/r/20200415190353.63625-1-farman@linux.ibm.comSigned-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      d47c4c45
  5. 18 4月, 2020 3 次提交
  6. 17 4月, 2020 5 次提交
  7. 16 4月, 2020 6 次提交
  8. 15 4月, 2020 4 次提交
  9. 14 4月, 2020 7 次提交
    • J
      x86/microcode/AMD: Increase microcode PATCH_MAX_SIZE · bdf89df3
      John Allen 提交于
      Future AMD CPUs will have microcode patches that exceed the default 4K
      patch size. Raise our limit.
      Signed-off-by: NJohn Allen <john.allen@amd.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: stable@vger.kernel.org # v4.14..
      Link: https://lkml.kernel.org/r/20200409152931.GA685273@mojo.amd.com
      bdf89df3
    • S
      KVM: s390: Return last valid slot if approx index is out-of-bounds · 97daa028
      Sean Christopherson 提交于
      Return the index of the last valid slot from gfn_to_memslot_approx() if
      its binary search loop yielded an out-of-bounds index.  The index can
      be out-of-bounds if the specified gfn is less than the base of the
      lowest memslot (which is also the last valid memslot).
      
      Note, the sole caller, kvm_s390_get_cmma(), ensures used_slots is
      non-zero.
      
      Fixes: afdad616 ("KVM: s390: Fix storage attributes migration with memory slots")
      Cc: stable@vger.kernel.org # 4.19.x: 0774a964: KVM: Fix out of range accesses to memslots
      Cc: stable@vger.kernel.org # 4.19.x
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20200408064059.8957-3-sean.j.christopherson@intel.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      97daa028
    • U
      KVM: VMX: Enable machine check support for 32bit targets · fb56baae
      Uros Bizjak 提交于
      There is no reason to limit the use of do_machine_check
      to 64bit targets. MCE handling works for both target familes.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Sean Christopherson <sean.j.christopherson@intel.com>
      Cc: stable@vger.kernel.org
      Fixes: a0861c02 ("KVM: Add VT-x machine check support")
      Signed-off-by: NUros Bizjak <ubizjak@gmail.com>
      Message-Id: <20200414071414.45636-1-ubizjak@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      fb56baae
    • P
      KVM: SVM: move more vmentry code to assembly · f14eec0a
      Paolo Bonzini 提交于
      Manipulate IF around vmload/vmsave to remove the confusing usage of
      local_irq_enable where interrupts are actually disabled via GIF.
      And stuff the RSB immediately without waiting for a RET to avoid
      Spectre-v2 attacks.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f14eec0a
    • P
      KVM: SVM: fix compilation with modular PSP and non-modular KVM · 9ef1530c
      Paolo Bonzini 提交于
      Use svm_sev_enabled() in order to cull all calls to PSP code.  Otherwise,
      compilation fails with undefined symbols if the PSP device driver is compiled
      as a module and KVM is not.
      Reported-by: NUros Bizjak <ubizjak@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9ef1530c
    • A
      efi/x86: Revert struct layout change to fix kexec boot regression · a088b858
      Ard Biesheuvel 提交于
      Commit
      
        0a67361d ("efi/x86: Remove runtime table address from kexec EFI setup data")
      
      removed the code that retrieves the non-remapped UEFI runtime services
      pointer from the data structure provided by kexec, as it was never really
      needed on the kexec boot path: mapping the runtime services table at its
      non-remapped address is only needed when calling SetVirtualAddressMap(),
      which never happens during a kexec boot in the first place.
      
      However, dropping the 'runtime' member from struct efi_setup_data was a
      mistake. That struct is shared ABI between the kernel and the kexec tooling
      for x86, and so we cannot simply change its layout. So let's put back the
      removed field, but call it 'unused' to reflect the fact that we never look
      at its contents. While at it, add a comment to remind our future selves
      that the layout is external ABI.
      
      Fixes: 0a67361d ("efi/x86: Remove runtime table address from kexec EFI setup data")
      Reported-by: NTheodore Ts'o <tytso@mit.edu>
      Tested-by: NTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: NDave Young <dyoung@redhat.com>
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      a088b858
    • A
      efi/x86: Don't remap text<->rodata gap read-only for mixed mode · f6103162
      Ard Biesheuvel 提交于
      Commit
      
        d9e3d2c4 ("efi/x86: Don't map the entire kernel text RW for mixed mode")
      
      updated the code that creates the 1:1 memory mapping to use read-only
      attributes for the 1:1 alias of the kernel's text and rodata sections, to
      protect it from inadvertent modification. However, it failed to take into
      account that the unused gap between text and rodata is given to the page
      allocator for general use.
      
      If the vmap'ed stack happens to be allocated from this region, any by-ref
      output arguments passed to EFI runtime services that are allocated on the
      stack (such as the 'datasize' argument taken by GetVariable() when invoked
      from efivar_entry_size()) will be referenced via a read-only mapping,
      resulting in a page fault if the EFI code tries to write to it:
      
        BUG: unable to handle page fault for address: 00000000386aae88
        #PF: supervisor write access in kernel mode
        #PF: error_code(0x0003) - permissions violation
        PGD fd61063 P4D fd61063 PUD fd62063 PMD 386000e1
        Oops: 0003 [#1] SMP PTI
        CPU: 2 PID: 255 Comm: systemd-sysv-ge Not tainted 5.6.0-rc4-default+ #22
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
        RIP: 0008:0x3eaeed95
        Code: ...  <89> 03 be 05 00 00 80 a1 74 63 b1 3e 83 c0 48 e8 44 d2 ff ff eb 05
        RSP: 0018:000000000fd73fa0 EFLAGS: 00010002
        RAX: 0000000000000001 RBX: 00000000386aae88 RCX: 000000003e9f1120
        RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000001
        RBP: 000000000fd73fd8 R08: 00000000386aae88 R09: 0000000000000000
        R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000000
        R13: ffffc0f040220000 R14: 0000000000000000 R15: 0000000000000000
        FS:  00007f21160ac940(0000) GS:ffff9cf23d500000(0000) knlGS:0000000000000000
        CS:  0008 DS: 0018 ES: 0018 CR0: 0000000080050033
        CR2: 00000000386aae88 CR3: 000000000fd6c004 CR4: 00000000003606e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
        Modules linked in:
        CR2: 00000000386aae88
        ---[ end trace a8bfbd202e712834 ]---
      
      Let's fix this by remapping text and rodata individually, and leave the
      gaps mapped read-write.
      
      Fixes: d9e3d2c4 ("efi/x86: Don't map the entire kernel text RW for mixed mode")
      Reported-by: NJiri Slaby <jslaby@suse.cz>
      Tested-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200409130434.6736-10-ardb@kernel.org
      f6103162