This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Do not emit red stack zones for a fn with no_sanitize_address (PR sanitizer/69863)


On Thu, Feb 18, 2016 at 01:02:05PM +0100, Martin LiÅka wrote:
> gcc/ChangeLog:
> 
> 2016-02-18  Jakub Jelinek  <jakub@redhat.com>
> 	    Martin Liska  <mliska@suse.cz>
> 
> 	PR sanitizer/69863
> 	* cfgexpand.c (asan_sanitize_stack_p): New function.
> 	(partition_stack_vars): Use the function.
> 	(expand_stack_vars): Likewise.
> 	(defer_stack_allocation): Likewise.
> 	(expand_used_vars): Likewise.
> ---
>  gcc/cfgexpand.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
> index 4ac8421..d7cb896 100644
> --- a/gcc/cfgexpand.c
> +++ b/gcc/cfgexpand.c
> @@ -868,6 +868,18 @@ union_stack_vars (size_t a, size_t b)
>      }
>  }
>  
> +/* Return true if a current function should be annotated for ASAN stack

a/a/the/
s/annotated/instrumented/, perhaps better
/* Return true if the current function should have its stack frame
   protected by address sanitizer.  */

> +   protection.  */
> +
> +static inline bool
> +asan_sanitize_stack_p (void)
> +{
> +  return (flag_sanitize & SANITIZE_ADDRESS)
> +    && ASAN_STACK
> +    && !lookup_attribute ("no_sanitize_address",
> +			  DECL_ATTRIBUTES (current_function_decl));
> +}

Please fix up formatting here, the && should be aligned below flag_sanitize,
like:
  return ((flag_sanitize & SANITIZE_ADDRESS)
	  && ASAN_STACK
	  && !lookup_attribute ("no_sanitize_address",
				DECL_ATTRIBUTES (current_function_decl)));

Ok for trunk with those changes.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]