Re: [PATCH] symbol: fix offset print for function pointers that return pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lianbo, I pulled down crash fresh and I can reproduce it everytime.
It's strange yours did not reproduce.  Not sure why.

RELEASE: 3.10.0-1160.24.1.el7.x86_64

crash> struct -o offload_callbacks
struct offload_callbacks {
       struct sk_buff *(*gso_segment)(struct sk_buff *, netdev_features_t);
       struct sk_buff **(*gro_receive)(struct sk_buff **, struct sk_buff *);
  [16] int (*gro_complete)(struct sk_buff *, int);
}
SIZE: 24
On Mon, Apr 12, 2021 at 3:54 AM lijiang <lijiang@xxxxxxxxxx> wrote:
>
> 在 2021年04月02日 15:02, HAGIO KAZUHITO(萩尾 一仁) 写道:
> > -----Original Message-----
> >> In the show_member_offset() function, when trying to handle function
> >> pointers, the case for "(*" is handled.  However, if the function
> >> pointer returns a pointer or a pointer to a pointer, then the
> >> condition is unhandled.  This results in the offset not being printed.
> >>
> >> Fix by first checking if the member is potentially a function pointer,
> >> then checking if it returns a pointer or a pointer to a pointer.
> >>
> >> Signed-off-by: John Pittman <jpittman@xxxxxxxxxx>
> >
> > Good catch... I've confirmed that the patch works as expected with RHEL7's
> > struct offload_callbacks:
> >
> > crash> struct -o offload_callbacks
> > struct offload_callbacks {
> >    [0] struct sk_buff *(*gso_segment)(struct sk_buff *, netdev_features_t);
> >    [8] struct sk_buff **(*gro_receive)(struct sk_buff **, struct sk_buff *);
> >   [16] int (*gro_complete)(struct sk_buff *, int);
> > }
> > SIZE: 24
>
> This should be a good example for the case described in patch log. But I didn't
> reproduce it on rhel7 before applying this patch, it's strange.
> ...
>       KERNEL: /usr/lib/debug/lib/modules/3.10.0-1160.24.1.el7.x86_64/vmlinux
> ...
>      RELEASE: 3.10.0-1160.24.1.el7.x86_64
>      VERSION: #1 SMP Thu Mar 25 21:21:56 UTC 2021
>      MACHINE: x86_64  (2892 Mhz)
>       MEMORY: 4 GB
>          PID: 7815
>      COMMAND: "crash"
>         TASK: ffffa10210512100  [THREAD_INFO: ffffa10189b34000]
>          CPU: 1
>        STATE: TASK_RUNNING (ACTIVE)
>
> crash> struct -o offload_callbacks
> struct offload_callbacks {
>        struct sk_buff *(*gso_segment)(struct sk_buff *, netdev_features_t);
>        struct sk_buff **(*gro_receive)(struct sk_buff **, struct sk_buff *);
>   [16] int (*gro_complete)(struct sk_buff *, int);
> }
> SIZE: 24
>
> Do you happen to know how to reproduce this issue? John Pittman.
>
> Thanks.
> Lianbo
>
> >
> > Acked-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
> >
> > Thanks,
> > Kazu
> >
> >> ---
> >>  symbols.c | 11 +++++++++--
> >>  1 file changed, 9 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/symbols.c b/symbols.c
> >> index a2d5c6c..5d7da6e 100644
> >> --- a/symbols.c
> >> +++ b/symbols.c
> >> @@ -8356,8 +8356,15 @@ show_member_offset(FILE *ofp, struct datatype_member *dm, char *inbuf)
> >>              }
> >>      } else if (c) {
> >>              for (i = 0; i < c; i++) {
> >> -                    if (STRNEQ(arglist[i], "(*")) {
> >> -                            target = arglist[i]+2;
> >> +                    if (strstr(inbuf, "(*")) {
> >> +                            if (STRNEQ(arglist[i], "(*"))
> >> +                                    target = arglist[i]+2;
> >> +                            else if (STRNEQ(arglist[i], "*(*"))
> >> +                                    target = arglist[i]+3;
> >> +                            else if (STRNEQ(arglist[i], "**(*"))
> >> +                                    target = arglist[i]+4;
> >> +                            else
> >> +                                    continue;
> >>                              if (!(t1 = strstr(target, ")")))
> >>                                      continue;
> >>                              *t1 = NULLCHAR;
> >> --
> >> 2.17.2
> >
>


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux