[PATCH] D46789: [StackProtector] Don't crash when passing post-SP IR back in

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 11 18:40:53 PDT 2018


loladiro created this revision.
loladiro added reviewers: echristo, timshen.
Herald added a reviewer: javed.absar.
Herald added a reviewer: javed.absar.

In julia, we use LLVM as a JIT compiler. A fairly common occurrence
is that we get an LLVM crash assertion in the backend and then extract
the problematic IR module from the core dump. However, this IR already
had the StackProtector pass run on it. Unfortunately, this means
that running llc on it will crash in ISel (because StackProtector
gets confused and assumes that the existence of the prologue means
that we will use SDag-based stack protection, but the necessary
intrinsic prototypes aren't actually defined). This is unfortunate,
because it also prevents using bugpoint on this IR without manually
stripping out the StackProtector artifacts first. This patch aims
to improve that situation by teaching StackProtector to recognize
whether a given prologue means that the SDag based stack protection
mechanism is available. If it is not, this patch does cause the
SP transformation to be applied twice, but that's a lot better
than crashing, because it often still allows the original bug
we're investigating to be reproduced, as well as allowing tools
like bugpoint to run properly.

I had to adjust one existing test. The reason for this is that
previously this test would trigger the SDAG-based stack-protector
despite not using llvm.stackguard. With the introduction of
the latter, this pattern is not actually generated by the
StackProtector pass anymore. For now I simply deleted the checks
for the precise generated instructions. Alternatively, it might
make sense to delete the test entirely, since the pattern it
tests for is no longer used.


Repository:
  rL LLVM

https://reviews.llvm.org/D46789

Files:
  include/llvm/CodeGen/StackProtector.h
  lib/CodeGen/StackProtector.cpp
  test/CodeGen/AArch64/stack-guard-remat-bitcast.ll
  test/CodeGen/X86/stack-protector-twice.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46789.146452.patch
Type: text/x-patch
Size: 6336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180512/ae2c706f/attachment.bin>


More information about the llvm-commits mailing list