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
9c38f480
Commit
9c38f480
authored
Oct 05, 2017
by
Teng Qin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid potential SEGFAULT when resolving Kernel symbols
parent
782b34f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
src/cc/bcc_syms.cc
src/cc/bcc_syms.cc
+17
-13
No files found.
src/cc/bcc_syms.cc
View file @
9c38f480
...
...
@@ -61,21 +61,25 @@ void KSyms::refresh() {
bool
KSyms
::
resolve_addr
(
uint64_t
addr
,
struct
bcc_symbol
*
sym
,
bool
demangle
)
{
refresh
();
if
(
syms_
.
empty
())
{
sym
->
name
=
nullptr
;
sym
->
demangle_name
=
nullptr
;
sym
->
module
=
nullptr
;
sym
->
offset
=
0x0
;
return
false
;
std
::
vector
<
Symbol
>::
iterator
it
;
if
(
syms_
.
empty
())
goto
unknown_symbol
;
it
=
std
::
upper_bound
(
syms_
.
begin
(),
syms_
.
end
(),
Symbol
(
""
,
addr
));
if
(
it
!=
syms_
.
begin
())
{
it
--
;
sym
->
name
=
(
*
it
).
name
.
c_str
();
if
(
demangle
)
sym
->
demangle_name
=
sym
->
name
;
sym
->
module
=
"kernel"
;
sym
->
offset
=
addr
-
(
*
it
).
addr
;
return
true
;
}
auto
it
=
std
::
upper_bound
(
syms_
.
begin
(),
syms_
.
end
(),
Symbol
(
""
,
addr
))
-
1
;
sym
->
name
=
(
*
it
).
name
.
c_str
();
if
(
demangle
)
sym
->
demangle_name
=
sym
->
name
;
sym
->
module
=
"kernel"
;
sym
->
offset
=
addr
-
(
*
it
).
addr
;
return
true
;
unknown_symbol:
memset
(
sym
,
0
,
sizeof
(
struct
bcc_symbol
));
return
false
;
}
bool
KSyms
::
resolve_name
(
const
char
*
_unused
,
const
char
*
name
,
...
...
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