summaryrefslogtreecommitdiff
path: root/tests/stack_protector_test.cpp
AgeCommit message (Collapse)Author
2021-04-12Switch to libbase SilentDeathTest.Elliott Hughes
Bug: http://b/184955378 Test: treehugger Change-Id: Ie0849224074da92203340a741a86a24a4a3702c2
2019-03-12bionic tests: use GTEST_SKIP.Elliott Hughes
Also be a bit more to the point in our messages, focusing on "why" not "what". Test: ran tests Change-Id: I297806c7a102bd52602dcd2fcf7a2cd34aba3a11
2019-02-06Cleanup bionic tests with hwasan.Evgenii Stepanov
The tests were patched earlier to run with tagging heap allocator. This change enables hwasan code instrumentation in the tests themselves, and fixes the issues that arise, mainly in the code that: * compares addresses of unrelated stack variables * compares address of a stack variable with stack limits as found in /proc/self/maps * writes address of a stack variable to a hardware watchpoint register etc. Note that static tests are broken at the moment, like all static binaries. Dynamic tests pass 100% with this change. Bug: 114279110, 124007027 Test: SANITIZE_TARGET=hwaddress; run dynamic bionic tests Change-Id: I68b8df9dd3e30b47734ddc083811a75a7f27deaa
2018-08-02Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2016-03-09Improve and fix the stack-protector tests.Elliott Hughes
Bug: http://b/26888853 Change-Id: I505dbf7d5934f7247fb639f55dd6a9341df3947b
2015-04-03Fix bug for recursive/errorcheck mutex on 32-bit devices.Yabin Cui
Bug: 19216648 Change-Id: I3b43b2d18d25b9bde352da1e35f9568133dec7cf
2014-12-11make stack_protector_DeathTest work for gcc4.9Yabin Cui
Bug: 18721888 Change-Id: I5f0b5c84319f56dbc4efb88e9d828138944667ae
2014-11-06make all bionic death tests not dumpableYabin Cui
Bug: 18067305 Change-Id: Ia1ecacf47eddecc9bc58aaac779e0c218f463179
2014-02-06Make sure that the same tests are on all platforms.Christopher Ferris
In order to be able to generate a list of tests for cts, the same set of tests must exist across all platforms. This CL adds empty tests where a test was conditionally compiled out. This CL creates a single library libBionicTests that includes all of the tests found in bionic-unit-tests-static. Also fix a few missing include files in some test files. Tested by running and compiling the tests for every platform and verifying the same number of tests are on each platform. Change-Id: I9989d4bfebb0f9c409a0ce7e87169299eac605a2
2013-06-11fix unittests.Nick Kralevich
7e6ce1a3c52d8533fed92c143419fedb0c93988a fixed abort() to raise SIGABRT rather than causing SIGSEGV. However, the unittests were not updated. Fix unittests. Change-Id: I73db194127b9b9e9440358aa94273863765a736b
2013-02-14Fix the stack protector death test.Elliott Hughes
Now __stack_chk_fail calls abort(3) directly, we terminate with SIGSEGV rather than SIGABRT. (Because of the workaround for the debuggerd lossage in the abort(3) implementation, which was the motivation for switching __stack_chk_fail over to abort(3).) Also clarify the comment on the weird pthread death test, so it doesn't get copied and pasted onto real death tests. Change-Id: Ie832eaded61359c99e7a10db65e28f35e8f63eed
2013-02-14Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces.Elliott Hughes
Bug: 2487269 Change-Id: Iec5e470fc22cd9108404f634a9d4baa2c7b7f58f
2013-02-08Switch to using AT_RANDOM for the stack guards.Elliott Hughes
Bug: 7959813 Change-Id: I8db4b8912ba649bfe668c6f22aa44690ddd401a2
2013-01-16Revert "stack protector: use AT_RANDOM"Nick Kralevich
The AT_RANDOM changes broke setuid / setgid executables such as "ping". When the linker executes a setuid program, it cleans the environment, removing any invalid environment entries, and adding "NULL"s to the end of the environment array for each removed variable. Later on, we try to determine the location of the aux environment variable, and get tripped up by these extra NULLs. Reverting this patch will get setuid executables working again, but getauxval() is still broken for setuid programs because of this bug. This reverts commit e3a49a8661125f24aec8a1453e54b3b78005e21e. Change-Id: I05c58a896b1fe32cfb5d95d43b096045cda0aa4a
2013-01-16stack protector: use AT_RANDOMNick Kralevich
Populate the stack canaries from the kernel supplied AT_RANDOM value, which doesn't involve any system calls. This is slightly faster (6 fewer syscalls) and avoids unnecessarily reading /dev/urandom, which depletes entropy. Bug: 7959813 Change-Id: If2b43100a2a9929666df3de56b6139fed969e0f1
2013-01-11Add stack canaries / strcpy tests.Nick Kralevich
Add a test to ensure that stack canaries are working correctly. Since stack canaries aren't normally generated on non-string functions, we have to enable stack-protector-all. Add a test to ensure that an out of bounds strcpy generates a runtime failure. Change-Id: Id0d3e59fc4b9602da019e4d35c5c653e1a57fae4
2012-10-25Per-thread -fstack-protector guards for x86.Elliott Hughes
Based on a pair of patches from Intel: https://android-review.googlesource.com/#/c/43909/ https://android-review.googlesource.com/#/c/44903/ For x86, this patch supports _both_ the global that ARM/MIPS use and the per-thread TLS entry (%gs:20) that GCC uses by default. This lets us support binaries built with any x86 toolchain (right now, the NDK is emitting x86 code that uses the global). I've also extended the original tests to cover ARM/MIPS too, and be a little more thorough for x86. Change-Id: I02f279a80c6b626aecad449771dec91df235ad01