All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] recvfrom01: fix test for invalid message flags
@ 2014-10-01 22:10 Chuck Ebbert
  2014-10-27 10:20 ` Cyril Hrubis
  2015-01-06 10:07 ` Jan Stancek
  0 siblings, 2 replies; 5+ messages in thread
From: Chuck Ebbert @ 2014-10-01 22:10 UTC (permalink / raw)
  To: ltp-list

The recv tests were making invalid assumptions about how flags are
checked by the kernel. (It makes no explicit tests for invalid flags
or combinations of flags.) [1] So the current method of setting every
possible flag and checking for a specific error is not valid.

Before kernel 3.17 we were effectively just testing having the MSG_OOB
flag set with no out-of-band data available. With 3.17 and later we
were testing having MSG_ERRQUEUE set with no error data available,
which returns a different error (and causes the existing test to fail).

Replace the bogus test for invalid flags with two new tests that check
return codes for invalid MSG_OOB and MSG_ERRQUEUE flags.

Note that this introduces a failure on kernels before 3.17, which has
a bug fix for MSG_ERRQUEUE flag handling. This failure is a legitimate
bug on these older kernels. (They should not be returning success with
no data available.)

[1] http://marc.info/?t=141148149900006&r=1&w=2

---

Additional test cases for invalid flags could be added after these two.
And the recv01 and recvmsg01 tests need still need to be fixed, assuming
this is the right solution.

--- a/testcases/kernel/syscalls/recvfrom/recvfrom01.c
+++ b/testcases/kernel/syscalls/recvfrom/recvfrom01.c
@@ -115,9 +115,14 @@
 		    -1, EFAULT, setup1, cleanup1, "invalid recv buffer"},
 /* 6 */
 	{
-	PF_INET, SOCK_STREAM, 0, (void *)buf, sizeof(buf), -1,
+	PF_INET, SOCK_STREAM, 0, (void *)buf, sizeof(buf), MSG_OOB,
 		    (struct sockaddr *)&from, &fromlen,
-		    -1, EINVAL, setup1, cleanup1, "invalid flags set"},};
+		    -1, EINVAL, setup1, cleanup1, "invalid MSG_OOB flag set"},
+/* 7 */
+	{
+	PF_INET, SOCK_STREAM, 0, (void *)buf, sizeof(buf), MSG_ERRQUEUE,
+		    (struct sockaddr *)&from, &fromlen,
+		    -1, EAGAIN, setup1, cleanup1, "invalid MSG_ERRQUEUE flag set"},};
 
 int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
 

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] recvfrom01: fix test for invalid message flags
  2014-10-01 22:10 [LTP] recvfrom01: fix test for invalid message flags Chuck Ebbert
@ 2014-10-27 10:20 ` Cyril Hrubis
  2014-11-26 11:38   ` Cyril Hrubis
  2015-01-06 10:07 ` Jan Stancek
  1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2014-10-27 10:20 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: ltp-list

Hi!
> The recv tests were making invalid assumptions about how flags are
> checked by the kernel. (It makes no explicit tests for invalid flags
> or combinations of flags.) [1] So the current method of setting every
> possible flag and checking for a specific error is not valid.
> 
> Before kernel 3.17 we were effectively just testing having the MSG_OOB
> flag set with no out-of-band data available. With 3.17 and later we
> were testing having MSG_ERRQUEUE set with no error data available,
> which returns a different error (and causes the existing test to fail).
> 
> Replace the bogus test for invalid flags with two new tests that check
> return codes for invalid MSG_OOB and MSG_ERRQUEUE flags.
> 
> Note that this introduces a failure on kernels before 3.17, which has
> a bug fix for MSG_ERRQUEUE flag handling. This failure is a legitimate
> bug on these older kernels. (They should not be returning success with
> no data available.)

Sorry for the delay, acked, tested and pushed, thanks.

Will you also send similar patches for the rest of the recv testcases?

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] recvfrom01: fix test for invalid message flags
  2014-10-27 10:20 ` Cyril Hrubis
@ 2014-11-26 11:38   ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2014-11-26 11:38 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: ltp-list

Hi!
> Sorry for the delay, acked, tested and pushed, thanks.
> 
> Will you also send similar patches for the rest of the recv testcases?

FYI: I've fixex recvmsg01 and recv01 as well. Again, sorry for the
delay.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] recvfrom01: fix test for invalid message flags
  2014-10-01 22:10 [LTP] recvfrom01: fix test for invalid message flags Chuck Ebbert
  2014-10-27 10:20 ` Cyril Hrubis
@ 2015-01-06 10:07 ` Jan Stancek
  2015-01-08 10:43   ` Cyril Hrubis
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2015-01-06 10:07 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: ltp-list





----- Original Message -----
> From: "Chuck Ebbert" <cebbert.lkml@gmail.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, 2 October, 2014 12:10:32 AM
> Subject: [LTP] recvfrom01: fix test for invalid message flags
> 


> Note that this introduces a failure on kernels before 3.17, which has
> a bug fix for MSG_ERRQUEUE flag handling. This failure is a legitimate
> bug on these older kernels. (They should not be returning success with
> no data available.)

I hit a failure in this testcase while trying latest LTP before release.
Are you sure this is a bug?

Looking at commit history and man-pages, this looks more like new feature to me,
flag that has not been supported before and now it is.

"MSG_ERRQUEUE is illegal on SOCK_STREAM sockets." [1]
"TCP timestamping introduced MSG_ERRQUEUE handling for TCP sockets." [2][3]

Until commit [3], tcp_recvmsg() has ignored this flag and it was also documented
that way. So, I don't see why TFAIL is valid result on <3.17 for MSG_ERRQUEUE test:

 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
 connect(3, {sa_family=AF_INET, sin_port=htons(59273), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
 select(4, [3], NULL, NULL, {2, 0})      = 1 (in [3], left {1, 999998})
 recvfrom(3, "hoser\n", 1024, MSG_ERRQUEUE, NULL, NULL) = 6

Regards,
Jan

[1] https://lkml.org/lkml/2006/9/18/182
[2] f4713a3dfad045d46afcb9c2a7d0bba288920ed4
[3] 4ed2d765dfaccff5ebdac68e2064b59125033a3b

> 
> [1] http://marc.info/?t=141148149900006&r=1&w=2
> 
> ---
> 
> Additional test cases for invalid flags could be added after these two.
> And the recv01 and recvmsg01 tests need still need to be fixed, assuming
> this is the right solution.
> 
> --- a/testcases/kernel/syscalls/recvfrom/recvfrom01.c
> +++ b/testcases/kernel/syscalls/recvfrom/recvfrom01.c
> @@ -115,9 +115,14 @@
>  		    -1, EFAULT, setup1, cleanup1, "invalid recv buffer"},
>  /* 6 */
>  	{
> -	PF_INET, SOCK_STREAM, 0, (void *)buf, sizeof(buf), -1,
> +	PF_INET, SOCK_STREAM, 0, (void *)buf, sizeof(buf), MSG_OOB,
>  		    (struct sockaddr *)&from, &fromlen,
> -		    -1, EINVAL, setup1, cleanup1, "invalid flags set"},};
> +		    -1, EINVAL, setup1, cleanup1, "invalid MSG_OOB flag set"},
> +/* 7 */
> +	{
> +	PF_INET, SOCK_STREAM, 0, (void *)buf, sizeof(buf), MSG_ERRQUEUE,
> +		    (struct sockaddr *)&from, &fromlen,
> +		    -1, EAGAIN, setup1, cleanup1, "invalid MSG_ERRQUEUE flag set"},};
>  
>  int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
>  
> 
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] recvfrom01: fix test for invalid message flags
  2015-01-06 10:07 ` Jan Stancek
@ 2015-01-08 10:43   ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2015-01-08 10:43 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list, Chuck Ebbert

Hi!
> > Note that this introduces a failure on kernels before 3.17, which has
> > a bug fix for MSG_ERRQUEUE flag handling. This failure is a legitimate
> > bug on these older kernels. (They should not be returning success with
> > no data available.)
> 
> I hit a failure in this testcase while trying latest LTP before release.
> Are you sure this is a bug?
> 
> Looking at commit history and man-pages, this looks more like new feature to me,
> flag that has not been supported before and now it is.
> 
> "MSG_ERRQUEUE is illegal on SOCK_STREAM sockets." [1]
> "TCP timestamping introduced MSG_ERRQUEUE handling for TCP sockets." [2][3]
> 
> Until commit [3], tcp_recvmsg() has ignored this flag and it was also documented
> that way. So, I don't see why TFAIL is valid result on <3.17 for MSG_ERRQUEUE test:

I think that there is no harm in disabling that case for kernels prior 3.17.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2015-01-08 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 22:10 [LTP] recvfrom01: fix test for invalid message flags Chuck Ebbert
2014-10-27 10:20 ` Cyril Hrubis
2014-11-26 11:38   ` Cyril Hrubis
2015-01-06 10:07 ` Jan Stancek
2015-01-08 10:43   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.