public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp-list@lists.sourceforge.net
Cc: Jeffrey Burke <jburke@redhat.com>
Subject: [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL
Date: Wed, 14 Mar 2012 15:53:00 +0100	[thread overview]
Message-ID: <4F60B0CC.606@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]


Testcase 1.3 - EINVAL: uninitialized iocb
is about submitting uninitialized iocb structure.

Test is expecting to get -EINVAL, but other values are also
possible as uninitialized struct can contain any values.

For example following data fails with -EBADF:
--- snip ---
unsigned char bad_iocb[64] = {
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x84, 0xa5,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x0f, 0xff, 0xe0, 0x10, 0x0c, 0x30,
     0x00, 0x00, 0x0f, 0xff, 0xe0, 0x10, 0x0c, 0x40,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
memcpy(&iocb, bad_iocb, sizeof(iocb));
iocbs[0] = &iocb;
TEST(io_submit(ctx, 1, iocbs));
check_result(-EINVAL, TEST_RETURN);
--- snip ---

This patch accepts also few other errno codes as valid return value.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
  testcases/kernel/syscalls/io_submit/io_submit01.c |   16 +++++++++++++++-
  1 files changed, 15 insertions(+), 1 deletions(-)



[-- Attachment #2: 0001-io_submit-uninitialized-iocb-may-not-return-EINVAL.patch --]
[-- Type: text/x-patch, Size: 991 bytes --]

diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index da15aa0..3983fa4 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -126,7 +126,21 @@ int main(int argc, char *argv[])
 		/* 1.3 - EINVAL: uninitialized iocb */
 		iocbs[0] = &iocb;
 		TEST(io_submit(ctx, 1, iocbs));
-		check_result(-EINVAL, TEST_RETURN);
+		switch(TEST_RETURN) {
+			case -EINVAL:
+			case -EBADF:
+			case -EFAULT:
+			case -EPERM:
+				tst_resm(TPASS, "expected failure - "
+						"returned value = %ld : %s",
+						TEST_RETURN, strerror(-1 * TEST_RETURN));
+				break;
+			default:
+				tst_resm(TFAIL, "unexpected failure - "
+						"returned value = %ld : %s, "
+						"expected one of -EINVAL, -EBADF, -EFAULT, -EPERM",
+						TEST_RETURN, strerror(-1 * TEST_RETURN));
+		}
 
 		/* 2 - EFAULT: iocb points to invalid data */
 		TEST(io_submit(ctx, 1, (struct iocb **)-1));


[-- Attachment #3: Type: text/plain, Size: 317 bytes --]

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

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

             reply	other threads:[~2012-03-14 14:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 14:53 Jan Stancek [this message]
2012-03-15  1:09 ` [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL Wanlong Gao
2012-03-15  2:09   ` Wanlong Gao
2012-03-15  7:48   ` Jan Stancek
2012-03-15  7:56     ` Wanlong Gao
  -- strict thread matches above, loose matches on Subject: below --
2012-06-27  9:52 [LTP] crashme:fork12 test may kill other process that is not forked child 羅秉鈞
2012-06-29  7:45 ` Wanlong Gao
2012-10-09  6:08   ` [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL Nitin Yadav
2012-10-16  2:31     ` Wanlong Gao
2012-10-16  6:53       ` Jan Stancek
2012-10-16 10:11         ` chrubis
2012-07-05 13:03 Nitin Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F60B0CC.606@redhat.com \
    --to=jstancek@redhat.com \
    --cc=jburke@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox