From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by mail.toke.dk (Postfix) with ESMTPS id 64A7E9E649F for ; Wed, 1 Feb 2023 20:10:44 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=Vof8VT7+ Received: by mail-pg1-x532.google.com with SMTP id s67so13244328pgs.3 for ; Wed, 01 Feb 2023 11:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6ilVhJc0KLaqYnWcVF2XM/01kZ5HMNBRjsvcGb6cfig=; b=Vof8VT7+R99GRr4Zp5nO/gYx5VOCsXms2LfF7NNN6i2WZzpvDV7nHXdawp3ox3qAD2 C18J8JBT6tiMZnIMZ22WNgEs5WNRbsEFppuwWfH2jKbc6MkmGt1bXmsV+J3W+ItUTjMu ZM9jqgc5kiJ3iirH0HXxLAfdlaEJyF4iFprmXWJCRy+q6XMID1ajLiuwgDIwNpmEL3uY /qW17kORqcUfBKZ4jE3DmaxowVnAjwy1/KjFGO0rsatoo7NWCMwT/Jxlgn0Oyly11l/v C2n2+yjXplD0wLBnqWa4Hzr07cCazfJp9w1x182/mEcdDdQ8s2MoGUYs+s9IchQaJRkY 2B7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6ilVhJc0KLaqYnWcVF2XM/01kZ5HMNBRjsvcGb6cfig=; b=DcXvqbCNHUyM3Omgqzj6LXxoTJsXsrQXzkvrAN3wmCa9l66m47tyvTvSqay483DAUt qkDT1CnXyQihsIy0W/ksvfNrEYJxmVHVIfvviDkPJFbS7jQOoyyxjack5M4dEWzIQw8I 5HRU2i31R2Dq9j7MTmSb95xrG1OV9eXr8x19Kl+5pYe281ETH1cPCERBpSetEfAux5NJ fhjqY9znpMNGMXTeDezXIc+8stRNRl07phGsuk9AtKsLuCwrRyzdGI7dipBxl4PPrlST Gd40cNbL2ZyucuxGqk3qcI1iKGDCNm3/Npr/GFJsMIvRJRDHx2dWaWz3XWc5+0c0+1JZ tsWQ== X-Gm-Message-State: AO0yUKWZPAFOfzwW2o7dfjvzxlCt9Y5kpT6qxEgouDbiOo2A4OP/uYXc C2cPqyRaeHTBYRi6FFI7Id0TifFWs258JWVaI1ZjgA== X-Google-Smtp-Source: AK7set8goKUSoGkjWGVqXqgWWcQEZYI0hUhX1EATDo3o3SV+MZjzebVUz/ZYkOyZlmBkTPVDaGW9HGFtC9aOKQKhoTc= X-Received: by 2002:aa7:94b9:0:b0:593:1253:2ff5 with SMTP id a25-20020aa794b9000000b0059312532ff5mr802084pfl.14.1675278641256; Wed, 01 Feb 2023 11:10:41 -0800 (PST) MIME-Version: 1.0 References: <167527517464.938135.13750760520577765269.stgit@firesoul> In-Reply-To: <167527517464.938135.13750760520577765269.stgit@firesoul> From: Stanislav Fomichev Date: Wed, 1 Feb 2023 11:10:29 -0800 Message-ID: To: Jesper Dangaard Brouer Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: FVFKLBREBPZQVFWHKGTVHKKYYWZLAC3O X-Message-ID-Hash: FVFKLBREBPZQVFWHKGTVHKKYYWZLAC3O X-MailFrom: sdf@google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, netdev@vger.kernel.org, martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, 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 X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next V1] selftests/bpf: fix unmap bug in prog_tests/xdp_metadata.c List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, Feb 1, 2023 at 10:13 AM Jesper Dangaard Brouer wrote: > > The function close_xsk() unmap via munmap() the wrong memory pointer. > > The call xsk_umem__delete(xsk->umem) have already freed xsk->umem. > Thus the call to munmap(xsk->umem, UMEM_SIZE) will have unpredictable > behavior that can lead to Segmentation fault elsewhere, as man page > explain subsequent references to these pages will generate SIGSEGV. > > Fixes: e2a46d54d7a1 ("selftests/bpf: Verify xdp_metadata xdp->af_xdp path") > Reported-by: Martin KaFai Lau > Signed-off-by: Jesper Dangaard Brouer Good catch, thank you! Acked-by: Stanislav Fomichev > --- > .../selftests/bpf/prog_tests/xdp_metadata.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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); > } > > static void ip_csum(struct iphdr *iph) > >