On Mon, Oct 30, 2017 at 01:12:47PM +0300, Maxim Ostapenko wrote:
> I've caught the same error on my Arndale board. The issue seems to be quite
> obvious: after merge, ASan requires globals array to be aligned by shadow
> granularity.
> This trivial patch seems to fix the issue. Could you check it on your setup?

Indeed, it now wants to poison the arrays after the registration is over.

> 2017-10-30  Maxim Ostapenko  <m.ostape...@samsung.com>
> 
>       * asan.c (asan_finish_file): Align asan globals array by shadow
>       granularity.

Ok, thanks.

BTW, we should investigate the 
__asan_register_elf_globals/__asan_unregister_elf_globals
and whether it is something we should start using too.

> diff --git a/gcc/asan.c b/gcc/asan.c
> index 302ac4f..d5128aa 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -2942,6 +2942,9 @@ asan_finish_file (void)
>        TREE_CONSTANT (ctor) = 1;
>        TREE_STATIC (ctor) = 1;
>        DECL_INITIAL (var) = ctor;
> +      SET_DECL_ALIGN (var, MAX (DECL_ALIGN (var),
> +                             ASAN_SHADOW_GRANULARITY * BITS_PER_UNIT));
> +
>        varpool_node::finalize_decl (var);
>  
>        tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);


        Jakub

Reply via email to