[PATCH 14/17] loc2stap: preserve the address space of call-site values

Aaron Merey amerey@redhat.com
Mon Nov 23 04:14:28 GMT 2026


get_call_site_values leaves userspace_p unset in the nested location
context. A userspace DWARF expression can then select a kernel
register. Copy the flag from the parent context.

Memcheck reported

  Conditional jump or move depends on uninitialised value(s)
    at target_register::print(std::ostream&) const (staptree.cxx:520)
  Uninitialised value was created by a stack allocation
    at get_call_site_values ... (loc2stap.cxx:1732)

On the userspace test, pass 2 printed eight @kregister expressions
before the fix and eight @uregister expressions afterward.

Assisted-by: Codex <noreply@openai.com>
---
 loc2stap.cxx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/loc2stap.cxx b/loc2stap.cxx
index 7678d82d6..0b08f3202 100644
--- a/loc2stap.cxx
+++ b/loc2stap.cxx
@@ -1755,6 +1755,7 @@ get_call_site_values(Dwarf_Die *die, Dwarf_Die *function, location_context *ctx)
 	location_context new_ctx (ctx->e);
 	new_ctx.attr = &op_attr;
 	new_ctx.dwbias = ctx->dwbias;
+	new_ctx.userspace_p = ctx->userspace_p;
 	new_ctx.pc = lowpc;
 	new_ctx.function = function;
 	new_ctx.param_ref_depth = ctx->param_ref_depth + 1;
-- 
2.56.1



More information about the Systemtap mailing list