summaryrefslogtreecommitdiff
path: root/tests/stack_protector_test_helper.cpp
AgeCommit message (Collapse)Author
2020-01-14stack_protector_DeathTest: work w/ local reorderSteven Moreland
Before, the helper method for this test had two local variables: char buf[128]; volatile char* p; Then the test wrote zeros into the buffer and one past the buffer end. This relied on the fact that the compiler constructed the stack frame with 'p' first and then the buffer (and also optimized away the 'size' variable). However, some compiler options (namely -ftrivial-auto-var-init=pattern) result in the stack frame being reordered so that 'p' is actually after buf, and the test cannot pass. Fixes: 132780819 Test: bionic-unit-tests-static (w/ w/o flag) Change-Id: Icc87c02add211c2afb7c96ae22701ec27990364c
2019-01-01Fix modify_stack_protector flakeRyan Prichard
The previous test would fail to crash if the first byte of the canary was already NUL (1 of 256 runs assuming uniform canary distribution). Bug: http://b/121156651 Test: bionic unit tests
2016-04-01Remove a workaround from stack_protector_test that's not needed in master.Elliott Hughes
The compiler in master doesn't leave a gap between the buffer and the stack guard canary. Bug: http://b/27815668 Change-Id: Iae6681683881055c2719d661a2179f5305c23135
2016-04-01Fix the stack-protector test for x86/x86-64.Elliott Hughes
Built for fugu this was working fine, but built for generic x86/x86-64 the compiler was (a) optimizing out all the stack writes and (b) inserting enough padding on x86-64 for the canary to be safely out of the way. While here, let's tighten up this test so we test that it's sufficient to only overwrite the buffer by one byte... (cherry-pick of 6f90c1ac59eb4e7811b7b0e408615049c935c0a9.) Bug: http://b/27815668 Change-Id: I80a646de4b30fd5c78df20fdaa7e3eb163585caf
2016-03-09Improve and fix the stack-protector tests.Elliott Hughes
Bug: http://b/26888853 Change-Id: I505dbf7d5934f7247fb639f55dd6a9341df3947b