From nobody Wed Sep 10 01:55:30 2025 Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37]) (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 CE3BC3451CC for ; Fri, 5 Sep 2025 11:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757070726; cv=none; b=ieYFwI4bnZuwmkiO5yXQc0uJuODtVAgTKmRRDH2A13Nvx9RxjVrs8zp7qmZaQAyiby4FJ0CBdxbXA3tckuonaPmDvDUjmcUPpkN5/mwkJ3KvF2vDP345bdHGnr56jht3vmIBB4gJss+P8pRwlVRAe+PSZ1YicMVv50iN8JGVQ6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757070726; c=relaxed/simple; bh=5l2WmyIrw4huA09wl6EzkxVuMibO25q87hLx+ZzI/VI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SiEGAXaFYAzrobOdIvckIwGtbpYAyE0UX2uyEpBL8gWCetyH0sHLcviYu0VUgOkGl1scyOP/Ky4bmayo4lTlZtnjF1uarawcv74DkhTwemLAQi4+DJOvyWqh3X19COVN3o6ipRmTyWrHSDNhJDQnIev634KuG3dMM4PdULmk2F4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=oXYlez50; arc=none smtp.client-ip=185.226.149.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="oXYlez50" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1uuUME-003UQ7-16; Fri, 05 Sep 2025 13:11:54 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From; bh=tNtuGg01lWaBXl/Af0XL6hoU9LuTDSKEgUeGslbsWt4=; b=oXYlez50bt20WSNhQDLhduPHNd m9CcOgL/j6H789vkbYAhzrAgaH8JghjdQbCh7KnPCU5MDzddOpTVp2JMMVZx7IKFGlwZ6LwjlYRqC I9F1CGUTt4/D7Ofc+INuTxukPdnaD0WgU2ZDiRBsqnXpsCR9+eLAsDsHegQXTqB1y+x8FdYAcR/00 bUtB5Y4fcmeRoQTgQIh0EEFpgk4I7+/7+RQXne6ydWo2/Ce+oG+gi2/hhoMNPPBRc5SZxW8VHt6p1 iy1k2EUy5tJNdLVS1VVH7e4Z1NxXgU0Xm399ftttwWb9uFEKEuP9Vkl4cDmtuqXwE/pAU+LVvOKLH +EhTRsxw==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1uuUMD-00006H-8d; Fri, 05 Sep 2025 13:11:53 +0200 Received: by submission02.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1uuUMB-002yZ1-0q; Fri, 05 Sep 2025 13:11:51 +0200 From: Michal Luczaj Date: Fri, 05 Sep 2025 13:11:42 +0200 Subject: [PATCH bpf-next 2/5] selftests/bpf: sockmap_redir: Fix OOB handling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250905-redir-test-pass-drop-v1-2-9d9e43ff40df@rbox.co> References: <20250905-redir-test-pass-drop-v1-0-9d9e43ff40df@rbox.co> In-Reply-To: <20250905-redir-test-pass-drop-v1-0-9d9e43ff40df@rbox.co> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Luczaj X-Mailer: b4 0.14.2 In some test cases, OOB packets might have been left unread. Flush them out and introduce additional checks. Signed-off-by: Michal Luczaj --- tools/testing/selftests/bpf/prog_tests/sockmap_redir.c | 16 ++++++++++++++= ++ 1 file changed, 16 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c b/tools= /testing/selftests/bpf/prog_tests/sockmap_redir.c index c1bf1076e8152b7d83c3e07e2dce746b5a39cf7e..4997e72c14345b274367f3f2f41= 15c39d1ae48c9 100644 --- a/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c @@ -184,6 +184,19 @@ static void handle_unsupported(int sd_send, int sd_pee= r, int sd_in, int sd_out, FAIL_ERRNO("unsupported: packet missing, retval=3D%zd", n); } =20 + /* af_unix send("ab", MSG_OOB) spits out 2 packets, but only the latter + * ("b") is designated OOB. If the peer is in a sockmap, the OOB packet + * will be silently dropped. Otherwise OOB stays in the queue and should + * be taken care of. + */ + if ((send_flags & MSG_OOB) && !pass && !drop) { + errno =3D 0; + n =3D recv_timeout(sd_peer, &recv_buf, 1, MSG_OOB, IO_TIMEOUT_SEC); + /* Ignore unsupported sk_msg error */ + if (n !=3D 1 && errno !=3D EOPNOTSUPP) + FAIL_ERRNO("recv(OOB): retval=3D%zd", n); + } + /* Ensure queues are empty */ fail_recv("bpf.recv(sd_send)", sd_send, 0); if (sd_in !=3D sd_send) @@ -192,6 +205,9 @@ static void handle_unsupported(int sd_send, int sd_peer= , int sd_in, int sd_out, fail_recv("bpf.recv(sd_out)", sd_out, 0); if (sd_recv !=3D sd_out) fail_recv("bpf.recv(sd_recv)", sd_recv, 0); + + fail_recv("recv(sd_peer, OOB)", sd_peer, MSG_OOB); + fail_recv("recv(sd_out, OOB)", sd_out, MSG_OOB); } =20 static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer, --=20 2.50.1