On Tue, Mar 19, 2019 at 2:06 PM Thomas Legrand <
otat...@gmail.com> wrote:
>
> Hello,
>
>
>
> I’m totally new to ASAN, I’m using latest GCC ARM compiler for embedded projects.
>
> I was wondering if someone already tried to use ASAN on embedded platforms like Cortex-M ?
No idea, but at least it's not officially supported.
> I tried adding “-fsanitize=address” to my compile/link command line and it compiled fine but failed at linking because of missing functions (__asan_*).
>
>
>
> Is it “doable” to implement these ?
It's probably doable, but depends on how much control over the
standard library and the loaded program you have on the target
platform.
You'll need to implement an ASan runtime library that at least:
- kicks in early (preferably before any of the instrumented code is
executed) and reserves 1/8 of the memory for ASan shadow (you'll need
to look at asan.c in GCC to find out the exact addresses);
- wraps malloc() and free() in order to unwind and store the stack
and unpoison/poison shadow for the memory region;
- implements the error reporting functions. Sending data to a PC
sounds more feasible, as you probably don't have any debug info on the
target chip.
I don't know though, how much memory your platform has. As written
above, ASan takes 1/8 for the shadow, plus some unpredictable amount
of memory for the redzones (which have to be added to every
allocation), plus some tunable amount for the quarantine (for
simplicity I suggest you don't implement it at first). ASan also adds
quite a bit of boilerplate to the code, so some programs may stop
fitting into the flash memory.
> I guess there are 2 options, do checks on the target itself (but what is the required RAM/FLASH/CPU footprint ?) and trigger e.g. a breakpoint on error, or transfer data to a PC for calculations (but what would be the required bandwidth ?) but that would require developing a dedicated GUI/app.
>
>
>
> Any advice ?
>
>
>
> Thomas.
>
> --
> 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
address-saniti...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg