Red Hat Bugzilla – Bug 178084
Last AIO read of a file opened with O_DIRECT returns wrong length
Last modified: 2007-11-30 17:07:22 EST
Description of problem:
When issuing AIO reads to a file opened with O_DIRECT, the "bytes read" returned
for the last block in the file is wrong. If the user specified a 4k read, and
the file only has 300 bytes left, the kernel will return that it read 4k!
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Build the attached file like so:
gcc -o dioeof dioeof.c -laio
Then, create a file name a.txt with dd:
dd if=/dev/zero of=a.txt bs=300 count=1
Take note of the blocksize and count, here. Now, run the program in the same
directory as a.txt.
ret = 300
ret = 4096
ret = 300
ret = 300
Created attachment 123323 [details]
Created attachment 123326 [details]
Fix the return value for the last read of a file that is not a multple of block size
this patch is currently untested.
hmmm...changing the dio structure is likely a kabi issue.
How so? The structure definition is private to fs/direct-io.c.
ok. you're right. i retract my comment
committed in stream U4 build 34.6. A test kernel with this patch is available
Is there any schedule on releasing kernel with this bugfix?
It will be available in update 4.
I'm really suprised, that this patch was not included in
I do consider this a security issue, as use is allowed to read data, which He
has not wrote itself. For eg. what would happen if that filesystem clusted was
previously used for /etc/shadow?
Anyway - where can I find some schedule for RH releases (so I can know when it
could be released)?
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.