mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-09 10:09:11 +00:00
selftests/bpf: ksym_search won't check symbols exists
[ Upstream commit 0979ff7992
]
Currently, ksym_search located at trace_helpers won't check symbols are
existing or not.
In ksym_search, when symbol is not found, it will return &syms[0](_stext).
But when the kernel symbols are not loaded, it will return NULL, which is
not a desired action.
This commit will add verification logic whether symbols are loaded prior
to the symbol search.
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ef8e5a7840
commit
f8f54929bd
1 changed files with 4 additions and 0 deletions
|
@ -51,6 +51,10 @@ struct ksym *ksym_search(long key)
|
|||
int start = 0, end = sym_cnt;
|
||||
int result;
|
||||
|
||||
/* kallsyms not loaded. return NULL */
|
||||
if (sym_cnt <= 0)
|
||||
return NULL;
|
||||
|
||||
while (start < end) {
|
||||
size_t mid = start + (end - start) / 2;
|
||||
|
||||
|
|
Loading…
Reference in a new issue