Commit c5ca2a67 authored by Paul Chaignon's avatar Paul Chaignon Committed by Brenden Blanco

Traces external pointers in parenthesized expressions

Partially reverts 80667b7b, "Fix unary operator handling of probe
reads with parens", keeping the test case. With 4c6ecb46,
"Restrict rewrite of unary operators to dereference operator," only
dereferences are rewritten, removing the need for the previous fix.

Reverting 80667b7b allows bcc to rewrite more dereferences, as
highlighted in the new test case.
parent a135d895
......@@ -83,9 +83,6 @@ class ProbeChecker : public RecursiveASTVisitor<ProbeChecker> {
}
return false;
}
bool VisitParenExpr(ParenExpr *E) {
return false;
}
bool VisitDeclRefExpr(DeclRefExpr *E) {
if (ptregs_.find(E->getDecl()) != ptregs_.end())
needs_probe_ = true;
......
......@@ -349,6 +349,17 @@ int trace_entry(struct pt_regs *ctx, struct request *req) {
return 1;
return 0;
}
"""
b = BPF(text=text)
fn = b.load_func("trace_entry", BPF.KPROBE)
def test_paren_probe_read(self):
text = """
#include <net/inet_sock.h>
int trace_entry(struct pt_regs *ctx, struct sock *sk) {
u16 sport = ((struct inet_sock *)sk)->inet_sport;
return sport;
}
"""
b = BPF(text=text)
fn = b.load_func("trace_entry", BPF.KPROBE)
......
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