Skip to content

Commit

Permalink
Do not attempt syscall on invalid stack_id
Browse files Browse the repository at this point in the history
  • Loading branch information
palmtenor committed Mar 26, 2018
1 parent 581052a commit d364800
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cc/api/BPFTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ void BPFStackTable::clear_table_non_atomic() {
std::vector<uintptr_t> BPFStackTable::get_stack_addr(int stack_id) {
std::vector<uintptr_t> res;
stacktrace_t stack;
if (stack_id < 0)
return res;
if (!lookup(&stack_id, &stack))
return res;
for (int i = 0; (i < BPF_MAX_STACK_DEPTH) && (stack.ip[i] != 0); i++)
Expand All @@ -189,6 +191,8 @@ std::vector<std::string> BPFStackTable::get_stack_symbol(int stack_id,
int pid) {
auto addresses = get_stack_addr(stack_id);
std::vector<std::string> res;
if (addresses.empty())
return res;
res.reserve(addresses.size());

if (pid < 0)
Expand Down

0 comments on commit d364800

Please sign in to comment.