diff mbox series

bpf: helper bpf_map_peek_elem_proto points to wrong callback.

Message ID AM7PR02MB6082663DFDCCE8DA7A6DD6B1BBA30@AM7PR02MB6082.eurprd02.prod.outlook.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series bpf: helper bpf_map_peek_elem_proto points to wrong callback. | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Mircea CIRJALIU - MELIU Jan. 19, 2021, 7:05 p.m. UTC
I assume this was obtained by copy-paste.

Signed-off-by: Mircea Cirjaliu <mcirjaliu@bitdefender.com>
---
 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.25.1

Comments

Daniel Borkmann Jan. 19, 2021, 9:12 p.m. UTC | #1
On 1/19/21 8:05 PM, Mircea CIRJALIU - MELIU wrote:
> I assume this was obtained by copy-paste.
> 
> Signed-off-by: Mircea Cirjaliu <mcirjaliu@bitdefender.com>

Ugh, big yikes (!), thanks a lot for the fix, applied!

I've added Fixes tag to f1a2e44a3aec ("bpf: add queue and stack maps"). I bet
either noone has been using bpf_map_peek_elem() in practice (at least from BPF
program side) or it was most of the time hidden behind 84430d4232c3 ("bpf,
verifier: avoid retpoline for map push/pop/peek operation") as JIT is enabled
in most cases.

> ---
>   kernel/bpf/helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index bd8a3183d030..41ca280b1dc1 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -108,7 +108,7 @@ BPF_CALL_2(bpf_map_peek_elem, struct bpf_map *, map, void *, value)
>   }
> 
>   const struct bpf_func_proto bpf_map_peek_elem_proto = {
> -       .func           = bpf_map_pop_elem,
> +       .func           = bpf_map_peek_elem,
>          .gpl_only       = false,
>          .ret_type       = RET_INTEGER,
>          .arg1_type      = ARG_CONST_MAP_PTR,
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index bd8a3183d030..41ca280b1dc1 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -108,7 +108,7 @@  BPF_CALL_2(bpf_map_peek_elem, struct bpf_map *, map, void *, value)
 }

 const struct bpf_func_proto bpf_map_peek_elem_proto = {
-       .func           = bpf_map_pop_elem,
+       .func           = bpf_map_peek_elem,
        .gpl_only       = false,
        .ret_type       = RET_INTEGER,
        .arg1_type      = ARG_CONST_MAP_PTR,