From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9290C442B32; Mon, 17 Aug 2026 15:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786980425; cv=none; b=B4pVZT1DAUIgAAgwQVgCqb93IQ4tiy0ochDIKHgS5y95+t7rGrHgGf1WXGeNsniYt1wjSzlqKteYblBbdCo1auQ5+wv9d5v3C5ZyWY4I98g8X5k1yL7Ce3S3b8YjEIfo6GSUzS+2IjHYDnEMSykLQI5MD0MRmkZRJHtsgF/axRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786980425; c=relaxed/simple; bh=JdHjdKiwHJAdIMFW1QNchlqNYCxjmLw3sluZq7itwiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=clMfAlx8r1kgHAREQgS4zEW9oaFmBYlZDVCEtTjmH7OmIthdPe4ar2x+S6R1/1pVIdiK8674X4Qt898x1gOX6DaWrEIgvYNZ2npRVFEwUc9FIvoxNDdxI7vIX5/VRbZbOJ+MqBdSaRNoCRYnOiTSAuUq9dodaI2Sb//Csiy2acg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Uxp5qG/V; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Uxp5qG/V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F02BE1F000E9; Mon, 17 Aug 2026 15:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786980424; bh=IKVM+RlLmRxMyzQj79HRZmswY71vLeKfSmIQIhs6xA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Uxp5qG/VLMLJBaEZ6b33A2TcYiiOPaI00yLy4hP0ZveUkksTKOtlt1PtrUttZ4BKy fugQEjo38BrNFwMq6rrRzub1bqHHhbsQDiTQ4TKGml+DRlktiXyd0y7jgN4gcgwb7D 8hcQ109NH1qXDixFep2XIYbz/K3TPgN9H2oN8vyo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michal Luczaj , Kuniyuki Iwashima , Jakub Sitnicki , Kumar Kartikeya Dwivedi , Sasha Levin Subject: [PATCH 6.1 566/609] selftests/bpf: Fail unbound UDP on sockmap update Date: Mon, 17 Aug 2026 15:34:22 +0200 Message-ID: <20260817132602.651419857@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132543.039278408@linuxfoundation.org> References: <20260817132543.039278408@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Luczaj [ Upstream commit 203b06932777b9ad5085319389dea566f5c2ca63 ] sockmap now rejects unbound UDP sockets. Adjust test_maps. While at it, check socket()'s return value. This effectively reverts commit c39aa2159974 ("bpf, selftests: Fix test_maps now that sockmap supports UDP"). Signed-off-by: Michal Luczaj Reviewed-by: Kuniyuki Iwashima Reviewed-by: Jakub Sitnicki Link: https://lore.kernel.org/bpf/20260707-sockmap-lookup-udp-leak-v4-4-f878346f27ab@rbox.co Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_maps.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c index 81cd48cc80c23..73878ec8ec7d0 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -752,16 +752,15 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - /* Test update with unsupported UDP socket */ + /* Test update with unsupported unbound UDP socket */ udp = socket(AF_INET, SOCK_DGRAM, 0); - i = 0; - err = bpf_map_update_elem(fd, &i, &udp, BPF_ANY); - if (err) { - printf("Failed socket update SOCK_DGRAM '%i:%i'\n", - i, udp); + CHECK(udp < 0, "socket(AF_INET, SOCK_DGRAM)", "errno:%d\n", errno); + err = bpf_map_update_elem(fd, &(int){0}, &udp, BPF_ANY); + close(udp); + if (!err) { + printf("Unexpectedly succeeded unbound UDP update '0:%i'\n", udp); goto out_sockmap; } - close(udp); /* Test update without programs */ for (i = 0; i < 6; i++) { -- 2.53.0