linux-stable/arch/um/include/asm
Linus Torvalds 4356e9f841 work around gcc bugs with 'asm goto' with outputs
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>
2024-02-09 15:57:48 -08:00
..
fpu um: enable the use of optimized xor routines in UML 2021-06-17 22:01:26 +02:00
archrandom.h random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
asm-prototypes.h
cache.h
cacheflush.h um: implement flush_cache_vmap/flush_cache_vunmap 2021-06-17 22:04:40 +02:00
common.lds.S UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
cpufeature.h work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
delay.h um: fix ndelay/udelay defines 2021-12-21 21:13:43 +01:00
dma.h
fixmap.h highmem: Get rid of kmap_types.h 2020-11-06 23:14:58 +01:00
futex.h um: add a UML specific futex implementation 2021-06-17 22:01:45 +02:00
hardirq.h um/irqstat: Get rid of the duplicated declarations 2020-11-23 10:31:05 +01:00
io.h um: add PCI over virtio emulation driver 2021-06-17 21:45:43 +02:00
irq.h um: line: Use separate IRQs per line 2022-05-27 09:03:41 +02:00
irqflags.h um: rename set_signals() to um_set_signals() 2021-12-21 21:13:44 +01:00
kasan.h UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
Kbuild um: Use asm-generic/dma-mapping.h 2022-05-27 09:00:45 +02:00
kvm_para.h
mmu.h um: mmu: remove stub_pages 2024-01-04 21:37:08 +01:00
mmu_context.h um: remove process stub VMA 2021-02-12 21:37:38 +01:00
msi.h um: add PCI over virtio emulation driver 2021-06-17 21:45:43 +02:00
page.h mm, arch: add generic implementation of pfn_valid() for FLATMEM 2023-02-09 16:51:41 -08:00
pci.h PCI/MSI: Get rid of PCI_MSI_IRQ_DOMAIN 2022-11-17 15:15:19 +01:00
pgalloc.h um: convert {pmd, pte}_free_tlb() to use ptdescs 2023-08-21 13:37:58 -07:00
pgtable-2level.h mm: define default value for FIRST_USER_ADDRESS 2021-07-01 11:06:02 -07:00
pgtable-3level.h x86_64: Remove pointless set_64bit() usage 2022-12-15 10:37:27 -08:00
pgtable.h Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
processor-generic.h um: Drop support for hosts without SYSEMU_SINGLESTEP support 2024-01-04 23:29:11 +01:00
ptrace-generic.h um: Implement copy_thread_tls 2020-01-07 13:31:29 +01:00
sections.h
setup.h
smp.h
stacktrace.h
syscall-generic.h arch: remove unused function syscall_set_arguments() 2021-09-14 16:06:20 +02:00
sysrq.h
thread_info.h ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP 2022-05-11 14:33:33 -05:00
timex.h um: use fallback for random_get_entropy() instead of zero 2022-05-13 23:59:23 +02:00
tlb.h um: implement flush_cache_vmap/flush_cache_vunmap 2021-06-17 22:04:40 +02:00
tlbflush.h um: Add SPDX headers for files in arch/um/include 2019-09-15 21:37:17 +02:00
uaccess.h uaccess: generalize access_ok() 2022-02-25 09:36:05 +01:00
unwind.h
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00
vmlinux.lds.h
xor.h um: Remove straying parenthesis 2022-07-17 23:24:20 +02:00