[Crash-utility] Patch to fix Seg Violation in parse_for_member

Dave Anderson anderson at redhat.com
Fri Aug 10 14:16:16 UTC 2012



----- Original Message -----
> What about replacing that fprintf() with fprintf(pc->saved_fp, "%s",
> buf) or even fputs(buf, pc->saved_fp)?

Hmmm, that would be preferable -- let me test that...

Thanks,
  Dave

> On Fri, Aug 10, 2012 at 2:55 PM, Dave Anderson <anderson at redhat.com>
> wrote:
> >
> >
> > ----- Original Message -----
> >> On Thu, 2012-08-09 at 16:23 -0600, Bob Montgomery wrote:
> >> > If you change the
> >> >      fprintf(pc->saved_fp, buf);
> >> > lines to
> >> >      print_verbatim(pc->saved_fp, buf);
> >> >
> >> > Then I won't get:
> >> >
> >> > crash> sk_buff.head ffff88012014dc80
> >> > Segmentation fault
> >> >
> >> > When I need to get:
> >> >
> >> > crash> sk_buff.head ffff88012014dc80
> >> >   head = 0xffff880121267000 "\"%s %s %s\", got type \"%s\""
> >> >
> >> >
> >> > Patch attached (6.0.8).
> >> >
> >> > I suspect performance will suffer a bit when I try to print
> >> > 2 million of these...
> >>
> >> Wonder if it would be quicker on average to string search for "%"
> >> and
> >> conditionally call print_verbatim???  I had lots of successful
> >> fprintf's and only a small number of seg viol cases.
> >>
> >> Bob M.
> >
> > Hi Bob,
> >
> > Although in practice,
> >
> >  (1) parse_for_member() is rarely called "in quantity", and
> >  (2) when it is called, it would only encounter this with "char *"
> >  members, and
> >  (3) the string would also have to have a '%' in it.
> >
> > On the other hand, if you test the two print-types with a million
> > calls,
> > there's a significant performance hit.  But if a strstr() is done
> > first
> > on the string, there's virtually no hit at all if there's no '%' in
> > it.
> >
> > So yes, I agree with you that the string-search/conditional call
> > should be done.
> > I'll add that to your patch, and queue it for crash-6.0.9.
> >
> > Thanks,
> >   Dave
> >
> > --
> > Crash-utility mailing list
> > Crash-utility at redhat.com
> > https://www.redhat.com/mailman/listinfo/crash-utility
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> 




More information about the Crash-utility mailing list