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
581052a6
Commit
581052a6
authored
Mar 23, 2018
by
4ast
Committed by
GitHub
Mar 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1647 from iovisor/yhs_dev
skip kprobe functions outside normal text section
parents
24a80928
1034bd44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+11
-2
No files found.
src/python/bcc/__init__.py
View file @
581052a6
...
...
@@ -481,9 +481,18 @@ class BPF(object):
with
open
(
"%s/../kprobes/blacklist"
%
TRACEFS
,
"rb"
)
as
blacklist_f
:
blacklist
=
set
([
line
.
rstrip
().
split
()[
1
]
for
line
in
blacklist_f
])
fns
=
[]
found_stext
=
False
with
open
(
"/proc/kallsyms"
,
"rb"
)
as
avail_file
:
for
line
in
avail_file
:
(
_
,
t
,
fn
)
=
line
.
rstrip
().
split
()[:
3
]
if
found_stext
is
False
:
if
fn
==
b'_stext'
:
found_stext
=
True
continue
if
fn
==
b'_etext'
:
break
if
(
t
.
lower
()
in
[
b't'
,
b'w'
])
and
re
.
match
(
event_re
,
fn
)
\
and
fn
not
in
blacklist
:
fns
.
append
(
fn
)
...
...
@@ -558,7 +567,7 @@ class BPF(object):
ev_name
=
b"r_"
+
event
.
replace
(
b"+"
,
b"_"
).
replace
(
b"."
,
b"_"
)
fd
=
lib
.
bpf_attach_kprobe
(
fn
.
fd
,
1
,
ev_name
,
event
)
if
fd
<
0
:
raise
Exception
(
"Failed to attach BPF to kprobe"
)
raise
Exception
(
"Failed to attach BPF to k
ret
probe"
)
self
.
_add_kprobe_fd
(
ev_name
,
fd
)
return
self
...
...
@@ -877,7 +886,7 @@ class BPF(object):
ev_name
=
self
.
_get_uprobe_evname
(
b"r"
,
path
,
addr
,
pid
)
fd
=
lib
.
bpf_attach_uprobe
(
fn
.
fd
,
1
,
ev_name
,
path
,
addr
,
pid
)
if
fd
<
0
:
raise
Exception
(
"Failed to attach BPF to uprobe"
)
raise
Exception
(
"Failed to attach BPF to u
ret
probe"
)
self
.
_add_uprobe_fd
(
ev_name
,
fd
)
return
self
...
...
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