From patchwork Wed Jun 12 09:19:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13694681 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0223416D9B8; Wed, 12 Jun 2024 09:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183967; cv=none; b=s4+ZC3bjHaMzWEYLeSB4G65J0v6NjdPD5ClhN7K8LX91MHCzVbJqOQ6H98v8xAphne4Qi0evyS6JWk2GH3Qgh+a5F7trld8UKOoR75U4z1oN02QXWvULG4dXq7IhisclLeK5lXZAAbfpw82liRqqfsk3ck3/9K9g+AuyulVGxyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183967; c=relaxed/simple; bh=ywnb+DhiBaWLlcskKAsMq45MMHp/bpKNsS6PRDDRLkQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PbILhqzkAAwKtVDHI9kYB/3OWHkr6xLI7nY1UeeTNSLc525nMmILGbqW9C7CLIC9EMufv09/3ZZNnf1qUccwrk+nTPGD0Xg8OPaovd3oVNDYwzGjtTC3yOhBG4K3xdNWk7wXKP+1NWdrAgYfaRwT2Ok7FuHd4pyqQT/OzgIajV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EeKcN0Vk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EeKcN0Vk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8571BC3277B; Wed, 12 Jun 2024 09:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718183966; bh=ywnb+DhiBaWLlcskKAsMq45MMHp/bpKNsS6PRDDRLkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeKcN0VktEkKOw3BeFTl8YbygzXOn/yBr1pAeqnPMxJCWLXgvYDF8pjZQeAzEElwA ODDFkqhv8gWsvzh8eZu10FqjszMdWmBUtMYoj8EuIHqDROApnhRB2qwO0tqdjFHSXm h/vI6+utghodFw85tV9vfY9gfz1r1jUQyu2s30aZdQIH5vA2hTUFh3LVdwencO+oPn EdgUFKlmI4OIHHxd2V5+qMV3YLBRIrRT6qGaUtfjH5SjvPPWgk1pv8Un8jvnIlSKyO +O4Iw9/tm6UWb+Iu6E4bsm4FC7TEXB/0sE9CeAJP/EWGSkpPR9z9CzMiCr8BPEs8CZ 2S2mlzawJgQ9w== From: Geliang Tang To: Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Boris Pismenny , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Sitnicki Cc: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect Date: Wed, 12 Jun 2024 17:19:03 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang tls_sw doesn't work for sk_redirect in nonblock mode, sk_msg_recvmsg() returns 0 in that case in tls_sw_recvmsg(). This patch fixes this by using "continue" to receive msg again instead of ending it if strp isn't ready and rx_list is empty. Signed-off-by: Geliang Tang --- net/tls/tls_sw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 305a412785f5..ae8bbe7dc8ec 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2017,6 +2017,9 @@ int tls_sw_recvmsg(struct sock *sk, len -= chunk; continue; } + if (!chunk && !tls_strp_msg_ready(ctx) && + skb_queue_empty_lockless(&ctx->rx_list)) + continue; } goto recv_end; } From patchwork Wed Jun 12 09:19:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13694682 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 044832AEE3; Wed, 12 Jun 2024 09:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183975; cv=none; b=gf3dTN+vTKR6ZdnTPf3Bp9OeldBPlpoB+H6XzFKt6/+T0LE/djLa2s0Jvl29w4RgPS8IsE3gZ3ImtwkZKHMHDBwJ9004yB9elzGcFVMO4D3P8gyWriwyDrpdbRdxK6WEabHBkUhmDucQrC+HGM5pxsfJp5NocJpfxJljCXhzGLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183975; c=relaxed/simple; bh=VWF2BN3M74sWgL4r0nHVKCmPDvs57NQeQDcbDpP5OYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XUERAZY0Kp7nBi5HoJ3Djtvb1+w2ALGhQMPLg3W757wgprRSz8rzqmKa7ryeckk5iUxKf13yk2UYPeFnrk1pbRKIbzzPbIC1bD4DQil8hubYM67mC2xxTyFkdpNTNJKZUJW/x88LsykxBfI82st5JhGHd6HJ53gQm0IV6azwoww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JE0+tbvW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JE0+tbvW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 235B7C4AF48; Wed, 12 Jun 2024 09:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718183974; bh=VWF2BN3M74sWgL4r0nHVKCmPDvs57NQeQDcbDpP5OYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JE0+tbvW0j09JGIOaGiJqVIXDw22trEwQWoQp1DZrucwJbpk9i3ecI1z6nknrbee7 Snc9xO/vHP9RIGSZKy/T3ycP1ENXlaPr9+lr4VcdLwLP3D2mYQpGOV4ejo9ocqBb+w A5RdWYF0w498tf+elYvXPPVzfAUjppUfPacpCqZEfUCASLfl8I+WC4iIysj+MykTO9 MtOpZO+ChidNQXfTmUPebdpYoXW9w/XLjw63rn/PyoatC5/p96DrW3D/kzsnu8ZyEW g+HFiqTBcJM6S5xdd+iZOASF7xaZNyAMCdGD0ncGMkFWWsqp+5IpI6QNLGK+l5qB/6 n/fd56Dy9dQig== From: Geliang Tang To: Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Boris Pismenny , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Sitnicki Cc: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v7 2/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Date: Wed, 12 Jun 2024 17:19:04 +0800 Message-ID: <783f589f00b91ae3f8812a736fd64b4eb4251364.1718182183.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Incorrect arguments are passed to fcntl() in test_sockmap.c when invoking it to set file status flags. If O_NONBLOCK is used as 2nd argument and passed into fcntl, -EINVAL will be returned (See do_fcntl() in fs/fcntl.c). The correct approach is to use F_SETFL as 2nd argument, and O_NONBLOCK as 3rd one. Fixes: 16962b2404ac ("bpf: sockmap, add selftests") Signed-off-by: Geliang Tang Acked-by: Yonghong Song --- tools/testing/selftests/bpf/test_sockmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 9cba4ec844a5..99d3ca8e44bb 100644 --- a/tools/testing/selftests/bpf/test_sockmap.c +++ b/tools/testing/selftests/bpf/test_sockmap.c @@ -604,7 +604,9 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, struct timeval timeout; fd_set w; - fcntl(fd, fd_flags); + if (fcntl(fd, F_SETFL, fd_flags)) + goto out_errno; + /* Account for pop bytes noting each iteration of apply will * call msg_pop_data helper so we need to account for this * by calculating the number of apply iterations. Note user