kernel_optimize_test/arch
Thadeu Lima de Souza Cascardo 545fc3524c x86/bugs: Do not enable IBPB at firmware entry when IBPB is not available
commit 571c30b1a88465a1c85a6f7762609939b9085a15 upstream.

Some cloud hypervisors do not provide IBPB on very recent CPU processors,
including AMD processors affected by Retbleed.

Using IBPB before firmware calls on such systems would cause a GPF at boot
like the one below. Do not enable such calls when IBPB support is not
present.

  EFI Variables Facility v0.08 2004-May-17
  general protection fault, maybe for address 0x1: 0000 [#1] PREEMPT SMP NOPTI
  CPU: 0 PID: 24 Comm: kworker/u2:1 Not tainted 5.19.0-rc8+ #7
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
  Workqueue: efi_rts_wq efi_call_rts
  RIP: 0010:efi_call_rts
  Code: e8 37 33 58 ff 41 bf 48 00 00 00 49 89 c0 44 89 f9 48 83 c8 01 4c 89 c2 48 c1 ea 20 66 90 b9 49 00 00 00 b8 01 00 00 00 31 d2 <0f> 30 e8 7b 9f 5d ff e8 f6 f8 ff ff 4c 89 f1 4c 89 ea 4c 89 e6 48
  RSP: 0018:ffffb373800d7e38 EFLAGS: 00010246
  RAX: 0000000000000001 RBX: 0000000000000006 RCX: 0000000000000049
  RDX: 0000000000000000 RSI: ffff94fbc19d8fe0 RDI: ffff94fbc1b2b300
  RBP: ffffb373800d7e70 R08: 0000000000000000 R09: 0000000000000000
  R10: 000000000000000b R11: 000000000000000b R12: ffffb3738001fd78
  R13: ffff94fbc2fcfc00 R14: ffffb3738001fd80 R15: 0000000000000048
  FS:  0000000000000000(0000) GS:ffff94fc3da00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: ffff94fc30201000 CR3: 000000006f610000 CR4: 00000000000406f0
  Call Trace:
   <TASK>
   ? __wake_up
   process_one_work
   worker_thread
   ? rescuer_thread
   kthread
   ? kthread_complete_and_exit
   ret_from_fork
   </TASK>
  Modules linked in:

Fixes: 28a99e95f55c ("x86/amd: Use IBPB for firmware calls")
Reported-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220728122602.2500509-1-cascardo@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-03 12:00:51 +02:00
..
alpha tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:19:28 +02:00
arc ARC: entry: fix syscall_trace_exit argument 2022-04-27 13:53:55 +02:00
arm ARM: 9216/1: Fix MAX_DMA_ADDRESS overflow 2022-08-03 12:00:50 +02:00
arm64 arm64: dts: qcom: msm8992-*: Fix vdd_lvs1_2-supply typo 2022-07-12 16:32:20 +02:00
c6x arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
csky csky: patch_text: Fixup last cpu should be master 2022-06-09 10:21:26 +02:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-17 11:02:28 +01:00
hexagon hexagon: clean up timer-regs.h 2021-11-26 10:39:19 +01:00
ia64 ia64: define get_cycles macro for arch-override 2022-05-30 09:33:40 +02:00
m68k Revert "m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-arch" 2022-07-29 17:19:09 +02:00
microblaze uaccess: fix nios2 and microblaze get_user_8() 2022-04-08 14:40:08 +02:00
mips MIPS: Remove repetitive increase irq_err_count 2022-06-29 08:59:48 +02:00
nds32 nds32: fix access_ok() checks in get/put_user 2022-03-28 09:57:10 +02:00
nios2 nios2: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:41 +02:00
openrisc openrisc: start CPU timer early in boot 2022-06-09 10:20:55 +02:00
parisc parisc: Enable ARCH_HAS_STRICT_MODULE_RWX 2022-06-29 08:59:53 +02:00
powerpc powerpc/powernv: delay rng platform device creation until later in boot 2022-07-12 16:32:19 +02:00
riscv riscv: add as-options for modules with assembly compontents 2022-07-29 17:19:06 +02:00
s390 s390/archrandom: prevent CPACF trng invocations in interrupt context 2022-08-03 12:00:43 +02:00
sh sh: convert nommu io{re,un}map() to static inline functions 2022-07-21 21:20:02 +02:00
sparc sparc: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:42 +02:00
um um: Add missing apply_returns() 2022-07-25 11:26:55 +02:00
x86 x86/bugs: Do not enable IBPB at firmware entry when IBPB is not available 2022-08-03 12:00:51 +02:00
xtensa xtensa: Fix refcount leak bug in time.c 2022-06-29 08:59:53 +02:00
.gitignore
Kconfig arch/cc: Introduce a function to check for confidential computing features 2021-11-18 14:04:32 +01:00