Hello,

Thanks a lot for the reply.

I have total control over the loaded program:
- running code before startup is no problem
- reserving 1/8th the memory seems doable (I can change the linker script 
to split the memory regions)
- I do not use any malloc / free in my applications (new keyword only with 
specified custom allocators, or placement new)
- for error reporting, triggering a hardware breakpoint seems ok to me (I 
already do that for e.g. failing assert), so that I have full stack trace, 
etc. and I wouldn't use ASAN "unattended" (without debug probe attached)
- flash size should be ok, I see that more as a debug tool so I can remove 
parts of the application if needed to fit in flash (but on some project I 
wouldn't be able to test the full application, that's right)

I just checked asan.c and it's probably much much overkill to try to 
implement everything (and probably not possible with embedded contraints).

But looking at the ARM GCC compiler errors when I add the 
-fsanitize=address switch, it doesn't seem to call that much different 
methods:
- __asan_report_storeN
- __asan_report_loadN
- __asan_handle_no_return
- __asan_report_store_n
- __asan_report_load_n
- __asan_stack_malloc_N
- __asan_stack_free_N
- __asan_option_detect_stack_use_after_return
- __asan_after_dynamic_init
- __asan_before_dynamic_init

Maybe I could make good use of this automatic instrumentation to catch at 
least some bugs. 
Do you know where I could find the use and signature of these ?

Thomas.


On Tuesday, March 19, 2019 at 2:06:43 PM UTC+1, Thomas Legrand 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 ?
>
> 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 ? 
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to