diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 6d8e86762..49d134a62 100755 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -608,7 +608,11 @@ static __always_inline int bpf_tree_comp(void *key, struct latch_tree_node *n) if (val < ksym->start) return -1; - if (val >= ksym->end) + /* Ensure that we detect return addresses as part of the program, when + * the final instruction is a call for a program part of the stack + * trace. Therefore, do val > ksym->end instead of val >= ksym->end. + */ + if (val > ksym->end) return 1; return 0;