XDP hardware hints discussion mail archive
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <jbrouer@redhat.com>
To: Martin KaFai Lau <martin.lau@linux.dev>,
	Stanislav Fomichev <sdf@google.com>
Cc: brouer@redhat.com, netdev@vger.kernel.org, martin.lau@kernel.org,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	song@kernel.org, yhs@fb.com, john.fastabend@gmail.com,
	dsahern@gmail.com, willemb@google.com, void@manifault.com,
	kuba@kernel.org, xdp-hints@xdp-project.net, bpf@vger.kernel.org
Subject: [xdp-hints] Re: [PATCH bpf-next V2 2/4] selftests/bpf: xdp_hw_metadata cleanup cause segfault
Date: Wed, 1 Feb 2023 18:53:44 +0100	[thread overview]
Message-ID: <73d3e5c5-a38b-6f83-3022-b0442203ad6b@redhat.com> (raw)
In-Reply-To: <484ca75b-d5f0-31db-6f81-2fb17ce0702e@linux.dev>



On 01/02/2023 18.46, Martin KaFai Lau wrote:
> On 2/1/23 9:31 AM, Jesper Dangaard Brouer wrote:
>> diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c 
>> b/tools/testing/selftests/bpf/xdp_hw_metadata.c
>> index 3823b1c499cc..438083e34cce 100644
>> --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
>> +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
>> @@ -121,7 +121,7 @@ static void close_xsk(struct xsk *xsk)
>>           xsk_umem__delete(xsk->umem);
>>       if (xsk->socket)
>>           xsk_socket__delete(xsk->socket);
>> -    munmap(xsk->umem, UMEM_SIZE);
>> +    munmap(xsk->umem_area, UMEM_SIZE);
> 
> Ah. Good catch. This should also explain a similar issue that CI is 
> seeing in the prog_tests/xdp_metadata.c.

Yes, very likely same bug in prog_tests/xdp_metadata.c.

It was super tricky (and time consuming) to find as I was debugging in
GDB and it didn't make sense that checking a value against NULL would
cause a segfault.  Plus, sometimes it worked without issues.

We also need this fix:

diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c 
b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
index e033d48288c0..241909d71c7e 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
@@ -121,7 +121,7 @@ static void close_xsk(struct xsk *xsk)
                 xsk_umem__delete(xsk->umem);
         if (xsk->socket)
                 xsk_socket__delete(xsk->socket);
-       munmap(xsk->umem, UMEM_SIZE);
+       munmap(xsk->umem_area, UMEM_SIZE);
  }


  reply	other threads:[~2023-02-01 17:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 17:31 [xdp-hints] [PATCH bpf-next V2 0/4] selftests/bpf: xdp_hw_metadata fixes series Jesper Dangaard Brouer
2023-02-01 17:31 ` [xdp-hints] [PATCH bpf-next V2 1/4] selftests/bpf: xdp_hw_metadata clear metadata when -EOPNOTSUPP Jesper Dangaard Brouer
2023-02-01 17:31 ` [xdp-hints] [PATCH bpf-next V2 2/4] selftests/bpf: xdp_hw_metadata cleanup cause segfault Jesper Dangaard Brouer
2023-02-01 17:46   ` [xdp-hints] " Martin KaFai Lau
2023-02-01 17:53     ` Jesper Dangaard Brouer [this message]
2023-02-01 17:32 ` [xdp-hints] [PATCH bpf-next V2 3/4] selftests/bpf: xdp_hw_metadata correct status value in error(3) Jesper Dangaard Brouer
2023-02-01 17:32 ` [xdp-hints] [PATCH bpf-next V2 4/4] selftests/bpf: xdp_hw_metadata use strncpy for ifname Jesper Dangaard Brouer
2023-02-01 19:11 ` [xdp-hints] Re: [PATCH bpf-next V2 0/4] selftests/bpf: xdp_hw_metadata fixes series Stanislav Fomichev
2023-02-02  0:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.xdp-project.net/postorius/lists/xdp-hints.xdp-project.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73d3e5c5-a38b-6f83-3022-b0442203ad6b@redhat.com \
    --to=jbrouer@redhat.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=void@manifault.com \
    --cc=willemb@google.com \
    --cc=xdp-hints@xdp-project.net \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox