linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libbpf: Fixes incorrect rx_ring_setup_done
@ 2021-06-07 13:08 Kev Jackson
  2021-06-07 15:04 ` Yonghong Song
  2021-06-08  0:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Kev Jackson @ 2021-06-07 13:08 UTC (permalink / raw)
  To: Björn Töpel, Magnus Karlsson, Jonathan Lemon,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh
  Cc: netdev, bpf, linux-kernel

When calling xsk_socket__create_shared(), the logic at line 1097 marks a
boolean flag true within the xsk_umem structure to track setup progress
in order to support multiple calls to the function.  However, instead of
marking umem->tx_ring_setup_done, the code incorrectly sets
umem->rx_ring_setup_done.  This leads to improper behaviour when
creating and destroying xsk and umem structures.

Multiple calls to this function is documented as supported.

Signed-off-by: Kev Jackson <foamdino@gmail.com>
---
 tools/lib/bpf/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 6061431ee04c..e9b619aa0cdf 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -1094,7 +1094,7 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr,
 			goto out_put_ctx;
 		}
 		if (xsk->fd == umem->fd)
-			umem->rx_ring_setup_done = true;
+			umem->tx_ring_setup_done = true;
 	}
 
 	err = xsk_get_mmap_offsets(xsk->fd, &off);
-- 
2.30.2


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

* Re: [PATCH] libbpf: Fixes incorrect rx_ring_setup_done
  2021-06-07 13:08 [PATCH] libbpf: Fixes incorrect rx_ring_setup_done Kev Jackson
@ 2021-06-07 15:04 ` Yonghong Song
  2021-06-08  0:45   ` Andrii Nakryiko
  2021-06-08  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Yonghong Song @ 2021-06-07 15:04 UTC (permalink / raw)
  To: Kev Jackson, Björn Töpel, Magnus Karlsson,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh
  Cc: netdev, bpf, linux-kernel



On 6/7/21 6:08 AM, Kev Jackson wrote:
> When calling xsk_socket__create_shared(), the logic at line 1097 marks a
> boolean flag true within the xsk_umem structure to track setup progress
> in order to support multiple calls to the function.  However, instead of
> marking umem->tx_ring_setup_done, the code incorrectly sets
> umem->rx_ring_setup_done.  This leads to improper behaviour when
> creating and destroying xsk and umem structures.
> 
> Multiple calls to this function is documented as supported.
> 
> Signed-off-by: Kev Jackson <foamdino@gmail.com>

Acked-by: Yonghong Song <yhs@fb.com>

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

* Re: [PATCH] libbpf: Fixes incorrect rx_ring_setup_done
  2021-06-07 15:04 ` Yonghong Song
@ 2021-06-08  0:45   ` Andrii Nakryiko
  0 siblings, 0 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2021-06-08  0:45 UTC (permalink / raw)
  To: Yonghong Song
  Cc: Kev Jackson, Björn Töpel, Magnus Karlsson,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Networking, bpf, open list

On Mon, Jun 7, 2021 at 8:04 AM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 6/7/21 6:08 AM, Kev Jackson wrote:
> > When calling xsk_socket__create_shared(), the logic at line 1097 marks a
> > boolean flag true within the xsk_umem structure to track setup progress
> > in order to support multiple calls to the function.  However, instead of
> > marking umem->tx_ring_setup_done, the code incorrectly sets
> > umem->rx_ring_setup_done.  This leads to improper behaviour when
> > creating and destroying xsk and umem structures.
> >
> > Multiple calls to this function is documented as supported.
> >
> > Signed-off-by: Kev Jackson <foamdino@gmail.com>
>
> Acked-by: Yonghong Song <yhs@fb.com>

Applied to bpf tree, thanks. Also added

Fixes: ca7a83e2487a ("libbpf: Only create rx and tx XDP rings when necessary")

Please don't forget Fixes: tag in the future.

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

* Re: [PATCH] libbpf: Fixes incorrect rx_ring_setup_done
  2021-06-07 13:08 [PATCH] libbpf: Fixes incorrect rx_ring_setup_done Kev Jackson
  2021-06-07 15:04 ` Yonghong Song
@ 2021-06-08  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-08  0:50 UTC (permalink / raw)
  To: Kev Jackson
  Cc: bjorn, magnus.karlsson, jonathan.lemon, ast, daniel, andrii,
	kafai, songliubraving, yhs, john.fastabend, kpsingh, netdev, bpf,
	linux-kernel

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Mon, 7 Jun 2021 14:08:35 +0100 you wrote:
> When calling xsk_socket__create_shared(), the logic at line 1097 marks a
> boolean flag true within the xsk_umem structure to track setup progress
> in order to support multiple calls to the function.  However, instead of
> marking umem->tx_ring_setup_done, the code incorrectly sets
> umem->rx_ring_setup_done.  This leads to improper behaviour when
> creating and destroying xsk and umem structures.
> 
> [...]

Here is the summary with links:
  - libbpf: Fixes incorrect rx_ring_setup_done
    https://git.kernel.org/bpf/bpf/c/11fc79fc9f2e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-06-08  0:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 13:08 [PATCH] libbpf: Fixes incorrect rx_ring_setup_done Kev Jackson
2021-06-07 15:04 ` Yonghong Song
2021-06-08  0:45   ` Andrii Nakryiko
2021-06-08  0:50 ` patchwork-bot+netdevbpf

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