1. 10 3月, 2020 2 次提交
  2. 29 2月, 2020 1 次提交
    • T
      x86/entry/32: Remove the 0/-1 distinction from exception entries · e441a2ae
      Thomas Gleixner 提交于
      Nothing cares about the -1 "mark as interrupt" in the errorcode of
      exception entries. It's only used to fill the error code when a signal is
      delivered, but this is already inconsistent vs. 64 bit as there all
      exceptions which do not have an error code set it to 0. So if 32 bit
      applications would care about this, then they would have noticed more than
      a decade ago.
      
      Just use 0 for all excpetions which do not have an errorcode consistently.
      
      This does neither break /proc/$PID/syscall because this interface examines
      the error code / syscall number which is on the stack and that is set to -1
      (no syscall) in common_exception unconditionally for all exceptions. The
      push in the entry stub is just there to fill the hardware error code slot
      on the stack for consistency of the stack layout.
      
      A transient observation of 0 is possible, but that's true for the other
      exceptions which use 0 already as well and that interface is an unreliable
      snapshot of dubious correctness anyway.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAlexandre Chartre <alexandre.chartre@oracle.com>
      Link: https://lkml.kernel.org/r/87mu94m7ky.fsf@nanos.tec.linutronix.de
      e441a2ae
  3. 27 2月, 2020 9 次提交
  4. 21 2月, 2020 1 次提交
    • K
      x86/xen: Distribute switch variables for initialization · 9038ec99
      Kees Cook 提交于
      Variables declared in a switch statement before any case statements
      cannot be automatically initialized with compiler instrumentation (as
      they are not part of any execution flow). With GCC's proposed automatic
      stack variable initialization feature, this triggers a warning (and they
      don't get initialized). Clang's automatic stack variable initialization
      (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
      doesn't initialize such variables[1]. Note that these warnings (or silent
      skipping) happen before the dead-store elimination optimization phase,
      so even when the automatic initializations are later elided in favor of
      direct initializations, the warnings remain.
      
      To avoid these problems, move such variables into the "case" where
      they're used or lift them up into the main function body.
      
      arch/x86/xen/enlighten_pv.c: In function ‘xen_write_msr_safe’:
      arch/x86/xen/enlighten_pv.c:904:12: warning: statement will never be executed [-Wswitch-unreachable]
        904 |   unsigned which;
            |            ^~~~~
      
      [1] https://bugs.llvm.org/show_bug.cgi?id=44916Signed-off-by: NKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/20200220062318.69299-1-keescook@chromium.orgReviewed-by: NJuergen Gross <jgross@suse.com>
      [boris: made @which an 'unsigned int']
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      9038ec99
  5. 20 2月, 2020 2 次提交
    • K
      x86/cpu/amd: Enable the fixed Instructions Retired counter IRPERF · 21b5ee59
      Kim Phillips 提交于
      Commit
      
        aaf24884 ("perf/x86/msr: Add AMD IRPERF (Instructions Retired)
      		  performance counter")
      
      added support for access to the free-running counter via 'perf -e
      msr/irperf/', but when exercised, it always returns a 0 count:
      
      BEFORE:
      
        $ perf stat -e instructions,msr/irperf/ true
      
         Performance counter stats for 'true':
      
                   624,833      instructions
                         0      msr/irperf/
      
      Simply set its enable bit - HWCR bit 30 - to make it start counting.
      
      Enablement is restricted to all machines advertising IRPERF capability,
      except those susceptible to an erratum that makes the IRPERF return
      bad values.
      
      That erratum occurs in Family 17h models 00-1fh [1], but not in F17h
      models 20h and above [2].
      
      AFTER (on a family 17h model 31h machine):
      
        $ perf stat -e instructions,msr/irperf/ true
      
         Performance counter stats for 'true':
      
                   621,690      instructions
                   622,490      msr/irperf/
      
      [1] Revision Guide for AMD Family 17h Models 00h-0Fh Processors
      [2] Revision Guide for AMD Family 17h Models 30h-3Fh Processors
      
      The revision guides are available from the bugzilla Link below.
      
       [ bp: Massage commit message. ]
      
      Fixes: aaf24884 ("perf/x86/msr: Add AMD IRPERF (Instructions Retired) performance counter")
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: stable@vger.kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537
      Link: http://lkml.kernel.org/r/20200214201805.13830-1-kim.phillips@amd.com
      21b5ee59
    • H
      x86/boot/compressed: Don't declare __force_order in kaslr_64.c · df6d4f9d
      H.J. Lu 提交于
      GCC 10 changed the default to -fno-common, which leads to
      
          LD      arch/x86/boot/compressed/vmlinux
        ld: arch/x86/boot/compressed/pgtable_64.o:(.bss+0x0): multiple definition of `__force_order'; \
          arch/x86/boot/compressed/kaslr_64.o:(.bss+0x0): first defined here
        make[2]: *** [arch/x86/boot/compressed/Makefile:119: arch/x86/boot/compressed/vmlinux] Error 1
      
      Since __force_order is already provided in pgtable_64.c, there is no
      need to declare __force_order in kaslr_64.c.
      Signed-off-by: NH.J. Lu <hjl.tools@gmail.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20200124181811.4780-1-hjl.tools@gmail.com
      df6d4f9d
  6. 14 2月, 2020 2 次提交
  7. 13 2月, 2020 7 次提交
  8. 12 2月, 2020 5 次提交
    • O
      KVM: x86: Deliver exception payload on KVM_GET_VCPU_EVENTS · a06230b6
      Oliver Upton 提交于
      KVM allows the deferral of exception payloads when a vCPU is in guest
      mode to allow the L1 hypervisor to intercept certain events (#PF, #DB)
      before register state has been modified. However, this behavior is
      incompatible with the KVM_{GET,SET}_VCPU_EVENTS ABI, as userspace
      expects register state to have been immediately modified. Userspace may
      opt-in for the payload deferral behavior with the
      KVM_CAP_EXCEPTION_PAYLOAD per-VM capability. As such,
      kvm_multiple_exception() will immediately manipulate guest registers if
      the capability hasn't been requested.
      
      Since the deferral is only necessary if a userspace ioctl were to be
      serviced at the same as a payload bearing exception is recognized, this
      behavior can be relaxed. Instead, opportunistically defer the payload
      from kvm_multiple_exception() and deliver the payload before completing
      a KVM_GET_VCPU_EVENTS ioctl.
      Signed-off-by: NOliver Upton <oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a06230b6
    • O
      KVM: nVMX: Handle pending #DB when injecting INIT VM-exit · 684c0422
      Oliver Upton 提交于
      SDM 27.3.4 states that the 'pending debug exceptions' VMCS field will
      be populated if a VM-exit caused by an INIT signal takes priority over a
      debug-trap. Emulate this behavior when synthesizing an INIT signal
      VM-exit into L1.
      
      Fixes: 4b9852f4 ("KVM: x86: Fix INIT signal handling in various CPU states")
      Signed-off-by: NOliver Upton <oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      684c0422
    • O
      KVM: x86: Mask off reserved bit from #DB exception payload · 307f1cfa
      Oliver Upton 提交于
      KVM defines the #DB payload as compatible with the 'pending debug
      exceptions' field under VMX, not DR6. Mask off bit 12 when applying the
      payload to DR6, as it is reserved on DR6 but not the 'pending debug
      exceptions' field.
      
      Fixes: f10c729f ("kvm: vmx: Defer setting of DR6 until #DB delivery")
      Signed-off-by: NOliver Upton <oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      307f1cfa
    • P
      KVM: x86: do not reset microcode version on INIT or RESET · bab0c318
      Paolo Bonzini 提交于
      Do not initialize the microcode version at RESET or INIT, only on vCPU
      creation.   Microcode updates are not lost during INIT, and exact
      behavior across a warm RESET is not specified by the architecture.
      
      Since we do not support a microcode update directly from the hypervisor,
      but only as a result of userspace setting the microcode version MSR,
      it's simpler for userspace if we do nothing in KVM and let userspace
      emulate behavior for RESET as it sees fit.
      
      Userspace can tie the fix to the availability of MSR_IA32_UCODE_REV in
      the list of emulated MSRs.
      Reported-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      bab0c318
    • A
      x86/ima: use correct identifier for SetupMode variable · ff5ac61e
      Ard Biesheuvel 提交于
      The IMA arch code attempts to inspect the "SetupMode" EFI variable
      by populating a variable called efi_SetupMode_name with the string
      "SecureBoot" and passing that to the EFI GetVariable service, which
      obviously does not yield the expected result.
      
      Given that the string is only referenced a single time, let's get
      rid of the intermediate variable, and pass the correct string as
      an immediate argument. While at it, do the same for "SecureBoot".
      
      Fixes: 399574c6 ("x86/ima: retry detecting secure boot mode")
      Fixes: 980ef4d2 ("x86/ima: check EFI SetupMode too")
      Cc: Matthew Garrett <mjg59@google.com>
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      Cc: stable@vger.kernel.org # v5.3
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      ff5ac61e
  9. 11 2月, 2020 5 次提交
  10. 08 2月, 2020 2 次提交
  11. 07 2月, 2020 1 次提交
    • T
      x86/apic: Mask IOAPIC entries when disabling the local APIC · 0f378d73
      Tony W Wang-oc 提交于
      When a system suspends, the local APIC is disabled in the suspend sequence,
      but the IOAPIC is left in the current state. This means unmasked interrupt
      lines stay unmasked. This is usually the case for IOAPIC pin 9 to which the
      ACPI interrupt is connected.
      
      That means that in suspended state the IOAPIC can respond to an external
      interrupt, e.g. the wakeup via keyboard/RTC/ACPI, but the interrupt message
      cannot be handled by the disabled local APIC. As a consequence the Remote
      IRR bit is set, but the local APIC does not send an EOI to acknowledge
      it. This causes the affected interrupt line to become stale and the stale
      Remote IRR bit will cause a hang when __synchronize_hardirq() is invoked
      for that interrupt line.
      
      To prevent this, mask all IOAPIC entries before disabling the local
      APIC. The resume code already has the unmask operation inside.
      
      [ tglx: Massaged changelog ]
      Signed-off-by: NTony W Wang-oc <TonyWWang-oc@zhaoxin.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lore.kernel.org/r/1579076539-7267-1-git-send-email-TonyWWang-oc@zhaoxin.com
      0f378d73
  12. 05 2月, 2020 3 次提交