|
From: | balat.raju |
Subject: | Bug in AIO (Asynchronous I/O) functions in Linux! |
Date: | Fri, 11 Feb 2005 09:06:46 +0530 |
Hi,
I am working with open POSIX
test suite in Linux. I found aio_xxx related functions are not returned with an
appropriate error in a given execution condition. I analyzed the source code and
it seems that there is no problem with that. So, I think the problem may be due
to glibc. Just I would like to know the present glibc is fully complaint with
the AIO functions or not?
I have given below the
detailed analysis of the failed test cases. I used Linux kernel version 2.6.8
and the glibc version : 2.3.4. The latest published result for Open POSIX test
suite is also available in
http://tslogparser.sourceforge.net/run-browse.php.
TEST CASE FAILURE ANALYSIS REPORT ON AIO (Asynchronous Input
and Output)
Conclusion:
1. aio_error, aio_return, aio_read, aio_write and lio_listio
functions are not returned correctly with an appropriate error if some invalid
value is passed as an argument.
Even without initializing aiocb structure, calling aio_read and aio_write
are returned 0.
2. aio_read and aio_write functions are not accepted NULL as
an argument. It generated Segmentation Fault.
These test cases are taken from posixtestsuite-1.5.0.tar.gz
( http://prdownloads.sourceforge.net/posixtest/posixtestsuite-1.5.0.tar.gz?use_mirror=unc).
The path of the each file is
posixtestsuite/conformance/interfaces/aio_xxx.c
1.aio_error: 3-1.c [error message: bad aio_error return value
]
Test: Call aio_error() with an invalid aiocbp, i.e passed an
un initialized address of aiocb structure as an argumrnt.
Expected: aio_error function is expected to return an
appropriate error number. If the return value of the function is equal to
-1 and errno is equal to EINVAL(22)
then the test case will be passed.
Output: The aio_error function returns 1. The corresponding
error (according to errno.h) is Operation is not
permitted.
Analysis: aio_error function is not returned correctly if a
dummy structure is passed as an argument.
2. aio_return:3-2.c [ error message: aio_return/3-1.c
aio_return() should fail]
Test: Call aio_return function two times consecutively after
aio_write.
Expected: First
time it should be returned with the given buffer size and the next time it
should be returned -1 and the EINVAL error.
Output: The aio_return function returns correctly when it was
executing first time. But in second time, still the aio_return returns again the
buf size. So the test case was failed.
Analysis: aio_return should return with an appropriate error,
when it is called second time. i.e)called second time after I/O operation
completes.
3.aio_write: 2-1.c [error message:aio_write/2-1.c Error at
read(): No such file
or directory ]
Test: Call three times aio_write function with corresponding
buffer size 400, 200 and 300.
Expected: It writes in three times with different buffer and
wants to read all the data.
Output: Able to read only the first write data not the
remaining two.
Analysis: So the expected return value of the read system
call is 900 but it returns 400, which is equivalent to the first write buffer
size. So the test case is failed.
4&5. aio_write: 6-1.c and aio_read: 8-1.c[error message:
Segmentation Fault]
Test: Call aio_read /aio_write function with NULL as an
argument.
Expected: -1 is the return value
Output: created Segmentation
Fault.
Analysis: In general aio_write/aio_read will accept address
of the aiocb structure but in these test cases NULL is passed as an argument.
aio_write/aio_read didn't accept NULL as the argument. It has generated
segmentation fault.
6. aio_write:
8-2.c [error message: aio_write/8-2.c bad aio_write return
value()]
Test: Call aio_write but file is open in read only
mode.
Expected: aio_write function should be returned -1 and EBADF
error
Ouptut: Function is returned with zero and error no is 2
(ENOENT).
Analysis: aio_write return value is not handled properly even
if it is failed.
7. aio_write:
8-1.c [ error message: bad aio_write return value]
Test: assign
aiocb.aio_fildes = -1; and call aio_write
Expected: function should be returned -1 and EBADF
error
Output: Function is returned with zero and the error number
is 0.
Analysis: aio_write function is not returned with an
appropriate error even if some of the invalid value is assigned in aiocb
structure, which is passed as an argument of the function.
8. aio_write: 9-1.c [ error message: aio_write/9-1.c bad
aio_write return value()]
Test: assign
aiocb.aio_offset = -1; and call aio_write
Expected: function should be returned -1 and EBADF
error
Output: Function is returned with zero and the error number
is 2 (ENOENT).
Analysis: aio_write function is not returned with an
appropriate error even if some of the invalid value is assigned in aiocb
structure, which is passed as an argument of the function.
9. aio_read: 10-1.c [error message: aio_read/10-1.c bad
aio_read return value()]
Test: assign
aiocb.aio_fildes = -1; and call aio_read without
writing
Expected: function should be returned -1 and EBADF
error
Output: Function is returned with zero and the error number
is 0.
Analysis: aio_read function is not returned with an
appropriate error even if some of the invalid value is assigned in aiocb
structure, which is passed as an argument of the function.
10. aio_read: 11-1.c [error message: aio_read/11-1.c bad
aio_read return value()]
Test: assign
aiocb.aio_offset = -1; and call aio_read after
writing
Expected: function should be returned -1 and EBADF
error
Output: Function is returned with zero and the error number
is 2 (ENOENT).
Analysis: aio_read function is not returned with an
appropriate error even if some of the invalid value is assigned in aiocb
structure, which is passed as an argument of the function.
11. lio_listio: 5-1.c [error message: lio_listio/5-1.c
lio_listio() accepts invalid opcode]
Test: assign
aiocb.aio_lio_opcode = -1; and call
lio_litio
Expected: function should be returned
-1.
Output: Function is returned with
zero.
Analysis: lio_litio function is not returned with an
appropriate error even if some of the invalid value is assigned in aiocb
structure, which is passed as an argument of the function.
With best regards,
B. Thangaraju
[Prev in Thread] | Current Thread | [Next in Thread] |