This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC Asan instrumentation control
- From: Jakub Jelinek <jakub at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: Yury Gribov <y dot gribov at samsung dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Viacheslav Garbuzov <v dot garbuzov at samsung dot com>, Max Ostapenko <m dot ostapenko at partner dot samsung dot com>
- Date: Fri, 6 Dec 2013 16:16:04 +0100
- Subject: Re: RFC Asan instrumentation control
- Authentication-results: sourceware.org; auth=none
- References: <52A1B4F2 dot 8040105 at samsung dot com> <20131206120929 dot GJ892 at tucnak dot redhat dot com> <20131206123242 dot GA22156 at domone dot podge> <20131206123443 dot GK892 at tucnak dot redhat dot com> <20131206151031 dot GA23303 at domone dot podge>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Dec 06, 2013 at 04:10:31PM +0100, OndÅej BÃlka wrote:
> Currently this code with sanitize=address gets expanded
>
> int foo(char *x, char *y, int i)
> {
> x[i] = y[i];
> }
>
> to
>
> snip
> movq %rsi, %rax
> movq %rsi, %rdx
> shrq $3, %rax
> andl $7, %edx
> movzbl 2147450880(%rax), %eax
> cmpb %dl, %al
> jle .L18
> .L2:
>
> snip
>
> .L18:
> .cfi_restore_state
> testb %al, %al
> je .L2
> movq %rsi, %rdi
> call __asan_report_load1
>
> There is nothing imposible about disabling these checks. You just fill a
> page to make this check pass and use mmap to make entire shadow memory point
> to that page.
I don't think I understand you. __asan_report_* is a fatal error, the
program is terminated there. What is costly on the asan instrumentation is
exactly the >>, memory loads, extra comparisons, in non-buggy programs
you never enter the __asan_report_* calls.
Jakub