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 71E18175A6B; Mon, 17 Aug 2026 14:44:22 +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=1786977863; cv=none; b=AebDXIbGS5Ukb2URISBK6xgNlCi6Vw/fyrsVConwUNR4KbjixrcwdH0Xbs8heRZaiV+TqXYorxg9alJUx8xAPMl7FIq9IrUBf3YuN6vct6bkPWAfT2S+66ZRjhuhIUZTqbZyMWtQgccDSSQljtPqj7k9KmO5SaB6HIVwlse1fzg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786977863; c=relaxed/simple; bh=fqBJM8qiMRxzTvhgBsTgy0BiZqmx+QvgTHyEau7ZQXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AjtInD8B98aK5rtPpZZaZhQ8PmRSN7lY31Sjn5OsPwQoJlCDdXWyZSWFWnQhYcCodwOpZhuquC+FjF5sZ5gZx8QHgLhdurl7jWuhQ4+Od6QeZD2jLR20u8vz/LcKMo1u9AQqMtN6HDOqnHxw4foQEdJY2qGDAHhDKFBPqJSeaII= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lxW0u7yU; 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="lxW0u7yU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D27981F000E9; Mon, 17 Aug 2026 14:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786977862; bh=1iBezA5XphmLHheBBNrFryZ24vIM+xx3y4FTPmQN9DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lxW0u7yU7jDmN2701REel10kwW7GqC22jRUGu0TuDz8iwqoS/uWx9AJyZjh8wAzrJ +f0ng7h7+H9zfD0eRR+RGhF1B/ii/NfxduURGKZeI5ccMUVrPjAT7SdtP6a6vntpIy gXrDYmP3wsbj+Bo/xLMfhr2vAUHgD2IhrR2PNlks= 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 , "=?UTF-8?q?Ricardo=20B . =20Marli=C3=A8re=20 ?=" , Sasha Levin Subject: [PATCH 6.12 002/181] selftests/bpf: Fail unbound UDP on sockmap update Date: Mon, 17 Aug 2026 15:31:36 +0200 Message-ID: <20260817132535.497472590@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132535.394764707@linuxfoundation.org> References: <20260817132535.394764707@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-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: Ricardo B. Marlière (SUSE) 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 905d5981ace1b..6f080cc7eb96d 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