Bug 97529 - gcc miscompiles O_DIRECT code in kernel 2.4.*
Summary: gcc miscompiles O_DIRECT code in kernel 2.4.*
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 9
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-06-17 12:20 UTC by Need Real Name
Modified: 2007-04-18 16:54 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-10-03 23:36:58 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2003-06-17 12:20:12 UTC
From Bugzilla Helper:
User-Agent: Opera/7.11 (Linux 2.4.20-18.9 i686; U)  [en]

Description of problem:
After many experiments I've come to te conclusion that the RH9
gcc does not correctly compile the O_DIRECT functionality in
the 2.4 kernel.

I have an application that uses O_DIRECT on a partition without
a filesystem.  The application runs on a Geode GX1 (= i586
compatible) target system.  It runs from a CompactFlash with
only a kernel and some statically linked binaries.

Things have worked without problems when using RH 7.3 as the
development platform.  But after upgrading to RH 9 a mysterious
O_DIRECT problem appeared: any read() will only return zeroes
(no errors, just all zeroes as data).  Reading the same data
area without O_DIRECT will give the correct data.

I found out that the O_DIRECT functionality is completely disabled
in RH's own modern RH9 kernels (by a patch in the kernel SRPM).
I don't know if this was done because the SRPM maintainer knows
about RH9-gcc-O_DIRECT problems (he did not answer my question
why this was changed).



Version-Release number of selected component (if applicable):
gcc-3.2.2-5

How reproducible:
Always

Steps to Reproduce:
1. compile a 2.4 kernel on RH9 (tested several version including
   latest 2.4.21-ac1 and various RH kernel trees)
2. read data from partition with read & O_DIRECT enabled
3.
    

Actual Results:  read() only gives 0x00 0x00 ... data back

Expected Results:  The actual data that *is* in the partition

Additional info:

I compiled a 2.4.21-ac1 kernel on a RH7.3 system and that
made the problem go away.

Both my RH9 & RH7.3 systems are up-to-date and well-maintained
with all RH errata-patches applied.

RH9 system: PIII, 600MHz
RH7.3 system: Pentium, 133 MHz
Target system: Geode GX1 board, kernel compiled for i586
               running only statically compiled applications.

Concerning O_DIRECT usage: yes I know about the data alignment
requirements: they are fulfilled ! (can produce demo program
on request).

Comment 1 Need Real Name 2003-06-17 16:22:15 UTC
As suggested on the Linux kernel mailing list I tried to
compile with gcc-3.3.  This makes the problem go away.

I used the Rawhide gcc-3.3-7 packages.

     Rob van Nieuwkerk

Comment 2 Richard Henderson 2004-10-03 23:36:58 UTC
Fixed in 3.3 you say?  Excellent.


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