Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
55299115
Commit
55299115
authored
May 11, 2018
by
Paul Chaignon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for dereferences of pointers to external pointers
parent
471f1ea1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
tests/python/test_clang.py
tests/python/test_clang.py
+46
-0
No files found.
tests/python/test_clang.py
View file @
55299115
...
...
@@ -383,6 +383,52 @@ int trace_entry(struct pt_regs *ctx, struct request *req) {
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"trace_entry"
,
BPF
.
KPROBE
)
def
test_probe_read_nested_deref
(
self
):
text
=
"""
#include <net/inet_sock.h>
int test(struct pt_regs *ctx, struct sock *sk) {
struct sock *ptr1;
struct sock **ptr2 = &ptr1;
*ptr2 = sk;
return ((struct sock *)(*ptr2))->sk_daddr;
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_nested_deref2
(
self
):
text
=
"""
#include <net/inet_sock.h>
int test(struct pt_regs *ctx, struct sock *sk) {
struct sock *ptr1;
struct sock **ptr2 = &ptr1;
struct sock ***ptr3 = &ptr2;
*ptr2 = sk;
*ptr3 = ptr2;
return ((struct sock *)(**ptr3))->sk_daddr;
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_nested_deref_func
(
self
):
text
=
"""
#include <net/inet_sock.h>
static int subtest(struct sock ***skp) {
return ((struct sock *)(**skp))->sk_daddr;
}
int test(struct pt_regs *ctx, struct sock *sk) {
struct sock *ptr1;
struct sock **ptr2 = &ptr1;
struct sock ***ptr3 = &ptr2;
*ptr2 = sk;
*ptr3 = ptr2;
return subtest(ptr3);
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_paren_probe_read
(
self
):
text
=
"""
#include <net/inet_sock.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment