Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: tls: use ASSERT_GE in test_mutliproc
@ 2026-05-21  9:11 Geliang Tang
  2026-05-21 10:57 ` Jiayuan Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Geliang Tang @ 2026-05-21  9:11 UTC (permalink / raw)
  To: John Fastabend, Jakub Kicinski, Sabrina Dubroca, David S. Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan
  Cc: Geliang Tang, netdev, linux-kselftest

From: Geliang Tang <tanggeliang@kylinos.cn>

In test_mutliproc(), when send() or recv() returns an error (e.g.,
-1), the test continues to execute the remaining code and fails
repeatedly due to using EXPECT_GE.

For example, if a TLS connection is broken and recv() returns -1,
EXPECT_GE(res, 0) records a failure but does not stop the test.
The test then proceeds with left -= res (where res = -1), causing
left to increase unexpectedly, and the loop continues indefinitely.

This results in a massive number of identical failure messages:

 # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
 # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
 ... (hundreds of identical failures)

Fix this by replacing EXPECT_GE with ASSERT_GE. When send() or recv()
fails, ASSERT_GE immediately aborts the current test, preventing
the subsequent undefined behavior and endless failure messages.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/net/tls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 30a236b8e9f7..9b9a3cb2700d 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -1549,7 +1549,7 @@ test_mutliproc(struct __test_metadata *_metadata, struct _test_data_tls *self,
 			res = recv(self->cfd, rb,
 				   left > sizeof(rb) ? sizeof(rb) : left, 0);
 
-			EXPECT_GE(res, 0);
+			ASSERT_GE(res, 0);
 			left -= res;
 		}
 	} else {
@@ -1566,7 +1566,7 @@ test_mutliproc(struct __test_metadata *_metadata, struct _test_data_tls *self,
 				res = send(self->fd, buf,
 					   left > file_sz ? file_sz : left, 0);
 
-			EXPECT_GE(res, 0);
+			ASSERT_GE(res, 0);
 			left -= res;
 		}
 	}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: tls: use ASSERT_GE in test_mutliproc
  2026-05-21  9:11 [PATCH net-next] selftests: tls: use ASSERT_GE in test_mutliproc Geliang Tang
@ 2026-05-21 10:57 ` Jiayuan Chen
  2026-05-21 14:07   ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Jiayuan Chen @ 2026-05-21 10:57 UTC (permalink / raw)
  To: Geliang Tang, John Fastabend, Jakub Kicinski, Sabrina Dubroca,
	David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	Shuah Khan
  Cc: Geliang Tang, netdev, linux-kselftest


On 5/21/26 5:11 PM, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> In test_mutliproc(), when send() or recv() returns an error (e.g.,
> -1), the test continues to execute the remaining code and fails
> repeatedly due to using EXPECT_GE.
>
> For example, if a TLS connection is broken and recv() returns -1,
> EXPECT_GE(res, 0) records a failure but does not stop the test.
> The test then proceeds with left -= res (where res = -1), causing
> left to increase unexpectedly, and the loop continues indefinitely.
>
> This results in a massive number of identical failure messages:
>
>   # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
>   # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
>   ... (hundreds of identical failures)

I think it’s worth backporting, so a Fixes tag is necessary.


> Fix this by replacing EXPECT_GE with ASSERT_GE. When send() or recv()
> fails, ASSERT_GE immediately aborts the current test, preventing
> the subsequent undefined behavior and endless failure messages.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>   tools/testing/selftests/net/tls.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
> index 30a236b8e9f7..9b9a3cb2700d 100644
> --- a/tools/testing/selftests/net/tls.c
> +++ b/tools/testing/selftests/net/tls.c
> @@ -1549,7 +1549,7 @@ test_mutliproc(struct __test_metadata *_metadata, struct _test_data_tls *self,
>   			res = recv(self->cfd, rb,
>   				   left > sizeof(rb) ? sizeof(rb) : left, 0);
>   
> -			EXPECT_GE(res, 0);
> +			ASSERT_GE(res, 0);
>   			left -= res;
>   		}
>   	} else {
> @@ -1566,7 +1566,7 @@ test_mutliproc(struct __test_metadata *_metadata, struct _test_data_tls *self,
>   				res = send(self->fd, buf,
>   					   left > file_sz ? file_sz : left, 0);
>   
> -			EXPECT_GE(res, 0);
> +			ASSERT_GE(res, 0);
>   			left -= res;
>   		}
>   	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: tls: use ASSERT_GE in test_mutliproc
  2026-05-21 10:57 ` Jiayuan Chen
@ 2026-05-21 14:07   ` Jakub Kicinski
  2026-05-21 14:20     ` Jiayuan Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2026-05-21 14:07 UTC (permalink / raw)
  To: Jiayuan Chen
  Cc: Geliang Tang, John Fastabend, Sabrina Dubroca, David S. Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan, Geliang Tang,
	netdev, linux-kselftest

On Thu, 21 May 2026 18:57:32 +0800 Jiayuan Chen wrote:
> > This results in a massive number of identical failure messages:
> >
> >   # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
> >   # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
> >   ... (hundreds of identical failures)  
> 
> I think it’s worth backporting, so a Fixes tag is necessary.

Why? Is this bothering someone? Are you guys hitting this in real life?
I don't recall seeing such failure in netdev CIs.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: tls: use ASSERT_GE in test_mutliproc
  2026-05-21 14:07   ` Jakub Kicinski
@ 2026-05-21 14:20     ` Jiayuan Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Jiayuan Chen @ 2026-05-21 14:20 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Geliang Tang, John Fastabend, Sabrina Dubroca, David S. Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan, Geliang Tang,
	netdev, linux-kselftest


On 5/21/26 10:07 PM, Jakub Kicinski wrote:
> On Thu, 21 May 2026 18:57:32 +0800 Jiayuan Chen wrote:
>>> This results in a massive number of identical failure messages:
>>>
>>>    # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
>>>    # tls.c:1686:mutliproc_sendpage_writers:Expected res (-1) >= 0 (0)
>>>    ... (hundreds of identical failures)
>> I think it’s worth backporting, so a Fixes tag is necessary.
> Why? Is this bothering someone? Are you guys hitting this in real life?
> I don't recall seeing such failure in netdev CIs.


Upon second thought, if this issue occur during the development of a new 
feature,
then a Fixes tag is not necessary.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-21 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21  9:11 [PATCH net-next] selftests: tls: use ASSERT_GE in test_mutliproc Geliang Tang
2026-05-21 10:57 ` Jiayuan Chen
2026-05-21 14:07   ` Jakub Kicinski
2026-05-21 14:20     ` Jiayuan Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox