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
7d2ad9d9
Commit
7d2ad9d9
authored
Jun 24, 2018
by
Paul Chaignon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for rewrite of dereferences with array accesses
parent
287c478f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
tests/python/test_clang.py
tests/python/test_clang.py
+85
-0
No files found.
tests/python/test_clang.py
View file @
7d2ad9d9
...
@@ -1126,6 +1126,91 @@ int test(struct pt_regs *ctx) {
...
@@ -1126,6 +1126,91 @@ int test(struct pt_regs *ctx) {
b
=
BPF
(
text
=
text
)
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses1
(
self
):
text
=
"""
#include <linux/ptrace.h>
#include <linux/dcache.h>
int test(struct pt_regs *ctx, const struct qstr *name) {
return name->name[1];
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses2
(
self
):
text
=
"""
#include <linux/ptrace.h>
#include <linux/dcache.h>
int test(struct pt_regs *ctx, const struct qstr *name) {
return name->name [ 1];
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses3
(
self
):
text
=
"""
#include <linux/ptrace.h>
#include <linux/dcache.h>
int test(struct pt_regs *ctx, const struct qstr *name) {
return (name->name)[1];
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses4
(
self
):
text
=
"""
#include <linux/ptrace.h>
int test(struct pt_regs *ctx, char *name) {
return name[1];
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses5
(
self
):
text
=
"""
#include <linux/ptrace.h>
int test(struct pt_regs *ctx, char **name) {
return (*name)[1];
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses6
(
self
):
text
=
"""
#include <linux/ptrace.h>
struct test_t {
int tab[5];
};
int test(struct pt_regs *ctx, struct test_t *t) {
return *(&t->tab[1]);
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses7
(
self
):
text
=
"""
#include <net/inet_sock.h>
int test(struct pt_regs *ctx, struct sock *sk) {
return sk->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32[0];
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
def
test_probe_read_array_accesses8
(
self
):
text
=
"""
#include <linux/mm_types.h>
int test(struct pt_regs *ctx, struct mm_struct *mm) {
return mm->rss_stat.count[MM_ANONPAGES].counter;
}
"""
b
=
BPF
(
text
=
text
)
fn
=
b
.
load_func
(
"test"
,
BPF
.
KPROBE
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
()
main
()
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