linux-stable/arch/x86
Linus Torvalds 1bfa8bc86c work around gcc bugs with 'asm goto' with outputs
commit 4356e9f841 upstream.

We've had issues with gcc and 'asm goto' before, and we created a
'asm_volatile_goto()' macro for that in the past: see commits
3f0116c323 ("compiler/gcc4: Add quirk for 'asm goto' miscompilation
bug") and a9f180345f ("compiler/gcc4: Make quirk for
asm_volatile_goto() unconditional").

Then, much later, we ended up removing the workaround in commit
43c249ea0b ("compiler-gcc.h: remove ancient workaround for gcc PR
58670") because we no longer supported building the kernel with the
affected gcc versions, but we left the macro uses around.

Now, Sean Christopherson reports a new version of a very similar
problem, which is fixed by re-applying that ancient workaround.  But the
problem in question is limited to only the 'asm goto with outputs'
cases, so instead of re-introducing the old workaround as-is, let's
rename and limit the workaround to just that much less common case.

It looks like there are at least two separate issues that all hit in
this area:

 (a) some versions of gcc don't mark the asm goto as 'volatile' when it
     has outputs:

        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98619
        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420

     which is easy to work around by just adding the 'volatile' by hand.

 (b) Internal compiler errors:

        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110422

     which are worked around by adding the extra empty 'asm' as a
     barrier, as in the original workaround.

but the problem Sean sees may be a third thing since it involves bad
code generation (not an ICE) even with the manually added 'volatile'.

but the same old workaround works for this case, even if this feels a
bit like voodoo programming and may only be hiding the issue.

Reported-and-tested-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/all/20240208220604.140859-1-seanjc@google.com/
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Uros Bizjak <ubizjak@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Andrew Pinski <quic_apinski@quicinc.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 09:51:20 +01:00
..
boot x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section 2024-02-16 19:14:22 +01:00
coco x86/tdx: Allow 32-bit emulation by default 2023-12-07 09:51:29 -08:00
configs hardening updates for v6.7-rc1 2023-10-30 19:09:55 -10:00
crypto crypto: x86/nhpoly1305 - implement ->digest 2023-10-20 13:39:25 +08:00
entry x86/entry: Do not allow external 0x80 interrupts 2023-12-07 09:51:29 -08:00
events perf/x86/intel/uncore: Fix NULL pointer dereference issue in upi_fill_topology() 2024-01-25 15:44:38 -08:00
hyperv hyperv-fixes for 6.7-rc3 2023-11-22 09:56:26 -08:00
ia32
include work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:51:20 +01:00
kernel x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel 2024-02-05 20:16:45 +00:00
kvm work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:51:20 +01:00
lib x86/lib: Revert to _ASM_EXTABLE_UA() for {get,put}_user() fixups 2024-02-16 19:14:28 +01:00
math-emu
mm 12 hotfixes. 2 are cc:stable and the remainder either address post-6.7 2024-01-05 13:46:18 -08:00
net bpf: Fix prog_array_map_poke_run map poke update 2023-12-06 22:40:16 +01:00
pci x86/pci: Reserve ECAM if BIOS didn't include it in PNP0C02 _CRS 2024-01-25 15:45:16 -08:00
platform x86/platform/uv: Annotate struct uv_rtc_timer_head with __counted_by 2023-09-24 12:02:58 +02:00
power
purgatory x86/purgatory: Remove LTO flags 2023-09-17 09:49:03 +02:00
ras
realmode
tools
um UML: remove unused cmd_vdso_install 2023-10-18 17:16:09 +09:00
video fbdev: Replace fb_pgprotect() with pgprot_framebuffer() 2023-10-12 09:20:46 +02:00
virt x86/virt/tdx: Make TDX_MODULE_CALL handle SEAMCALL #UD and #GP 2023-09-12 16:30:27 -07:00
xen xen: branch for v6.7-rc7 2023-12-22 08:37:48 -08:00
.gitignore
Kbuild
Kconfig kexec: fix KEXEC_FILE dependencies 2023-12-20 13:46:19 -08:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile Kbuild updates for v6.7 2023-11-04 08:07:19 -10:00
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00
Makefile.um
Makefile_32.cpu