]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Oct 2019 08:02:57 +0000 (10:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Oct 2019 08:02:57 +0000 (10:02 +0200)
added patches:
fuse-fix-missing-unlock_page-in-fuse_writepage.patch
kvm-x86-always-stop-emulation-on-page-fault.patch
kvm-x86-manually-calculate-reserved-bits-when-loading-pdptrs.patch
kvm-x86-set-ctxt-have_exception-in-x86_decode_insn.patch
parisc-disable-hp-hsc-pci-cards-to-prevent-kernel-crash.patch

queue-4.4/fuse-fix-missing-unlock_page-in-fuse_writepage.patch [new file with mode: 0644]
queue-4.4/kvm-x86-always-stop-emulation-on-page-fault.patch [new file with mode: 0644]
queue-4.4/kvm-x86-manually-calculate-reserved-bits-when-loading-pdptrs.patch [new file with mode: 0644]
queue-4.4/kvm-x86-set-ctxt-have_exception-in-x86_decode_insn.patch [new file with mode: 0644]
queue-4.4/parisc-disable-hp-hsc-pci-cards-to-prevent-kernel-crash.patch [new file with mode: 0644]
queue-4.4/printk-do-not-lose-last-line-in-kmsg-buffer-dump.patch
queue-4.4/series

diff --git a/queue-4.4/fuse-fix-missing-unlock_page-in-fuse_writepage.patch b/queue-4.4/fuse-fix-missing-unlock_page-in-fuse_writepage.patch
new file mode 100644 (file)
index 0000000..d084877
--- /dev/null
@@ -0,0 +1,32 @@
+From d5880c7a8620290a6c90ced7a0e8bd0ad9419601 Mon Sep 17 00:00:00 2001
+From: Vasily Averin <vvs@virtuozzo.com>
+Date: Fri, 13 Sep 2019 18:17:11 +0300
+Subject: fuse: fix missing unlock_page in fuse_writepage()
+
+From: Vasily Averin <vvs@virtuozzo.com>
+
+commit d5880c7a8620290a6c90ced7a0e8bd0ad9419601 upstream.
+
+unlock_page() was missing in case of an already in-flight write against the
+same page.
+
+Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
+Fixes: ff17be086477 ("fuse: writepage: skip already in flight")
+Cc: <stable@vger.kernel.org> # v3.13
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/fuse/file.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/fuse/file.c
++++ b/fs/fuse/file.c
+@@ -1706,6 +1706,7 @@ static int fuse_writepage(struct page *p
+               WARN_ON(wbc->sync_mode == WB_SYNC_ALL);
+               redirty_page_for_writepage(wbc, page);
++              unlock_page(page);
+               return 0;
+       }
diff --git a/queue-4.4/kvm-x86-always-stop-emulation-on-page-fault.patch b/queue-4.4/kvm-x86-always-stop-emulation-on-page-fault.patch
new file mode 100644 (file)
index 0000000..f23e258
--- /dev/null
@@ -0,0 +1,52 @@
+From 8530a79c5a9f4e29e6ffb35ec1a79d81f4968ec8 Mon Sep 17 00:00:00 2001
+From: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
+Date: Tue, 27 Aug 2019 13:07:09 +0000
+Subject: KVM: x86: always stop emulation on page fault
+
+From: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
+
+commit 8530a79c5a9f4e29e6ffb35ec1a79d81f4968ec8 upstream.
+
+inject_emulated_exception() returns true if and only if nested page
+fault happens. However, page fault can come from guest page tables
+walk, either nested or not nested. In both cases we should stop an
+attempt to read under RIP and give guest to step over its own page
+fault handler.
+
+This is also visible when an emulated instruction causes a #GP fault
+and the VMware backdoor is enabled.  To handle the VMware backdoor,
+KVM intercepts #GP faults; with only the next patch applied,
+x86_emulate_instruction() injects a #GP but returns EMULATE_FAIL
+instead of EMULATE_DONE.   EMULATE_FAIL causes handle_exception_nmi()
+(or gp_interception() for SVM) to re-inject the original #GP because it
+thinks emulation failed due to a non-VMware opcode.  This patch prevents
+the issue as x86_emulate_instruction() will return EMULATE_DONE after
+injecting the #GP.
+
+Fixes: 6ea6e84309ca ("KVM: x86: inject exceptions produced by x86_decode_insn")
+Cc: stable@vger.kernel.org
+Cc: Denis Lunev <den@virtuozzo.com>
+Cc: Roman Kagan <rkagan@virtuozzo.com>
+Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
+Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/x86.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -5486,8 +5486,10 @@ int x86_emulate_instruction(struct kvm_v
+                       if (reexecute_instruction(vcpu, cr2, write_fault_to_spt,
+                                               emulation_type))
+                               return EMULATE_DONE;
+-                      if (ctxt->have_exception && inject_emulated_exception(vcpu))
++                      if (ctxt->have_exception) {
++                              inject_emulated_exception(vcpu);
+                               return EMULATE_DONE;
++                      }
+                       if (emulation_type & EMULTYPE_SKIP)
+                               return EMULATE_FAIL;
+                       return handle_emulation_failure(vcpu);
diff --git a/queue-4.4/kvm-x86-manually-calculate-reserved-bits-when-loading-pdptrs.patch b/queue-4.4/kvm-x86-manually-calculate-reserved-bits-when-loading-pdptrs.patch
new file mode 100644 (file)
index 0000000..c83c5e3
--- /dev/null
@@ -0,0 +1,75 @@
+From 16cfacc8085782dab8e365979356ce1ca87fd6cc Mon Sep 17 00:00:00 2001
+From: Sean Christopherson <sean.j.christopherson@intel.com>
+Date: Tue, 3 Sep 2019 16:36:45 -0700
+Subject: KVM: x86: Manually calculate reserved bits when loading PDPTRS
+
+From: Sean Christopherson <sean.j.christopherson@intel.com>
+
+commit 16cfacc8085782dab8e365979356ce1ca87fd6cc upstream.
+
+Manually generate the PDPTR reserved bit mask when explicitly loading
+PDPTRs.  The reserved bits that are being tracked by the MMU reflect the
+current paging mode, which is unlikely to be PAE paging in the vast
+majority of flows that use load_pdptrs(), e.g. CR0 and CR4 emulation,
+__set_sregs(), etc...  This can cause KVM to incorrectly signal a bad
+PDPTR, or more likely, miss a reserved bit check and subsequently fail
+a VM-Enter due to a bad VMCS.GUEST_PDPTR.
+
+Add a one off helper to generate the reserved bits instead of sharing
+code across the MMU's calculations and the PDPTR emulation.  The PDPTR
+reserved bits are basically set in stone, and pushing a helper into
+the MMU's calculation adds unnecessary complexity without improving
+readability.
+
+Oppurtunistically fix/update the comment for load_pdptrs().
+
+Note, the buggy commit also introduced a deliberate functional change,
+"Also remove bit 5-6 from rsvd_bits_mask per latest SDM.", which was
+effectively (and correctly) reverted by commit cd9ae5fe47df ("KVM: x86:
+Fix page-tables reserved bits").  A bit of SDM archaeology shows that
+the SDM from late 2008 had a bug (likely a copy+paste error) where it
+listed bits 6:5 as AVL and A for PDPTEs used for 4k entries but reserved
+for 2mb entries.  I.e. the SDM contradicted itself, and bits 6:5 are and
+always have been reserved.
+
+Fixes: 20c466b56168d ("KVM: Use rsvd_bits_mask in load_pdptrs()")
+Cc: stable@vger.kernel.org
+Cc: Nadav Amit <nadav.amit@gmail.com>
+Reported-by: Doug Reiland <doug.reiland@intel.com>
+Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
+Reviewed-by: Peter Xu <peterx@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/x86.c |   11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -523,8 +523,14 @@ static int kvm_read_nested_guest_page(st
+                                      data, offset, len, access);
+ }
++static inline u64 pdptr_rsvd_bits(struct kvm_vcpu *vcpu)
++{
++      return rsvd_bits(cpuid_maxphyaddr(vcpu), 63) | rsvd_bits(5, 8) |
++             rsvd_bits(1, 2);
++}
++
+ /*
+- * Load the pae pdptrs.  Return true is they are all valid.
++ * Load the pae pdptrs.  Return 1 if they are all valid, 0 otherwise.
+  */
+ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
+ {
+@@ -543,8 +549,7 @@ int load_pdptrs(struct kvm_vcpu *vcpu, s
+       }
+       for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
+               if (is_present_gpte(pdpte[i]) &&
+-                  (pdpte[i] &
+-                   vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
++                  (pdpte[i] & pdptr_rsvd_bits(vcpu))) {
+                       ret = 0;
+                       goto out;
+               }
diff --git a/queue-4.4/kvm-x86-set-ctxt-have_exception-in-x86_decode_insn.patch b/queue-4.4/kvm-x86-set-ctxt-have_exception-in-x86_decode_insn.patch
new file mode 100644 (file)
index 0000000..5e1b02f
--- /dev/null
@@ -0,0 +1,53 @@
+From c8848cee74ff05638e913582a476bde879c968ad Mon Sep 17 00:00:00 2001
+From: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
+Date: Tue, 27 Aug 2019 13:07:08 +0000
+Subject: KVM: x86: set ctxt->have_exception in x86_decode_insn()
+
+From: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
+
+commit c8848cee74ff05638e913582a476bde879c968ad upstream.
+
+x86_emulate_instruction() takes into account ctxt->have_exception flag
+during instruction decoding, but in practice this flag is never set in
+x86_decode_insn().
+
+Fixes: 6ea6e84309ca ("KVM: x86: inject exceptions produced by x86_decode_insn")
+Cc: stable@vger.kernel.org
+Cc: Denis Lunev <den@virtuozzo.com>
+Cc: Roman Kagan <rkagan@virtuozzo.com>
+Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
+Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/emulate.c |    2 ++
+ arch/x86/kvm/x86.c     |    6 ++++++
+ 2 files changed, 8 insertions(+)
+
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -5245,6 +5245,8 @@ done_prefixes:
+                                       ctxt->memopp->addr.mem.ea + ctxt->_eip);
+ done:
++      if (rc == X86EMUL_PROPAGATE_FAULT)
++              ctxt->have_exception = true;
+       return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;
+ }
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -5487,6 +5487,12 @@ int x86_emulate_instruction(struct kvm_v
+                                               emulation_type))
+                               return EMULATE_DONE;
+                       if (ctxt->have_exception) {
++                              /*
++                               * #UD should result in just EMULATION_FAILED, and trap-like
++                               * exception should not be encountered during decode.
++                               */
++                              WARN_ON_ONCE(ctxt->exception.vector == UD_VECTOR ||
++                                           exception_type(ctxt->exception.vector) == EXCPT_TRAP);
+                               inject_emulated_exception(vcpu);
+                               return EMULATE_DONE;
+                       }
diff --git a/queue-4.4/parisc-disable-hp-hsc-pci-cards-to-prevent-kernel-crash.patch b/queue-4.4/parisc-disable-hp-hsc-pci-cards-to-prevent-kernel-crash.patch
new file mode 100644 (file)
index 0000000..b0e7471
--- /dev/null
@@ -0,0 +1,73 @@
+From 5fa1659105fac63e0f3c199b476025c2e04111ce Mon Sep 17 00:00:00 2001
+From: Helge Deller <deller@gmx.de>
+Date: Thu, 5 Sep 2019 16:44:17 +0200
+Subject: parisc: Disable HP HSC-PCI Cards to prevent kernel crash
+
+From: Helge Deller <deller@gmx.de>
+
+commit 5fa1659105fac63e0f3c199b476025c2e04111ce upstream.
+
+The HP Dino PCI controller chip can be used in two variants: as on-board
+controller (e.g. in B160L), or on an Add-On card ("Card-Mode") to bridge
+PCI components to systems without a PCI bus, e.g. to a HSC/GSC bus.  One
+such Add-On card is the HP HSC-PCI Card which has one or more DEC Tulip
+PCI NIC chips connected to the on-card Dino PCI controller.
+
+Dino in Card-Mode has a big disadvantage: All PCI memory accesses need
+to go through the DINO_MEM_DATA register, so Linux drivers will not be
+able to use the ioremap() function. Without ioremap() many drivers will
+not work, one example is the tulip driver which then simply crashes the
+kernel if it tries to access the ports on the HP HSC card.
+
+This patch disables the HP HSC card if it finds one, and as such
+fixes the kernel crash on a HP D350/2 machine.
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Noticed-by: Phil Scarr <phil.scarr@pm.me>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/parisc/dino.c |   24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/drivers/parisc/dino.c
++++ b/drivers/parisc/dino.c
+@@ -160,6 +160,15 @@ struct dino_device
+       (struct dino_device *)__pdata; })
++/* Check if PCI device is behind a Card-mode Dino. */
++static int pci_dev_is_behind_card_dino(struct pci_dev *dev)
++{
++      struct dino_device *dino_dev;
++
++      dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge));
++      return is_card_dino(&dino_dev->hba.dev->id);
++}
++
+ /*
+  * Dino Configuration Space Accessor Functions
+  */
+@@ -442,6 +451,21 @@ static void quirk_cirrus_cardbus(struct
+ }
+ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6832, quirk_cirrus_cardbus );
++#ifdef CONFIG_TULIP
++static void pci_fixup_tulip(struct pci_dev *dev)
++{
++      if (!pci_dev_is_behind_card_dino(dev))
++              return;
++      if (!(pci_resource_flags(dev, 1) & IORESOURCE_MEM))
++              return;
++      pr_warn("%s: HP HSC-PCI Cards with card-mode Dino not yet supported.\n",
++              pci_name(dev));
++      /* Disable this card by zeroing the PCI resources */
++      memset(&dev->resource[0], 0, sizeof(dev->resource[0]));
++      memset(&dev->resource[1], 0, sizeof(dev->resource[1]));
++}
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_DEC, PCI_ANY_ID, pci_fixup_tulip);
++#endif /* CONFIG_TULIP */
+ static void __init
+ dino_bios_init(void)
index 24ad7f381c985d24b06ba8f48e714bd196bbf9dd..974f43f186a6316813289b6f42b623b3b5c7447d 100644 (file)
@@ -53,14 +53,12 @@ Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
 Signed-off-by: Petr Mladek <pmladek@suse.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- kernel/printk/printk.c | 2 +-
+ kernel/printk/printk.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
-index dd689ab228065..5a1b2a914b4e5 100644
 --- a/kernel/printk/printk.c
 +++ b/kernel/printk/printk.c
-@@ -3048,7 +3048,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
+@@ -3048,7 +3048,7 @@ bool kmsg_dump_get_buffer(struct kmsg_du
        seq = dumper->cur_seq;
        idx = dumper->cur_idx;
        prev = 0;
@@ -69,6 +67,3 @@ index dd689ab228065..5a1b2a914b4e5 100644
                struct printk_log *msg = log_from_idx(idx);
  
                l -= msg_print_text(msg, prev, true, NULL, 0);
--- 
-2.20.1
-
index 348a675176b3136241b47cbc70bbd207876b229f..98a0105c9adb52cd9c3d06340c47586205541a47 100644 (file)
@@ -76,3 +76,8 @@ media-omap3isp-set-device-on-omap3isp-subdevs.patch
 alsa-firewire-tascam-handle-error-code-when-getting-current-source-of-clock.patch
 alsa-firewire-tascam-check-intermediate-state-of-clock-status-and-retry.patch
 printk-do-not-lose-last-line-in-kmsg-buffer-dump.patch
+fuse-fix-missing-unlock_page-in-fuse_writepage.patch
+parisc-disable-hp-hsc-pci-cards-to-prevent-kernel-crash.patch
+kvm-x86-always-stop-emulation-on-page-fault.patch
+kvm-x86-set-ctxt-have_exception-in-x86_decode_insn.patch
+kvm-x86-manually-calculate-reserved-bits-when-loading-pdptrs.patch