LLVM backend for 6502
Go to file
Chandler Carruth 0b8b3ba21e Harden the Unix signals code to be more async signal safe.
This is likely only the tip of the ice berg, but this particular bug
caused any double-free on a glibc system to turn into a deadlock! It is
not generally safe to either allocate or release heap memory from within
the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting
memory and causing the deadlock. What's worse, eraseFromDisk in PathV1
has lots of allocation and deallocation paths. We even passed 'true' in
a place that would have caused the *signal handler* to try to run the
'system' system call and shell out to 'rm -rf'. That was never going to
work...

This patch switches the file removal to use a vector of strings so that
the exact text needed for the 'unlink' system call can be stored there.
It switches the loop to be a boring indexed loop, and directly calls
unlink without looking at the error. It also works quite hard to ensure
that calling 'c_str()' is safe, by ensuring that the non-signal-handling
code path that manipulates the vector always leaves it in a state where
every element has already had 'c_str()' called at least once.

I dunno exactly how overkill this is, but it fixes the
deadlock-on-double free issue, and seems likely to prevent any other
issues from sneaking up.

Sorry for not having a test case, but I *really* don't know how to test
signal handling code easily....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158580 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-16 00:09:41 +00:00
autoconf Remove the PTX back-end and all of its artifacts (triple, etc.) 2012-05-24 21:38:21 +00:00
bindings
cmake cmake: Pass the -m32 flag to modules if LLVM_BUILD_32_BITS is enabled 2012-06-08 09:41:23 +00:00
docs [docs] Make it pretty. 2012-06-15 22:17:44 +00:00
examples Fix typos found by http://github.com/lyda/misspell-check 2012-06-02 10:20:22 +00:00
include Adding acessors to COFFObjectFile so that clients can get at the (non-generic) bits 2012-06-15 01:08:25 +00:00
lib Harden the Unix signals code to be more async signal safe. 2012-06-16 00:09:41 +00:00
projects Remove the PTX back-end and all of its artifacts (triple, etc.) 2012-05-24 21:38:21 +00:00
runtime Free the allocated filename. Found by clang static analyzer. 2012-06-15 09:11:47 +00:00
test Unit test for LSR kind=Special fix: r158536. 2012-06-15 22:46:31 +00:00
tools Remove assignments which aren't used afterwards. 2012-06-15 19:28:20 +00:00
unittests Round 2 of dead private variable removal. 2012-06-06 19:47:08 +00:00
utils Add two newlines in ParseSubtargetFeatures's debug output after the CPU is printed. 2012-06-12 04:21:36 +00:00
.gitignore
CMakeLists.txt Remove the PTX back-end and all of its artifacts (triple, etc.) 2012-05-24 21:38:21 +00:00
configure Remove the PTX back-end and all of its artifacts (triple, etc.) 2012-05-24 21:38:21 +00:00
CREDITS.TXT
LICENSE.TXT
llvm.spec.in
LLVMBuild.txt
Makefile
Makefile.common
Makefile.config.in
Makefile.rules
README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.

If you're writing a package for LLVM, see docs/Packaging.html for our
suggestions.