On Tue, Oct 28, 2014 at 11:46:31AM +0300, Yury Gribov wrote:
> 2014-10-23 Yury Gribov <[email protected]>
>
> gcc/
> * asan.c (report_error_func): Add noabort path.
> (check_func): Ditto. Formatting.
> (asan_expand_check_ifn): Handle noabort path.
> * common.opt (flag_sanitize_recover): Add SANITIZE_KERNEL_ADDRESS
> to default value.
> * doc/invoke.texi (-fsanitize-recover=): Mention KASan.
> * opts.c (finish_options): Reword comment.
> * sanitizer.def: Add noabort ASan builtins.
>
> gcc/testsuite/
> * c-c++-common/asan/kasan-recover-1.c: New test.
> * c-c++-common/asan/kasan-recover-2.c: New test.
Are the __asan_{load,store,report}*_noabort entrypoints going to be added
into libasan too?
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -213,7 +213,7 @@ unsigned int flag_sanitize
>
> ; What sanitizers should recover from errors
> Variable
> -unsigned int flag_sanitize_recover = SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT
> +unsigned int flag_sanitize_recover = SANITIZE_UNDEFINED |
> SANITIZE_NONDEFAULT | SANITIZE_KERNEL_ADDRESS
I wonder whether we can break lines here, if e.g. \ at the end of line would
work. If not, it is ok this way.
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/asan/kasan-recover-1.c
> @@ -0,0 +1,12 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param
> asan-instrumentation-with-call-threshold=100 -save-temps" } */
Why -save-temps and cleanup-saved-temps? Do you for some reason want to
avoid integrated preprocessing? I mean, this is a dg-do compile test,
so for scanning assembly you don't really need -save-temps.
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/asan/kasan-recover-2.c
> @@ -0,0 +1,12 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address
> -save-temps" } */
Likewise.
> +
> +void
> +foo (int *p)
> +{
> + *p = 0;
> +}
> +
> +/* { dg-final { scan-assembler "__asan_store4_noabort" } } */
> +/* { dg-final { cleanup-saved-temps } } */
> +
Otherwise LGTM.
Jakub