On Fri, Jun 9, 2017 at 5:51 AM, steven shi <[email protected]> wrote:
> Hi Yuri,
> I'm trying to use the Kasan -fasan-shadow-offset option to work around the
> Asan fixed shadow offset issue in gcc. I see you enabled it with this patch
> https://patchwork.ozlabs.org/patch/402873/. If it works, I will replace the
> Asan with Kasan in my firmware.

Hi Steven,

Note that this flag only allows you to set fixed offset (in contrast,
dynamic offset allows the selection to be done at runtime). This may
or may not be enough for your case.

> I have two questions about Kasan:
> 1. Besides the different run-time libraries for OS kernel and application,
> is there other difference between Kasan and Asan, especially in the
> instrumentation part?

The one (and AFAIR only) change is that KAsan enables
-fsanitize-recover=address by default (so it calls callbacks like
__asan_report_storeX_noabort rather than __asan_report_storeX).

> 2. I need to disable Kasan and -fasan-shadow-offset when compile my
> instrumentation library (e.g. __asan_store8). How to force to
> override/disable the -fasan-shadow-offset option if I have enabled it in
> parent compile options?  Now,  I enable the -fno-sanitize=address
> -fsanitize=kernel-address -fasan-shadow-offset=0x12345678 in parent compile
> options for all modules, and add the -fno-sanitize=all to disable them in
> instrumentation library. But the instrumentation library compile fail with
> "cc1: error: -fasan-shadow-offset should only be used with
> -fsanitize=kernel-address". How could I disable the
> -fsanitize=kernel-address and -fasan-shadow-offset options together?

I believe the best approach is simply to not enable Asan flags in
instrumentation library. I.e. have CFLAGS_NO_ASAN and use that in
instrumentation lib. BTW you don't need -fsanitize=address if you
enabled -fsanitize=kernel-address.

-Y

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to