https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66514

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The thing is that if you poison at the end of destructor, you need to unpoison
it again somewhere, except for file scope variables that when they are
destructed supposedly can't be constructed again.
For automatic variables I guess it depends on whether at runtime
use-after-return is enabled or not (if it is enabled, then the variables are
allocated in a heap object that is completely poisoned afterwards anyway, so
that would work too.  But if use-after-return is disabled, they are allocated
in the normal stack frame and we'd need to unpoison those objects (together
with unpoisoning the guards around them).  And of course we'd need to ensure
the stack space is not reused for other variables.
Then there are objects constructed/destructed in heap space, those are
supposedly fine too, at least I hope a free poisons the memory.  But what about
objects destructed in e.g. mmap allocated area?  And finally objects placement
new constructed in some other variable, there we'd need to unpoison on the
first store to that area (or placement new construction).  That is very much
non-trivial though, at least in the asan framework.

Reply via email to