This is an archive of the discontinued LLVM Phabricator instance.

[safestack] Add option for non-TLS unsafe stack pointer
ClosedPublic

Authored by mlemay-intel on Dec 19 2015, 8:37 PM.

Details

Reviewers
eugenis
Summary

This patch adds an option, -safe-stack-no-tls, for using normal
storage instead of thread-local storage for the unsafe stack pointer.
This can be useful when SafeStack is applied to an operating system
kernel.

Diff Detail

Event Timeline

mlemay-intel retitled this revision from to [safestack] Add option for non-TLS unsafe stack pointer.
mlemay-intel updated this object.
eugenis added inline comments.Dec 21 2015, 9:37 AM
lib/Transforms/Instrumentation/SafeStack.cpp
50

Could you invert the meaning of this option? Negative language makes the code less readable. I.e. make the option _enable_ TLS, with "true" as the default value.

Name the option UseTLS instead of NoTLS to improve the readability of the code that checks it.

eugenis accepted this revision.Dec 21 2015, 11:00 AM
eugenis edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 21 2015, 11:00 AM

I don't have commit access yet, so can you please commit this for me, @eugenis? Thank you.

eugenis requested changes to this revision.Dec 21 2015, 2:12 PM
eugenis edited edge metadata.

Yes.
But on the second thought, please add a test.

This revision now requires changes to proceed.Dec 21 2015, 2:12 PM
mlemay-intel edited edge metadata.

I added a test. I also revised the code to use an enumerated command line option instead of a simple Boolean, in case additional types of storage are necessary in the future.

mlemay-intel marked an inline comment as done.Dec 21 2015, 4:10 PM
eugenis accepted this revision.Dec 21 2015, 4:11 PM
eugenis edited edge metadata.
This revision is now accepted and ready to land.Dec 21 2015, 4:11 PM
eugenis closed this revision.Dec 21 2015, 4:16 PM

Landed as r256221.