[PATCH] D119482: [OpaquePtr][LLParser] Automatically detect opaque pointers in .ll files

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 16:03:24 PDT 2022


hctim added inline comments.


================
Comment at: llvm/lib/IR/LLVMContextImpl.cpp:51
+      Int16Ty(C, 16), Int32Ty(C, 32), Int64Ty(C, 64), Int128Ty(C, 128) {
+  if (OpaquePointersCL.getNumOccurrences()) {
+    OpaquePointers = OpaquePointersCL;
----------------
Hi, looks like this broke the ASan buildbot.

Help reproducing the bot can be found [here](https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild). The init-order-fiasco bug is copied below for your convenience.

```
--
********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: LLVM :: tools/llvm-stress/help.test (73153 of 82954)
******************** TEST 'LLVM :: tools/llvm-stress/help.test' FAILED ********************
Script:
--
: 'RUN: at line 1';   /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-stress --help | /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/tools/llvm-stress/help.test --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
--
Exit Code: 2
Command Output (stderr):
--
=================================================================
==53409==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x0000013b96a8 at pc 0x000000867d43 bp 0x7ffeb2c63cb0 sp 0x7ffeb2c63ca8
READ of size 2 at 0x0000013b96a8 thread T0
    #0 0x867d42 in getNumOccurrences /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/Support/CommandLine.h:395:49
    #1 0x867d42 in llvm::LLVMContextImpl::LLVMContextImpl(llvm::LLVMContext&) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/IR/LLVMContextImpl.cpp:51:24
    #2 0x85171e in llvm::LLVMContext::LLVMContext() /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/IR/LLVMContext.cpp:34:40
    #3 0x6c73bd in __cxx_global_var_init.12 /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp:72:20
    #4 0x6c73bd in _GLOBAL__sub_I_llvm_stress.cpp /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp
    #5 0xc025c4 in __libc_csu_init (/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-stress+0xc025c4)
    #6 0x7f634e91d029 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24029) (BuildId: 18b9a9a8c523e5cfe5b5d946d605d09242f09798)
    #7 0x5d8079 in _start (/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-stress+0x5d8079)
0x0000013b96a8 is located 8 bytes inside of global variable 'OpaquePointersCL' defined in '/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/IR/LLVMContextImpl.cpp:38:5' (0x13b96a0) of size 224
  registered at:
    #0 0x5efcb0 in __asan_register_globals.part.19 /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:359:3
    #1 0x88520e in asan.module_ctor LLVMContextImpl.cpp
    #2 0xc025c4 in __libc_csu_init (/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-stress+0xc025c4)
SUMMARY: AddressSanitizer: initialization-order-fiasco /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/Support/CommandLine.h:395:49 in getNumOccurrences
Shadow bytes around the buggy address:
  0x00008026f280: f6 f6 f6 f6 00 f9 f9 f9 00 f9 f9 f9 01 f9 f9 f9
  0x00008026f290: 01 f9 f9 f9 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f2a0: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f2b0: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f2c0: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
=>0x00008026f2d0: f6 f6 f6 f6 f6[f6]f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f2e0: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f2f0: f6 f6 f6 f6 00 00 f9 f9 00 00 f9 f9 00 00 f9 f9
  0x00008026f300: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f310: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
  0x00008026f320: f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6 f6
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==53409==ABORTING
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/tools/llvm-stress/help.test --check-prefix HELP --implicit-check-not={{[Oo]}}ptions:
--
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119482/new/

https://reviews.llvm.org/D119482



More information about the llvm-commits mailing list