Hi YAMAZAKI,

On Fri, Oct 3, 2025 at 8:23 PM YAMAZAKI MASAMITSU(山崎 真光)
<[email protected]> wrote:
>
> On 2025/06/10 18:57, Tao Liu wrote:
> > There is an infinite recursion bug noticed in rust symbols. The root cause 
> > is
> > unclear to me. This patch will avoid the bug by skip the recursion of rust
> > symbols, since currently we don't need to deal with those.
> >
> > Signed-off-by: Tao Liu <[email protected]>
> > ---
> >   dwarf_info.c | 15 ++++++++-------
> >   1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/dwarf_info.c b/dwarf_info.c
> > index a3a2fd6..73842ab 100644
> > --- a/dwarf_info.c
> > +++ b/dwarf_info.c
> > @@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found)
> >   }
> >
> >   static void
> > -search_domain(Dwarf_Die *die, int *found)
> > +search_domain(Dwarf_Die *die, int *found, int lang)
> >   {
> >       int tag;
> >       const char *name;
> > @@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)
> >                       if (is_container(&die_type)) {
> >                               Dwarf_Die child;
> >
> > -                             if (dwarf_child(&die_type, &child) != 0)
> > +                             if (dwarf_child(&die_type, &child) != 0 ||
> > +                                 lang == DW_LANG_Rust)
> >                                       continue;
> >
> > -                             search_domain(&child, found);
> > +                             search_domain(&child, found, lang);
> >
> >                               if (*found)
> >                                       return;
> > @@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found)
> >   }
> >
> >   static void
> > -search_die_tree(Dwarf_Die *die, int *found)
> > +search_die_tree(Dwarf_Die *die, int *found, int lang)
> >   {
> >       Dwarf_Die child;
> >
> > @@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)
> >        * start by looking at the children
> >        */
> >       if (dwarf_child(die, &child) == 0)
> > -             search_die_tree(&child, found);
> > +             search_die_tree(&child, found, lang);
> >
> >       if (*found)
> >               return;
> > @@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)
> >               search_typedef(die, found);
> >
> >       else if (is_search_domain(dwarf_info.cmd))
> > -             search_domain(die, found);
> > +             search_domain(die, found, lang);
> >
> >       else if (is_search_die(dwarf_info.cmd))
> >               search_die(die, found);
> > @@ -1007,7 +1008,7 @@ get_debug_info(void)
> >                       ERRMSG("Can't get CU die.\n");
> >                       goto out;
> >               }
> > -             search_die_tree(&cu_die, &found);
> > +             search_die_tree(&cu_die, &found, dwarf_srclang(&cu_die));
> >               if (found)
> >                       break;
> >               off = next_off;
>
> Hi Liu
>
> This problem need to be solve. But I don't know how to reproduce.
> If Your server is running rust program. Or Or is it running as a
> module by rust? Please tell me how to reproduce it.

Sure
E.g. using the following eppic program: /tmp/test.c:
string test_opt(){return "";}
string test_usage(){return "";}
static void test_showusage(){printf("");}
string test_help(){return "";}

int test()
{
struct task_struct *p;
unsigned long offset;

p = (struct task_struct *)&init_task;
offset = (unsigned long)&(p->tasks) - (unsigned long)p;

do {
printf("%d\n", (int)(p->pid));
p = (struct task_struct *)((unsigned long)(p->tasks.next) - (unsigned long)p);
} while (p != &init_task);
return 1;
}

$ ./makedumpfile --dry-run -d 31 -l
/var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/out -x
/lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux --eppic
/tmp/test.c
Segmentation fault (core dumped)

With the patch, no segfault.

The vmcore/vmlinux should contain rust symbols: CONFIG_RUST=y, you can
use the following vmcore https://people.redhat.com/~ltao/core/vmcore +
https://kojipkgs.fedoraproject.org//packages/kernel/6.11.8/300.fc41/x86_64/kernel-debuginfo-6.11.8-300.fc41.x86_64.rpm
for vmlinux and vmcore to test.

Thanks,
Tao Liu

>
> Thanks,
> Masa
>
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to