Thanks Yamato.
Regards--
Subrata
On Wed, 2008-10-22 at 22:50 +0900, Masatake YAMATO wrote:
> > Yamato,
> >
> > You would like to say something here ?
> >
> > Regards--
> > Subrata
>
> Sorry to be late to reply.
>
>
>
> > > io_submit case always failed on ppc64.
> > >
> > > ----------
> > > [EMAIL PROTECTED] cvs_ltp]# uname -a
> > > Linux ovislp1.upt.austin.ibm.com 2.6.18-92.el5 #1 SMP Tue Apr 29
> > > 13:21:29 EDT
> > > 2008 ppc64 ppc64 ppc64 GNU/Linux
> > > [EMAIL PROTECTED] cvs_ltp]# rpm -qa | grep libaio
> > > libaio-0.3.106-3.2
> > > libaio-0.3.106-3.2
> > > libaio-devel-0.3.106-3.2
> > > libaio-devel-0.3.106-3.2
> > > [EMAIL PROTECTED] cvs_ltp]#
> > > testcases/kernel/syscalls/io_submit/io_submit01
> > > io_submit01 1 PASS : expected failure - returned value = 22 :
> > > Invalid argument
> > > io_submit01 2 FAIL : unexpected returned value - -22 - expected
> > > -14
> > > io_submit01 3 PASS : expected failure - returned value = 9 : Bad
> > > file descriptor
> > >
> > > There could be an issue with the test case here. What is done is "
> > > io_submit(ctx, 0, (void*)-1 ) ".So in compat_sys_io_submit(), we
> > > allocate memory on the user space stack using
> > > compat_alloc_user_space.
> > > We then copy from the address specified in the syscall to the address
> > > allocated via the compat_alloc_user_space call. Now, if the size
> > > field
> > > is zero, no copy takes place. This valid address (stack pointer or
> > > an address close to it) is then used in sys_io_submit and we dont see
> > > the EFAULT. In order to see this fault, we would have to set nr>0 and
> > > copy_iocb() catches the invalid address specified in the system call.
> > > Retrying the test with nr>0 results in an EFAULT.
> > >
> > > Signed-off-by: Sridhar Vinay <[EMAIL PROTECTED]>
> > > Signed-off-by: Jin Bing Guo <[EMAIL PROTECTED]>
>
> I've understood the explanation and I've confirmed the correctness.
> But I think the behavior of io_submit(ctx, 0, (void*)-1 ) on ppc64 is
> interesting. So I don't like to throw io_submit(ctx, 0, (void*)-1 )
> test case away <A>. Also I'd like to dig the kernel more <B>.
>
> For <B> I'd like to submit following patch to lkml in the future:
> diff --git a/fs/compat.c b/fs/compat.c
> index 5f9ec44..5bfa69f 100644
> --- a/fs/compat.c
> +++ b/fs/compat.c
> @@ -584,6 +584,16 @@ compat_sys_io_submit(aio_context_t ctx_id, int nr, u32
> __user *iocb)
> if (nr > MAX_AIO_SUBMITS)
> nr = MAX_AIO_SUBMITS;
>
> + /* sys_io_submit() uses newly allocated buffer(iocb64) from safety
> + area. But access_ok checking is needed to make the behavior
> + of compat_sys_io_submit same to sys_io_submit.
> +
> + Without the checking
> + comapt_sys_io_submit(ctx, 0, (void*)-1 ) returns -EINVAL.
> + sys_io_submit(ctx, 0, (void*)-1 ) returns -EFAULT. */
> + if (unlikely(!access_ok(VERIFY_READ, iocb, (nr*sizeof(*iocb)))))
> + return -EFAULT;
> +
> iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64));
> ret = copy_iocb(nr, iocb, iocb64);
> if (!ret)
>
>
> For <A> I've revised the patch.
>
> Signed-off-by: Sridhar Vinay <[EMAIL PROTECTED]>
> Signed-off-by: Jin Bing Guo <[EMAIL PROTECTED]>
> Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]>
>
> --- a/testcases/kernel/syscalls/io_submit/io_submit01.c
> +++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
> @@ -128,7 +128,7 @@ main(int argc, char** argv)
> EFAULT One of the data structures points to invalid data.
> */
> expected_return = -EFAULT;
> - TEST(io_submit( ctx, 0, (void*)-1 ));
> + TEST(io_submit( ctx, 1, (void*)-1 ));
> if (TEST_RETURN == 0) {
> tst_resm(TFAIL, "call succeeded unexpectedly");
> } else if (TEST_RETURN == expected_return) {
> @@ -141,6 +141,34 @@ main(int argc, char** argv)
> expected_return);
> }
>
> + /* Special case EFAULT or EINVAL (indetermination)
> +
> + The errno depends on the per architecture implementation
> + of io_submit. On the architecture using compat_sys_io_submit
> + as its implementation, errno is set to -EINVAL. */
> + {
> + long expected_fault = -EFAULT;
> + long expected_inval = -EINVAL;
> +
> +
> + TEST(io_submit( ctx, 0, (void*)-1 ));
> + if (TEST_RETURN == 0) {
> + tst_resm(TFAIL, "call succeeded unexpectedly");
> + } else if (TEST_RETURN == expected_fault
> + || TEST_RETURN == expected_inval) {
> + tst_resm(TPASS, "expected failure - "
> + "returned value = %d : %s", (-1 *
> TEST_RETURN),
> + strerror(-1 * TEST_RETURN));
> + } else {
> + tst_resm(TFAIL, "unexpected returned value - %d
> - "
> + "expected %d(%s) or %d(%s)",
> TEST_RETURN,
> + expected_fault, strerror(-1 *
> expected_fault),
> + expected_inval, strerror(-1 *
> expected_inval));
> + }
> +
> + }
> +
> +
> /*
> EBADF The file descriptor specified in the first iocb is
> invalid.
> */
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list