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 E73653F7A95; Mon, 17 Aug 2026 13:38:17 +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=1786973899; cv=none; b=B1RtS/q9Fgcblwk1yeCYJ+nu9YPAtzdhUUUVy7/PcXZnBvd3s19qwftkcIOcgw6B8zrJKjD8iv8+HfrMPdd1GgBlmeEwK1JWO1dnMq1Vg50G9BUipTMyH34+fmZ+yTuwpTASd0SRjgt7nCars66XM+r/71wWsYZAKmvqRxeZdc0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786973899; c=relaxed/simple; bh=xM4C5Pui6HwOoPfiWMUIqf9IVhbFOSUNgMCBj1wJYzQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z7pywcA3z6ZgxMn8RK6plxTwutfkFz8xjIzYdU1qHv+MfRGAXbb4LR8AkuJEHg5XuPnjUezW5SuzoRUQhJenMOGM8Q1ScUbGjfs1YTXBtLeqxsDYCM7swiB2Y+eHPHPpZMCcjVkLHxHf3vE5flg5D2L0dITLjRMvjN2XYkR+Knw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XyII4k7l; 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="XyII4k7l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E9181F000E9; Mon, 17 Aug 2026 13:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786973897; bh=Q3158EfgC3YPi+I9NwarnY/SXeNJaR6SmvCxBwEMAZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XyII4k7lkDtqwy7asSkH2BDv3JhzqrG1TGLrtiu49RnlZ/mWPTx9BLdIqdO+ROgRz f5L9Ak1+F4IND/wR3OtgyhhlbR0v7GRSJNTfzv0RN+x4UrQGQcofY+uV3nxiAHh+lI bDOYHnEPhGAqzNxssKwUbbAaVW4kWj6hm9bSfm+k= 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 7.1 002/271] selftests/bpf: Fail unbound UDP on sockmap update Date: Mon, 17 Aug 2026 15:28:47 +0200 Message-ID: <20260817132536.855399612@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132536.752504388@linuxfoundation.org> References: <20260817132536.752504388@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7.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: 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 ccc5acd55ff9d..d194b44ff8be8 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -748,16 +748,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