Commit b6db17f5 authored by Sasha Goldshtein's avatar Sasha Goldshtein Committed by 4ast

trace: Initialize USDT arguments to 0 before reading (#725)

Fixes #722, in which a USDT probe that has more than
one location and the type of the argument is a string
caused trace to potentially access an uninitialized
stack variable, thereby not passing BPF program
verification at load time.
parent 376ae5c0
......@@ -301,7 +301,7 @@ BPF_PERF_OUTPUT(%s);
expr = self.values[idx].strip()
text = ""
if self.probe_type == "u" and expr[0:3] == "arg":
text = (" u64 %s;\n" +
text = (" u64 %s = 0;\n" +
" bpf_usdt_readarg(%s, ctx, &%s);\n") % \
(expr, expr[3], expr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment