Make red zone size more flexible for stack variables (PR sanitizer/81715).
authorMartin Liska <mliska@suse.cz>
Fri, 30 Nov 2018 14:25:15 +0000 (15:25 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 30 Nov 2018 14:25:15 +0000 (14:25 +0000)
commit6e644a50045f8032b6d6ff19eb70d8b33dfc4dae
treeb6ab18da4eaeb67ce5e78a93ed2b4b84bfa0b637
parentb49f1a7e7c85add83637cf7df46b8fc9b5b299e9
Make red zone size more flexible for stack variables (PR sanitizer/81715).

2018-11-30  Martin Liska  <mliska@suse.cz>

PR sanitizer/81715
* asan.c (asan_shadow_cst): Remove, partially transform
into flush_redzone_payload.
(RZ_BUFFER_SIZE): New.
(struct asan_redzone_buffer): New.
(asan_redzone_buffer::emit_redzone_byte): Likewise.
(asan_redzone_buffer::flush_redzone_payload): Likewise.
(asan_redzone_buffer::flush_if_full): Likewise.
(asan_emit_stack_protection): Use asan_redzone_buffer class
that is responsible for proper aligned stores and flushing
of shadow memory payload.
* asan.h (ASAN_MIN_RED_ZONE_SIZE): New.
(asan_var_and_redzone_size): Likewise.
* cfgexpand.c (expand_stack_vars): Use smaller alignment
(ASAN_MIN_RED_ZONE_SIZE) in order to make shadow memory
for automatic variables more compact.
2018-11-30  Martin Liska  <mliska@suse.cz>

PR sanitizer/81715
* c-c++-common/asan/asan-stack-small.c: New test.

From-SVN: r266664
gcc/ChangeLog
gcc/asan.c
gcc/asan.h
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/asan/asan-stack-small.c [new file with mode: 0644]