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 17/17] Enable __asan_loadN/__asan_storeN for KASan


On Thu, Oct 16, 2014 at 12:43:25PM +0400, Yury Gribov wrote:
> Not a backport, specifically enables said instructions in KASan.

> Instrument unaligned objects in KASan.
> 
> 2014-10-15  Yury Gribov  <y.gribov@samsung.com>
> 
> 	* asan.c (instrument_derefs): Enable unaligned path for KASan.
> 
> diff --git a/gcc/asan.c b/gcc/asan.c
> index b8fbed3..db4e3a0 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -1705,8 +1705,11 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
>      }
>  
>    size_in_bytes = int_size_in_bytes (type);
> -  if ((size_in_bytes & (size_in_bytes - 1)) != 0
> -      || (unsigned HOST_WIDE_INT) size_in_bytes - 1 >= 16)
> +  if (size_in_bytes <= 0)
> +    return;
> +  if ((flag_sanitize & SANITIZE_USER_ADDRESS) != 0
> +      && ((size_in_bytes & (size_in_bytes - 1)) != 0
> +	  || (unsigned HOST_WIDE_INT) size_in_bytes - 1 >= 16))
>      return;
>  
>    HOST_WIDE_INT bitsize, bitpos;

Ok.

	Jakub


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