io_submit: uninitialized iocb may not return -EINVAL
PATCH 1/1 io_submit: uninitialized iocb may not return -EINVAL
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.
--- testcases/kernel/syscalls/io_submit/io_submit01.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
testcases/kernel/syscalls/io_submit/io_submit01.c +15 -1
@@ -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 ));
------------------------------------------------------------------------------
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/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi Jan,
Quoted 41 lines
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 <[email protected]>--- testcases/kernel/syscalls/io_submit/io_submit01.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)0001-io_submit-uninitialized-iocb-may-not-return-EINVAL.patch
testcases/kernel/syscalls/io_submit/io_submit01.c +0
-0
testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 133
Quoted 9 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +5
-1@@ -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 :
I don't think io_submit(2) can return -EPERM.
Do you think so?
Thanks,
Wanlong Gao
Quoted 5 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +3
-0+tst_resm (TPASS ,"expected failure - " +"returned value = %ld : %s" , +TEST_RETURN ,strerror (-1 *TEST_RETURN ));
testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 146
Quoted 10 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +7
-0+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 ));
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi Jan,
Quoted 38 lines
Hi Jan,
Quoted 36 lines
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 <[email protected]>--- testcases/kernel/syscalls/io_submit/io_submit01.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)0001-io_submit-uninitialized-iocb-may-not-return-EINVAL.patch
Quoted 12 lines
testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 131
Quoted 12 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +3
-1@@ -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 :
Here the coding style should like:
switch() {
case xx:
case xx:but not:
switch() {
case xx:
case xx:Thanks,
Wanlong Gao
Quoted 22 lines
testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 133
Quoted 2 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +2
-0+case -EFAULT : +case -EPERM :I don't think
io_submit(2)can return-EPERM.Do you think so?
Thanks,
Wanlong GaoQuoted 11 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +10
-0+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 )); + }
Quoted 16 lines
testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 146
Quoted 4 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +0
-0/* 2 - EFAULT: iocb points to invalid data */ TEST (io_submit (ctx,1 , (struct iocb **)-1 ));------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
----- Original Message -----
Quoted 65 lines
From: "Wanlong Gao" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected], "Jeffrey Burke" <[email protected]>
Sent: Thursday, March 15, 2012 2:09:48 AM
Subject: Re: [LTP] [PATCH]io_submit: uninitialized iocb may not return-EINVALHi Jan,
Quoted 44 lines
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 <[email protected]>--- testcases/kernel/syscalls/io_submit/io_submit01.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)0001-io_submit-uninitialized-iocb-may-not-return-EINVAL.patch
testcases/kernel/syscalls/io_submit/io_submit01.c +0
-0testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 133
Quoted 9 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +5
-1@@ -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 :I don't think
io_submit(2)can return-EPERM.
Quoted 1 line
Do you think so?
I was trying all sorts of random data and I remember seeing once "-1". I'm failing to reproduce it today, so I could be wrong. If I fail to find data that gives -EPERM, I'll remove it in v2.
Regards,
Jan
Quoted 4 lines
Thanks,
Wanlong Gao
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi Jan,
Quoted 16 lines
Quoted 16 lines
testcases/kernel/syscalls/io_submit/io_submit01.c int main(int argc, char *argv[]) · line 133
Quoted 12 lines
testcases/kernel/syscalls/io_submit/io_submit01.c +5
-1@@ -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 :I don't think
io_submit(2)can return-EPERM.
Quoted 5 lines
Quoted 1 line
Do you think so?
I was trying all sorts of random data and I remember seeing once "-1". I'm failing to reproduce it today, so I could be wrong. If I fail to find data that gives
-EPERM, I'll remove it in v2.
I looked into the io_submit(2) code in kernel and didn't see any path can return -EPERM, so I think you should confirm on it again.
Thanks,
Wanlong Gao
Quoted 10 lines
Regards,
JanQuoted 4 lines
Thanks,
Wanlong Gao
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list