bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: helper bpf_map_peek_elem_proto points to wrong callback.
@ 2021-01-19 19:05 Mircea CIRJALIU - MELIU
  2021-01-19 21:12 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Mircea CIRJALIU - MELIU @ 2021-01-19 19:05 UTC (permalink / raw)
  To: ast, daniel, andrii; +Cc: bpf

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(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bpf: helper bpf_map_peek_elem_proto points to wrong callback.
  2021-01-19 19:05 [PATCH] bpf: helper bpf_map_peek_elem_proto points to wrong callback Mircea CIRJALIU - MELIU
@ 2021-01-19 21:12 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2021-01-19 21:12 UTC (permalink / raw)
  To: Mircea CIRJALIU - MELIU, ast, andrii; +Cc: bpf, mauriciovasquezbernal

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
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-19 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 19:05 [PATCH] bpf: helper bpf_map_peek_elem_proto points to wrong callback Mircea CIRJALIU - MELIU
2021-01-19 21:12 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).