From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Meissner To: Eli Zaretskii Cc: fnasser@cygnus.com, cgf@redhat.com, meissner@cygnus.com, gdb@sources.redhat.com, cagney@cygnus.com Subject: Re: alloca is bad? Date: Mon, 13 Nov 2000 08:05:00 -0000 Message-id: <20001113110546.22415@cse.cygnus.com> References: <20001109212032.A26464@redhat.com> <20001109213750.28987@cse.cygnus.com> <20001109222231.A26675@redhat.com> <3A0DA348.6BDDAFD4@cygnus.com> <200011120538.AAA01237@indy.delorie.com> <3A0E4F83.5F9D97FF@cygnus.com> <200011121216.HAA01483@indy.delorie.com> <3A0F24AA.50E22A01@cygnus.com> <200011131112.GAA02182@indy.delorie.com> X-SW-Source: 2000-11/msg00123.html On Mon, Nov 13, 2000 at 06:12:58AM -0500, Eli Zaretskii wrote: > > Date: Sun, 12 Nov 2000 23:15:54 +0000 > > From: Fernando Nasser > > > > As Andrew explained in his message, if the stack is > > corrupted the PC and FP can (and probably will) be clobbered with > > the garbage when the function returns. > > They could, yes; but in practice (at least in my experience), the > clobbered return address is caught by the OS protection in most cases, > so the program will GPF before the PC is garbled. That's not my experience, but I suspect different machines, different OSes.... > > Bottom line: for most stack corruption problems, no "where" ("backtrace") > > In my experience, in most cases, there is in fact at least the frame > where it crashed. You should be able to start debugging from there. This is assuming you have a valid frame. On systems with a frame pointer, the FP often times gets clobbered, just like the return address does, because both get restored at the same time. -- Michael Meissner, Red Hat, Inc. PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA Work: meissner@redhat.com phone: +1 978-486-9304 Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482