Bug 178084 - Last AIO read of a file opened with O_DIRECT returns wrong length
Summary: Last AIO read of a file opened with O_DIRECT returns wrong length
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jeff Moyer
QA Contact: Brian Brock
URL: http://linux.bkbits.net:8080/linux-2....
Whiteboard:
Depends On:
Blocks: 181409
TreeView+ depends on / blocked
 
Reported: 2006-01-17 19:08 UTC by Jeff Moyer
Modified: 2007-11-30 22:07 UTC (History)
3 users (show)

Fixed In Version: RHSA-2006-0575
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-10 21:52:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
reproducer (1.34 KB, text/x-csrc)
2006-01-17 19:08 UTC, Jeff Moyer
no flags Details
Fix the return value for the last read of a file that is not a multple of block size (1.58 KB, patch)
2006-01-17 19:21 UTC, Jeff Moyer
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2006:0575 0 normal SHIPPED_LIVE Important: Updated kernel packages available for Red Hat Enterprise Linux 4 Update 4 2006-08-10 04:00:00 UTC

Description Jeff Moyer 2006-01-17 19:08:39 UTC
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):
kernel-2.6.9-27.EL

How reproducible:
100%

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.

Actual results:
./dioeof
ret = 300
ret = 4096

Expected results:
ret = 300
ret = 300

Additional info:

Comment 1 Jeff Moyer 2006-01-17 19:08:42 UTC
Created attachment 123323 [details]
reproducer

Comment 2 Jeff Moyer 2006-01-17 19:21:04 UTC
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.

Comment 3 Jason Baron 2006-01-17 20:06:35 UTC
hmmm...changing the dio structure is likely a kabi issue.

Comment 4 Jeff Moyer 2006-01-17 20:15:35 UTC
How so?  The structure definition is private to fs/direct-io.c.

Comment 5 Jason Baron 2006-01-17 20:19:25 UTC
ok. you're right. i retract my comment 

Comment 8 Jason Baron 2006-03-22 14:57:59 UTC
committed in stream U4 build 34.6. A test kernel with this patch is available
from http://people.redhat.com/~jbaron/rhel4/


Comment 11 Rafal Wijata 2006-05-26 07:31:54 UTC
Is there any schedule on releasing kernel with this bugfix?


Comment 12 Jeff Moyer 2006-05-26 13:23:07 UTC
It will be available in update 4.

Comment 13 Rafal Wijata 2006-05-30 07:34:31 UTC
I'm really suprised, that this patch was not included in
https://rhn.redhat.com/errata/RHSA-2006-0493.html
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)?


Comment 15 Red Hat Bugzilla 2006-08-10 21:52:57 UTC
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.

http://rhn.redhat.com/errata/RHSA-2006-0575.html



Note You need to log in before you can comment on or make changes to this bug.