[llvm-bugs] [Bug 36329] New: [X86_32] Miscompilation with __llvm_retpoline_push

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 9 13:51:16 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36329

            Bug ID: 36329
           Summary: [X86_32] Miscompilation with __llvm_retpoline_push
           Product: libraries
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: dwmw2 at infradead.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 19849
  --> https://bugs.llvm.org/attachment.cgi?id=19849&action=edit
Config file for kernel build

After a call via __llvm_retpoline_push, code in the calling function seems
confused about where %esp points.

Reproduced with llvm/clang master (r324745 / r324741 resp.) and also with 6.0
branch (r324726 / r324719 resp) with r326645 added to the latter.

To reproduce:

  git clone git://git.infradead.org/linux-retpoline.git
  cd linux-retpoline
  git checkout clang
  cp /where/you/downloaded/the/attached/config .config
  make CC=/where/is/your/clang bzImage
  qemu-system-i386  -display none -serial stdio -kernel arch/x86/boot/bzImage 
-append earlyprintk=ttyS0,keep

Observe the output from mp_register_ioapic():
[    0.000000] mp_register_ioapic, 0 fec00000 0 c1b31e88
[    0.000000] At line 412, gsi_base is 0
[    0.000000] At line 425, gsi_base is -1043707140
[    0.000000] At line 427, gsi_base is -1043707140

Between line 412 and 425, gsi_base got clobbered.

Now uncomment the CFLAGS_io_apic_b line in arch/x86/kernel/apic/Makefile and
repeat, to disable the retpoline. Observe the problem go away.

To eliminate the external thunks as a cause of this problem, also retest with
CFLAGS_io_apic_b.o += -mno-retpoline-external-thunk -mretpoline
The problem persists even when we let LLVM emit its own thunks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180209/93e32941/attachment-0001.html>


More information about the llvm-bugs mailing list