public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Konstantin Serebryany <konstantin.s.serebryany@gmail.com>
To: Evgeniy Stepanov <eugeni.stepanov@gmail.com>
Cc: Peter Bergner <bergner@vnet.ibm.com>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Richard Henderson <rth@redhat.com>,
		Dmitry Vyukov <dvyukov@google.com>,
	Alexey Samsonov <samsonov@google.com>,
		Alexander Potapenko <glider@google.com>
Subject: Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
Date: Thu, 22 Nov 2012 17:36:00 -0000	[thread overview]
Message-ID: <CAGQ9bdy1g9Qo6AS6wxQSrTQYi_+bf5YXKwXWip7r8jahkQR79A@mail.gmail.com> (raw)
In-Reply-To: <CABMLtri5JXvyNqrzGC9mgzfWJZJRk4v+dDUuCJcngWUJg5VOpQ@mail.gmail.com>

On Thu, Nov 22, 2012 at 12:38 PM, Evgeniy Stepanov
<eugeni.stepanov@gmail.com> wrote:
> Yes, it has 3 asan-rtl frames on top. I'm not sure why this does not
> happen on ppc.

Different inlining inside run-time.
I still prefer a simple PopFrames to anything else, I am sure we can
make it reliable.
the asan run-time should always be build with optimizations on and we
can force or (better) forbid inlining for any function.

--kcc

>
>     #0 0x40122cdb in __asan::GetStackTrace(__sanitizer::StackTrace*,
> unsigned long, unsigned long, unsigned long)
>     #1 0x40125167 in __asan_report_error
>     #2 0x40125af3 in __asan_report_load1
>
>
> On Thu, Nov 22, 2012 at 12:10 AM, Evgeniy Stepanov
> <eugeni.stepanov@gmail.com> wrote:
>> I'm looking into the empty stack issue, at this point it looks like a weird
>> linker bug. But its completely orthogonal to this discussion.
>>
>> I recall that the stack trace of the offending memory access has in fact
>> three extra frames on top. I'll verify tomorrow. If so, FP/SP matching
>> solution is preferable.
>>
>> On Nov 21, 2012 9:08 PM, "Peter Bergner" <bergner@vnet.ibm.com> wrote:
>>>
>>> On Wed, 2012-11-21 at 20:22 +0400, Konstantin Serebryany wrote:
>>> > On Wed, Nov 21, 2012 at 8:16 PM, Peter Bergner <bergner@vnet.ibm.com>
>>> > wrote:
>>> > > On Wed, 2012-11-21 at 13:46 +0400, Evgeniy Stepanov wrote:
>>> > >> Matching FP or SP also sounds good, and perhaps more reliable than
>>> > >> just popping 2 frames from the top of the stack.
>>> > >
>>> > > Agreed.  Can you try my second patch that searches for the frame
>>> > > address we want our backtrace to start with and see if that works
>>> > > for ARM?  The nice thing about that patch is that we won't have
>>> > > to play any games with forcing or disabling inlining of any of
>>> > > the ASAN functions which me might have to do if we always pop
>>> > > 2 frames off the stack.  It would also be tolerant of adding
>>> > > any number of new function calls in between the current two
>>> > > ASAN function at the top of the backtrace.
>>> > >
>>> > > http://gcc.gnu.org/ml/gcc-patches/2012-11/msg01711.html
>>> > >
>>> > > Bah, ignore that first diff of the LAST_UPDATED file. :(
>>> >
>>> > I'd actually prefer to keep the current code that pops two frames
>>> > (if it works for you)
>>>
>>> Well it does work for me, since I wrote it. :)  That being said, the
>>> change where I always pop two frames off of the backtrace was more of
>>> a proof of concept that if I can remove those ASAN functions from the
>>> backtrace, do we pass the test case in the testsuite.  It did, but I
>>> have to admit that code is extremely fragile.  It is dependent not
>>> only on the inlining heuristics of one compiler, but of two compilers!
>>> Not to mention people building debugable compilers with -O0 -fno-inline,
>>> etc. etc.  We'd also have to make sure no one in the future adds any
>>> ASAN function calls in between the report function and the GetBackTrace
>>> calls.  It just seems like there are so many things that could go wrong,
>>> that something is bound to.
>>>
>>>
>>> > Evgeniy seems to know how to fix the ARM case.
>>>
>>> His fix was to do:
>>>
>>>  void StackTrace::PopStackFrames(uptr count) {
>>> -  CHECK(size > count);
>>> +  CHECK(size >= count);
>>>    size -= count;
>>>    for (uptr i = 0; i < size; i++) {
>>>      trace[i] = trace[i + count];
>>>
>>> Basically, that is allowing for us to pop off all of the frames from
>>> the backtrace leaving an empty backtrace.  That can't be helpful in
>>> tracking down the address violation, can it?  With my patch above,
>>> either we find the frame we want to start our backtrace with, or
>>> it returns the entire backtrace, ASAN functions and all.  Isn't that
>>> better from a diagnostic point of view?
>>>
>>> That being said, I'd still like to hear from Evgeniy whether my
>>> patch above helps ARM or not.
>>>
>>> Peter
>>>
>>>
>>>
>>

  reply	other threads:[~2012-11-22 17:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 23:08 Peter Bergner
2012-11-16 23:48 ` Konstantin Serebryany
     [not found]   ` <CACT4Y+YzjEMeo0ZaFUcaiO4QNAJ-EhfAO+zeh0XXYaT70-sdvA@mail.gmail.com>
2012-11-19 14:24     ` Peter Bergner
2012-11-19 20:07   ` Peter Bergner
2012-11-20  7:08     ` Konstantin Serebryany
2012-11-20 13:41       ` Peter Bergner
2012-11-20 13:53         ` Konstantin Serebryany
     [not found]           ` <CABMLtrioRsU18HqOqWzJ2toNOGUFOBZSp-ODRFrgzAnp84c0dw@mail.gmail.com>
2012-11-20 14:21             ` Konstantin Serebryany
2012-11-20 14:47               ` Dmitry Vyukov
2012-11-20 15:12                 ` Evgeniy Stepanov
2012-11-20 15:17                   ` Konstantin Serebryany
2012-11-20 19:08             ` Peter Bergner
2012-11-20 19:24               ` Konstantin Serebryany
2012-11-20 20:20                 ` Peter Bergner
2012-11-20 20:36                   ` Richard Henderson
2012-11-20 22:15                     ` Peter Bergner
2012-11-20 22:27                       ` Richard Henderson
2012-11-21  9:47                         ` Evgeniy Stepanov
2012-11-21 16:16                           ` Peter Bergner
2012-11-21 16:23                             ` Konstantin Serebryany
2012-11-21 17:14                               ` Peter Bergner
     [not found]                                 ` <CABMLtriDyx+38pvRRQma+rrb0V0mLpU8CnCzVgcv9VZc12Ohew@mail.gmail.com>
2012-11-22  8:38                                   ` Evgeniy Stepanov
2012-11-22 17:36                                     ` Konstantin Serebryany [this message]
2012-11-20 18:09           ` Peter Bergner
2012-11-20 18:54             ` Konstantin Serebryany
2012-11-19  8:23 ` Konstantin Serebryany
2012-11-19 14:30 ` Jakub Jelinek
2012-11-19 14:50   ` Peter Bergner
2012-11-19 15:06     ` Jakub Jelinek
2012-11-19 15:29     ` Konstantin Serebryany
2012-11-19 15:32       ` Jakub Jelinek

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=CAGQ9bdy1g9Qo6AS6wxQSrTQYi_+bf5YXKwXWip7r8jahkQR79A@mail.gmail.com \
    --to=konstantin.s.serebryany@gmail.com \
    --cc=bergner@vnet.ibm.com \
    --cc=dvyukov@google.com \
    --cc=eugeni.stepanov@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=glider@google.com \
    --cc=rth@redhat.com \
    --cc=samsonov@google.com \
    /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: link
Be 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).