----- Original Message -----
> From: "Nitin Yadav" <[email protected]>
> To: [email protected], [email protected], "Jan Stancek" 
> <[email protected]>
> Cc: [email protected]
> Sent: Thursday, 18 October, 2012 9:26:38 AM
> Subject: RE: [LTP] [PATCH] io_submit: uninitialized iocb may notreturn-EINVAL
> 
> Hi all,
>    May be because of the following reason io_submit returns value 1
> success:
>    1) Uninitialized iocb structure may have some valid data (means
>    some
> time uninitialized structure would be equal to 1)
>    2) memory space would have to be emitted by the compiler for
>    "iocb".
>    3) The contents of this memory location should be considered
>    random.
> 
> Even in LTP code struct iocb *iocbs is first initialized with
> iocbs[0] =
> &iocb; May some time iocbs will contain valid data which is enough
> for
> the operation.
>       Should I remove iocbs[0] = &iocb; this line from the code, so
> that it will be make sure that iocbs structure is properly
> uninitialized.

I would either remove that case or make sure it eventually fails
on something. It can still test with mostly random data, but some
part of it should never allow call to succeed:

diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c 
b/testcases/kernel/syscalls/io_submit/io_submit01.c
index 2494863..4e03fb1 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -125,6 +125,11 @@ int main(int argc, char *argv[])
 
                /* 1.3 - EINVAL: uninitialized iocb */
                iocbs[0] = &iocb;
+               /* There are multiple checks we can hit with uninitialized
+                * iocb, but with "random" data it's not 100%. Make sure we
+                * fail eventually in opcode check. */
+               iocb.aio_lio_opcode = -1;
+
                TEST(io_submit(ctx, 1, iocbs));
                switch(TEST_RETURN) {
                case -EINVAL:

Regards,
Jan

> 
> Thanks,
> Nitin Yadav
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Wednesday, October 17, 2012 6:15 PM
> To: Nitin Yadav
> Cc: [email protected]; Jan Stancek;
> [email protected]
> Subject: Re: [LTP] [PATCH] io_submit: uninitialized iocb may
> notreturn-EINVAL
> 
> Hi!
> > When the test fails, the return value from io_submit() is 1. This
> > means that io_submit successfully submitted one I/O request block
> > for
> > processing.
> >     Could you please let me know is it correct behavior to
> successfully
> > submit io request for uninitialized iocb with return value
> > 1 (-EPERM).
> 
> As far as I understand io_submit() return value 1 is success i.e. 1
> io
> request queued. So I think that in your case the uninitialized
> structure
> contains data valid enough for the operation to be actually queued.
> 
> --
> Cyril Hrubis
> [email protected]
> 
> Information transmitted by this e-mail is proprietary to MphasiS, its
> associated companies and/ or its customers and is intended
> for use only by the individual or entity to which it is addressed,
> and may contain information that is privileged, confidential or
> exempt from disclosure under applicable law. If you are not the
> intended recipient or it appears that this mail has been forwarded
> to you without proper authority, you are notified that any use or
> dissemination of this information in any manner is strictly
> prohibited. In such cases, please notify us immediately at
> [email protected] and delete this mail from your records.
> 
> 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to