public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/66514] UBSAN: Add -fsanitize=lifetime Date: Tue, 16 Jun 2015 08:32:00 -0000 [thread overview] Message-ID: <bug-66514-4-8aGqwuhmwr@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-66514-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2015-06-16 8:32 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-11 15:59 [Bug sanitizer/66514] New: " marxin at gcc dot gnu.org 2015-06-12 9:33 ` [Bug sanitizer/66514] " jakub at gcc dot gnu.org 2015-06-15 8:56 ` y.gribov at samsung dot com 2015-06-15 11:29 ` marxin at gcc dot gnu.org 2015-06-16 8:32 ` jakub at gcc dot gnu.org [this message] 2015-06-16 9:15 ` marxin at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66514-4-8aGqwuhmwr@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).