You probably want to implement them in hand-written assembly, because otherwise we'll get the same bad code generated by the same compiler.
Also, ARM calls do not save return address on stack, but store it in LR register - that's one less memory store on the fast path. It would force spill of LR in leaf functions, but I believe we already do this for fp-based stack unwind. On Mon, Mar 31, 2014 at 3:43 PM, Konstantin Serebryany <[email protected]> wrote: > On Mon, Mar 31, 2014 at 2:28 AM, Yuri Gribov <[email protected]> wrote: >> >> > We don't have any such plans, but patches are welcome. >> >> What would be the prerequisites for accepting this patch for upstream? > > None, just send a patch. >> >> >> > You will need a change in the run-time library and in both compilers. :( >> >> Yup. I wonder whether my employer will like the fact that I work on >> Clang though (we're not using it here). >> >> > You mean, kasan (Kernel-AddressSanitizer)? >> > kasan is just a prototype, it's easier to play with the prototype this >> > way. >> > Eventually it will have inlined checks. >> >> Ah, so out-of-line checking was done just because it was easier to >> implement? Not because you wanted to minimize kernel size? > > > Correct. Easier to implement and experiment with. > >> >> >> >> Memory savings would be quite significant which is important for >> >> mobile applications. >> > >> > You mean code size? (of course, it translates into memory usage) >> >> Yes. >> >> > I think that outlining the checks will cause dramatic slowdown >> > (instead of one load, you access memory 3 times: call >> > ... >> > ret >> >> True but branch predictor should be able to cope with these. It would >> be crucial to compile static implementation into every executable/DSO >> to avoid PLT call costs though. > > > That will add some more complexity to the build system. > E.g. __asan_read1&co will have to reside in a separate library. > >> >> >> There is also usual cost associated with saving the context >> (caller-saved regs, flags, etc.) but this could be minimized if we use >> custom ABI for checking builtins (like for arithmetic libgcc >> builtins). > > > --kcc > >> >> -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. > > > -- > 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. -- 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.
