[PATCH RFC][makedumpfile 02/10] dwarf_info: Fix a infinite recursion bug for search_domain
Tao Liu
ltao at redhat.com
Tue Jun 10 02:57:35 PDT 2025
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 <ltao at redhat.com>
---
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;
--
2.47.0
More information about the kexec
mailing list