llvm-project/llvm/test/MC/COFF
Tim Besard c71d77876f [MC] Avoid UAF in WinCOFFObjectWriter with weak symbols.
When using weak symbols, the WinCOFFObjectWriter keeps a list (`WeakDefaults`)
that's used to make names unique. This list should be reset when the object
writer is reset, because otherwise reuse of the object writer can result in
freed symbols being accessed. With some added output, this becomes clear when
using `llc` in `--run-twice` mode:

```
$ ./llc --compile-twice -mtriple=x86_64-pc-win32 trivial.ll -filetype=obj

DefineSymbol::WeakDefaults
 - .weak.foo.default
 - .weak.bar.default

DefineSymbol::WeakDefaults
 - .weak.foo.default
 - áÑJij⌂  p§┼Ø┐☺
 - .debug_macinfo.dw
 - .weak.bar.default
```

This does not seem to leak into the output object file though, so I couldn't
come up with a test. I added one that just does `--run-twice` (and verified
that it does access freed memory), which should result in detecting the
invalid memory accesses when running under ASAN.

Observed in a Julia PR where we started using weak symbols:
https://github.com/JuliaLang/julia/pull/45649

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D129840
2022-07-16 13:24:08 +03:00
..
ARM
addrsig.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
alias.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
align-nops.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
assoc-private.s
assoc-undef.s
bad-expr.s
basic-coff-64.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
basic-coff.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
bigobj.py [test][MC] Use %python in llvm/test/MC/COFF/bigobj.py 2020-10-07 14:03:28 -04:00
bss-text.s
bss.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
bss_section.ll
cfi-sections.s
cgprofile.ll [CodeGen] emit CG profile for COFF object file 2020-09-29 12:03:30 -07:00
cgprofile.s [COFF][CG Profile] set undefined symbol to external 2020-09-29 09:49:51 -07:00
comm-align.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
comm.ll
comm.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
const-gv-with-rel-init.ll
cross-section-relative-err.s [AArch64][X86] Allow 64-bit label differences lower to IMAGE_REL_*_REL32 2021-06-21 14:32:25 -07:00
cross-section-relative.ll
cross-section-relative.s [AArch64][X86] Allow 64-bit label differences lower to IMAGE_REL_*_REL32 2021-06-21 14:32:25 -07:00
cv-compiler-info-clamp.ll [CodeView] Clamp Frontend version 2021-12-28 15:22:18 -08:00
cv-compiler-info.ll Reland - [CodeView] Emit S_OBJNAME record 2021-12-21 19:02:14 -05:00
cv-def-range-align.s
cv-def-range-errors.s
cv-def-range-gap.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
cv-def-range.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
cv-empty-file-table.s
cv-empty-linetable.s
cv-errors.s
cv-fpo-csrs.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
cv-fpo-errors.s [MC] Change "unexpected tokens" to "expected newline" and remove unneeded "in .xxx directive" 2021-06-02 16:08:05 -07:00
cv-fpo-realign.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
cv-fpo-setframe.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
cv-inline-linetable-infloop.s [CodeView] Fix inline sites that are missing code offsets. 2020-12-07 13:01:53 -08:00
cv-inline-linetable-unlikely.s
cv-inline-linetable-unreachable.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
cv-inline-linetable.s
cv-loc-cross-section.s
cv-loc-unreachable-2.s [CodeView] Fix inline sites that are missing code offsets. 2020-12-07 13:01:53 -08:00
cv-loc-unreachable.s [CodeView] Fix inline sites that are missing code offsets. 2020-12-07 13:01:53 -08:00
cv-loc.s
cv-string.s
diff.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
directive-section-characteristics.ll [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
dwarf64-err.s
early-dce.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
eh-frame.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
feat00.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
file.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
global_ctors_dtors.ll
initialised-data.ll
invalid-def.s
invalid-endef.s
invalid-scl-range.s
invalid-scl.s
invalid-type-range.s
invalid-type.s
ir-to-imgrel.ll
label-undefined.s
linker-options.ll
linkonce-invalid.s
linkonce.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
lit.local.cfg [test][MC] Rehabilitate llvm/test/MC/COFF/bigobj.py 2020-09-22 14:23:32 -04:00
lset0.s
module-asm.ll [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
offset.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
pr23025.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
pr28462.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
rdata.ll
relax-reloc.s
relocation-imgrel.s
safeseh.s
secidx.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
secrel-variant.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
secrel32-undef.s
secrel32.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
section-comdat-conflict.s
section-comdat-conflict2.s
section-comdat.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
section-invalid-flags.s
section-name-encoding.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
section-passthru-flags.s
section.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
seh-align1.s [Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol 2021-09-14 11:05:37 +03:00
seh-align2.s [Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol 2021-09-14 11:05:37 +03:00
seh-align3.s [Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol 2021-09-14 11:05:37 +03:00
seh-linkonce.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
seh-section-2.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
seh-section.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
seh-stackalloc-zero.s
seh.s [Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol 2021-09-14 11:05:37 +03:00
simple-fixups.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
stdin.s
switch-relocations.ll
symbol-alias.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
symbol-fragment-offset-64.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
symbol-fragment-offset.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
symidx.s
temporary-alias.s
timestamp.s [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
tricky-names.ll [llvm-readobj] Update tests because of changes in llvm-readobj behavior 2020-07-20 10:39:04 +01:00
unsupported-relocations.s
weak-alias-labels.s [COFF] Aliases resolve directly to defined external targets 2020-09-28 16:12:45 -04:00
weak-alias-local.s
weak-comdat.s [MC] [COFF] Make sure that weak external symbols are undefined symbols 2020-07-24 22:15:08 +03:00
weak-name.s
weak-uaf.ll [MC] Avoid UAF in WinCOFFObjectWriter with weak symbols. 2022-07-16 13:24:08 +03:00
weak-val.s
weak.s [COFF] Aliases resolve directly to defined external targets 2020-09-28 16:12:45 -04:00