On Thu, Jul 06, 2017 at 04:31:49PM +0300, Maxim Ostapenko wrote:
> Hi,
> 
> since kernel doesn't support __asan_alloca_poison and
> __asan_allocas_unpoison runtime calls so far, the allocas/VLAs sanitization
> patch (https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00258.html) will break
> KASan builds.
> So it was decided to introduce an option --param asan-instrument-allocas=0/1
> (on by default for userspace and off for kernel) to avoid the issue.
> 
> Tested on x86_64-unknown-linux-gnu, OK after
> https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00258.html will be applied?
> 
> -Maxim

> gcc/ChangeLog:
> 
> 2017-07-06  Maxim Ostapenko  <m.ostape...@samsung.com>
> 
>       * asan.h (asan_sanitize_allocas_p): Declare.
>       * asan.c (asan_sanitize_allocas_p): New function.
>       (handle_builtin_stack_restore): Bail out if !asan_sanitize_allocas_p.
>       (handle_builtin_alloca): Likewise.
>       * cfgexpand.c (expand_used_vars): Do not add allocas unpoisoning stuff
>       if !asan_sanitize_allocas_p.
>       * params.def (asan-instrument-allocas): Add new option.
>       * params.h (ASAN_PROTECT_ALLOCAS): Define.
>       * opts.c (common_handle_option): Disable allocas sanitization for
>       KASan by default.
> 
> gcc/testsuite/ChangeLog:
> 
> 2017-07-06  Maxim Ostapenko  <m.ostape...@samsung.com>
> 
>        c-c++-common/asan/kasan-alloca-1.c: New test.
>        c-c++-common/asan/kasan-alloca-2.c: Likewise.

Ok.
        Jakub

Reply via email to