Skip to content

Commit

Permalink
trace: Initialize USDT arguments to 0 before reading (iovisor#725)
Browse files Browse the repository at this point in the history
Fixes iovisor#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.
  • Loading branch information
goldshtn authored and 4ast committed Oct 4, 2016
1 parent 376ae5c commit b6db17f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _generate_field_assign(self, idx):
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)

Expand Down

0 comments on commit b6db17f

Please sign in to comment.