1. 26 6月, 2018 1 次提交
  2. 24 6月, 2018 1 次提交
    • A
      efi/x86: Fix incorrect invocation of PciIo->Attributes() · 2e6eb40c
      Ard Biesheuvel 提交于
      The following commit:
      
        2c3625cb ("efi/x86: Fold __setup_efi_pci32() and __setup_efi_pci64() into one function")
      
      ... merged the two versions of __setup_efi_pciXX(), without taking into
      account that the 32-bit version used a rather dodgy trick to pass an
      immediate 0 constant as argument for a uint64_t parameter.
      
      The issue is caused by the fact that on x86, UEFI protocol method calls
      are redirected via struct efi_config::call(), which is a variadic function,
      and so the compiler has to infer the types of the parameters from the
      arguments rather than from the prototype.
      
      As the 32-bit x86 calling convention passes arguments via the stack,
      passing the unqualified constant 0 twice is the same as passing 0ULL,
      which is why the 32-bit code in __setup_efi_pci32() contained the
      following call:
      
        status = efi_early->call(pci->attributes, pci,
                                 EfiPciIoAttributeOperationGet, 0, 0,
                                 &attributes);
      
      to invoke this UEFI protocol method:
      
        typedef
        EFI_STATUS
        (EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) (
          IN  EFI_PCI_IO_PROTOCOL                     *This,
          IN  EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
          IN  UINT64                                  Attributes,
          OUT UINT64                                  *Result OPTIONAL
          );
      
      After the merge, we inadvertently ended up with this version for both
      32-bit and 64-bit builds, breaking the latter.
      
      So replace the two zeroes with the explicitly typed constant 0ULL,
      which works as expected on both 32-bit and 64-bit builds.
      
      Wilfried tested the 64-bit build, and I checked the generated assembly
      of a 32-bit build with and without this patch, and they are identical.
      Reported-by: NWilfried Klaebe <linux-kernel@lebenslange-mailadresse.de>
      Tested-by: NWilfried Klaebe <linux-kernel@lebenslange-mailadresse.de>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: hdegoede@redhat.com
      Cc: linux-efi@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      2e6eb40c
  3. 23 6月, 2018 6 次提交
  4. 22 6月, 2018 4 次提交
    • M
      kvm: vmx: Nested VM-entry prereqs for event inj. · 0447378a
      Marc Orr 提交于
      This patch extends the checks done prior to a nested VM entry.
      Specifically, it extends the check_vmentry_prereqs function with checks
      for fields relevant to the VM-entry event injection information, as
      described in the Intel SDM, volume 3.
      
      This patch is motivated by a syzkaller bug, where a bad VM-entry
      interruption information field is generated in the VMCS02, which causes
      the nested VM launch to fail. Then, KVM fails to resume L1.
      
      While KVM should be improved to correctly resume L1 execution after a
      failed nested launch, this change is justified because the existing code
      to resume L1 is flaky/ad-hoc and the test coverage for resuming L1 is
      sparse.
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: NMarc Orr <marcorr@google.com>
      [Removed comment whose parts were describing previous revisions and the
       rest was obvious from function/variable naming. - Radim]
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      0447378a
    • Z
      x86/microcode/intel: Fix memleak in save_microcode_patch() · 0218c766
      Zhenzhong Duan 提交于
      Free useless ucode_patch entry when it's replaced.
      
      [ bp: Drop the memfree_patch() two-liner. ]
      Signed-off-by: NZhenzhong Duan <zhenzhong.duan@oracle.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Srinivas REDDY Eeda <srinivas.eeda@oracle.com>
      Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default
      0218c766
    • T
      x86/mce: Fix incorrect "Machine check from unknown source" message · 40c36e27
      Tony Luck 提交于
      Some injection testing resulted in the following console log:
      
        mce: [Hardware Error]: CPU 22: Machine Check Exception: f Bank 1: bd80000000100134
        mce: [Hardware Error]: RIP 10:<ffffffffc05292dd> {pmem_do_bvec+0x11d/0x330 [nd_pmem]}
        mce: [Hardware Error]: TSC c51a63035d52 ADDR 3234bc4000 MISC 88
        mce: [Hardware Error]: PROCESSOR 0:50654 TIME 1526502199 SOCKET 0 APIC 38 microcode 2000043
        mce: [Hardware Error]: Run the above through 'mcelog --ascii'
        Kernel panic - not syncing: Machine check from unknown source
      
      This confused everybody because the first line quite clearly shows
      that we found a logged error in "Bank 1", while the last line says
      "unknown source".
      
      The problem is that the Linux code doesn't do the right thing
      for a local machine check that results in a fatal error.
      
      It turns out that we know very early in the handler whether the
      machine check is fatal. The call to mce_no_way_out() has checked
      all the banks for the CPU that took the local machine check. If
      it says we must crash, we can do so right away with the right
      messages.
      
      We do scan all the banks again. This means that we might initially
      not see a problem, but during the second scan find something fatal.
      If this happens we print a slightly different message (so I can
      see if it actually every happens).
      
      [ bp: Remove unneeded severity assignment. ]
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Cc: stable@vger.kernel.org # 4.2
      Link: http://lkml.kernel.org/r/52e049a497e86fd0b71c529651def8871c804df0.1527283897.git.tony.luck@intel.com
      40c36e27
    • B
      x86/mce: Do not overwrite MCi_STATUS in mce_no_way_out() · 1f74c8a6
      Borislav Petkov 提交于
      mce_no_way_out() does a quick check during #MC to see whether some of
      the MCEs logged would require the kernel to panic immediately. And it
      passes a struct mce where MCi_STATUS gets written.
      
      However, after having saved a valid status value, the next iteration
      of the loop which goes over the MCA banks on the CPU, overwrites the
      valid status value because we're using struct mce as storage instead of
      a temporary variable.
      
      Which leads to MCE records with an empty status value:
      
        mce: [Hardware Error]: CPU 0: Machine Check Exception: 6 Bank 0: 0000000000000000
        mce: [Hardware Error]: RIP 10:<ffffffffbd42fbd7> {trigger_mce+0x7/0x10}
      
      In order to prevent the loss of the status register value, return
      immediately when severity is a panic one so that we can panic
      immediately with the first fatal MCE logged. This is also the intention
      of this function and not to noodle over the banks while a fatal MCE is
      already logged.
      
      Tony: read the rest of the MCA bank to populate the struct mce fully.
      Suggested-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20180622095428.626-8-bp@alien8.de
      1f74c8a6
  5. 21 6月, 2018 13 次提交
  6. 20 6月, 2018 9 次提交
  7. 19 6月, 2018 6 次提交
    • Z
      arm64: make secondary_start_kernel() notrace · b154886f
      Zhizhou Zhang 提交于
      We can't call function trace hook before setup percpu offset.
      When entering secondary_start_kernel(), percpu offset has not
      been initialized.  So this lead hotplug malfunction.
      Here is the flow to reproduce this bug:
      
      echo 0 > /sys/devices/system/cpu/cpu1/online
      echo function > /sys/kernel/debug/tracing/current_tracer
      echo 1 > /sys/kernel/debug/tracing/tracing_on
      echo 1 > /sys/devices/system/cpu/cpu1/online
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Tested-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NZhizhou Zhang <zhizhouzhang@asrmicro.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      b154886f
    • M
      arm64: dma-mapping: clear buffers allocated with FORCE_CONTIGUOUS flag · dd65a941
      Marek Szyprowski 提交于
      dma_alloc_*() buffers might be exposed to userspace via mmap() call, so
      they should be cleared on allocation. In case of IOMMU-based dma-mapping
      implementation such buffer clearing was missing in the code path for
      DMA_ATTR_FORCE_CONTIGUOUS flag handling, because dma_alloc_from_contiguous()
      doesn't honor __GFP_ZERO flag. This patch fixes this issue. For more
      information on clearing buffers allocated by dma_alloc_* functions,
      see commit 6829e274 ("arm64: dma-mapping: always clear allocated
      buffers").
      
      Fixes: 44176bb3 ("arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to IOMMU")
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      dd65a941
    • M
      powerpc/64s: Fix build failures with CONFIG_NMI_IPI=n · e08ecba1
      Michael Ellerman 提交于
      I broke the build when CONFIG_NMI_IPI=n with my recent commit to add
      arch_trigger_cpumask_backtrace(), eg:
      
        stacktrace.c:(.text+0x1b0): undefined reference to `.smp_send_safe_nmi_ipi'
      
      We should rework the CONFIG symbols here in future to avoid these
      double barrelled ifdefs but for now they fix the build.
      
      Fixes: 5cc05910 ("powerpc/64s: Wire up arch_trigger_cpumask_backtrace()")
      Reported-by: NChristophe LEROY <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      e08ecba1
    • R
      xen: share start flags between PV and PVH · 1fe83888
      Roger Pau Monne 提交于
      Use a global variable to store the start flags for both PV and PVH.
      This allows the xen_initial_domain macro to work properly on PVH.
      
      Note that ARM is also switched to use the new variable.
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NRoger Pau Monné <roger.pau@citrix.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      1fe83888
    • N
      powerpc/64: hard disable irqs on the panic()ing CPU · 855b6232
      Nicholas Piggin 提交于
      Similar to previous patches, hard disable interrupts when a CPU is
      in panic. This reduces the chance the watchdog has to interfere with
      the panic, and avoids any other type of masked interrupt being
      executed when crashing which minimises the length of the crash path.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      855b6232
    • N
      powerpc: smp_send_stop do not offline stopped CPUs · de6e5d38
      Nicholas Piggin 提交于
      Marking CPUs stopped by smp_send_stop as offline can cause warnings
      due to cross-CPU wakeups. This trace was noticed on a busy system
      running a sysrq+c crash test, after the injected crash:
      
      WARNING: CPU: 51 PID: 1546 at kernel/sched/core.c:1179 set_task_cpu+0x22c/0x240
      CPU: 51 PID: 1546 Comm: kworker/u352:1 Tainted: G      D
      Workqueue: mlx5e mlx5e_update_stats_work [mlx5_core]
      [...]
      NIP [c00000000017c21c] set_task_cpu+0x22c/0x240
      LR [c00000000017d580] try_to_wake_up+0x230/0x720
      Call Trace:
      [c000000001017700] runqueues+0x0/0xb00 (unreliable)
      [c00000000017d580] try_to_wake_up+0x230/0x720
      [c00000000015a214] insert_work+0x104/0x140
      [c00000000015adb0] __queue_work+0x230/0x690
      [c000003fc5007910] [c00000000015b26c] queue_work_on+0x5c/0x90
      [c0080000135fc8f8] mlx5_cmd_exec+0x538/0xcb0 [mlx5_core]
      [c008000013608fd0] mlx5_core_access_reg+0x140/0x1d0 [mlx5_core]
      [c00800001362777c] mlx5e_update_pport_counters.constprop.59+0x6c/0x90 [mlx5_core]
      [c008000013628868] mlx5e_update_ndo_stats+0x28/0x90 [mlx5_core]
      [c008000013625558] mlx5e_update_stats_work+0x68/0xb0 [mlx5_core]
      [c00000000015bcec] process_one_work+0x1bc/0x5f0
      [c00000000015ecac] worker_thread+0xac/0x6b0
      [c000000000168338] kthread+0x168/0x1b0
      [c00000000000b628] ret_from_kernel_thread+0x5c/0xb4
      
      This happens because firstly the CPU is not really offline in the
      usual sense, processes and interrupts have not been migrated away.
      Secondly smp_send_stop does not happen atomically on all CPUs, so
      one CPU can have marked itself offline, while another CPU is still
      running processes or interrupts which can affect the first CPU.
      
      Fix this by just not marking the CPU as offline. It's more like
      frozen in time, so offline does not really reflect its state properly
      anyway. There should be nothing in the crash/panic path that walks
      online CPUs and synchronously waits for them, so this change should
      not introduce new hangs.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      de6e5d38