On Tue, Sep 25, 2018 at 11:05:30AM +0200, Martin Liška wrote: > As requested in PR81715, GCC emits bigger middle redzones for small variables. > It's analyzed in following comment: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715#c28
First of all, does LLVM make the variable sized red zone size only for automatic variables, or also for global/local statics, or for alloca? Have you considered also making the red zones larger for very large variables? > For now I'm suggesting to shrink shadow memory for variables <= 16B to 32B > (including variable storage). > LLVM is more aggressive as they allocate just 16B of shadow memory for > variables <= 4B. That would > require bigger code refactoring in asan.c and I would like to avoid that. What exactly would need changing to support the 12-15 bytes long red zones for 4-1 bytes long automatic vars? Just asan_emit_stack_protection or something other? > + poly_uint64 size = stack_vars[i].size; > + /* For small variables shrink middle redzone (including > + * variable store) just to ASAN_RED_ZONE_SIZE. */ We don't use this comment style (* at start of comment continuation lines). Otherwise it looks reasonable, but I wouldn't stop here. Jakub