This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 17/17] Enable __asan_loadN/__asan_storeN for KASan
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Yury Gribov <y dot gribov at samsung dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Dmitry Vyukov <dvyukov at google dot com>, Konstantin Khlebnikov <k dot khlebnikov at samsung dot com>, Andrey Ryabinin <a dot ryabinin at samsung dot com>, Viacheslav Garbuzov <v dot garbuzov at samsung dot com>
- Date: Thu, 16 Oct 2014 10:55:05 +0200
- Subject: Re: [PATCH 17/17] Enable __asan_loadN/__asan_storeN for KASan
- Authentication-results: sourceware.org; auth=none
- References: <543F831B dot 4090502 at samsung dot com> <543F852D dot 3000906 at samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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