[PATCH] Add missing store in emission of asan_stack_free.

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Wed May 20 11:03:15 GMT 2020


Am 2020-05-19 um 21:05 schrieb Martin Liška:
> Hi.
> 
> We make direct emission for asan_emit_stack_protection for smaller stacks.
> That's fine but we're missing the piece that marks the stack as released
> and we run out of pre-allocated stacks. I also included some stack-related
> constants that were used in asan.c.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2020-05-19  Martin Liska  <mliska@suse.cz>
> 
>      PR sanitizer/94910
>      * asan.c (asan_emit_stack_protection): Emit
>      also **SavedFlagPtr(FakeStack) = 0 in order to release
>      a stack frame.
>      * asan.h (ASAN_MIN_STACK_FRAME_SIZE_LOG): New.
>      (ASAN_MAX_STACK_FRAME_SIZE_LOG): Likewise.
>      (ASAN_MIN_STACK_FRAME_SIZE): Likewise.
>      (ASAN_MAX_STACK_FRAME_SIZE): Likewise.
> ---
>   gcc/asan.c | 26 ++++++++++++++++++++++----
>   gcc/asan.h |  8 ++++++++
>   2 files changed, 30 insertions(+), 4 deletions(-)
> 
> 

 >-  if (asan_frame_size > 32 && asan_frame_size <= 65536 && pbase
 >+  if (asan_frame_size >= ASAN_MIN_STACK_FRAME_SIZE

Hi,

is the change from > to >= and from 32 to 64 for 
ASAN_MIN_STACK_FRAME_SIZE intentional? Just asking because it doesn't 
look obvious from Changelog or patch.
Also a few lines below the "5" in

   use_after_return_class = floor_log2 (asan_frame_size - 1) - 5;

looks like it may be related to ASAN_MIN_STACK_FRAME_SIZE_LOG.

regards,
Franz


More information about the Gcc-patches mailing list