Empty file creation corruption on CIFS filesystem

Bug #577031 reported by Nuno Lucas
260
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Won't Fix
High
linux (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

This bug applies to 2.6.32 mainstream kernel.
Kernel bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=15925
I'm adding this bug here because I tested with Ubuntu 10.04 so I know it also affects it.

I'm checking the "security vulnerability" box because it can result in leaked file contents from removed files, but I'm no security expert so I may be wrong.

The text on that bugzilla entry follows:

--------------------------------

There is a bad regression of the CIFS driver on 2.6.32 kernels (tested
2.6.32.11, 2.6.32.12 and Ubuntu 10.04 LTS 2.6.32-22-generic).

The version of the server doesn't seem to matter (tested 2.6.27, 2.6.32 and
Ubuntu 8.04 LTS 2.6.24-27-generic), as long as the client is 2.6.32-something.

Empty files created on the server become non-empty (with the contents of some
earlier written file) when read by the client. This happens when using lockf()
and without using it.

The following bash script shows the problem:

-----------< test-cifs.sh >------------------------
#!/bin/bash

while [ 1 ];
do
    rnd=$(( $RANDOM % 2 + 1 ))
    if [ -f $rnd ]; then
        v=$( cat $rnd )
        if [ -n "$v" -a "$v" != "$rnd" ]; then
            echo "ERROR!!! rnd=$rnd val=$v"
            exit -1
        fi
        rm -f $rnd
    else
        touch $rnd
        echo $rnd > $rnd
    fi
done
-----------< test-cifs.sh >------------------------

When this script runs both on the server and on the client on the same shared
directory, after a few seconds (sometimes almost right away), the client will
exit with the error.

In a nutshell, the script creates a random (1 or 2) empty file if it doesn't
exist, else makes sure it's content are either empty or the same as the file
name. After the check removes the file.

The script running on the server will never fail, as expected, but the client
will sometimes see the file with the wrong contents.

This only occurs when the client is running 2.6.32 (.11-12 or the Ubuntu 10.04
one). Any other kernel version I tested will work as expected.

A workaround we found for this problem is to never delete the file, just
truncate it's size to zero. In this way the problem doesn't show.

Replacing the 'rm -f $rnd' with 'echo -n "" > $rnd', is the script equivalent
of this workaround.

I haven't tested 2.6.33 yet because we will have to work with 2.6.32 for the
time being, so it's not a solution for me.

I'm available for any further information.
---
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.21.
AplayDevices:
 **** List of PLAYBACK Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: ALC269 Analog [ALC269 Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
Architecture: i386
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: ALC269 Analog [ALC269 Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: lucas 1227 F.... pulseaudio
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xf7eb8000 irq 16'
   Mixer name : 'Realtek ALC269'
   Components : 'HDA:10ec0269,1043834a,00100004'
   Controls : 12
   Simple ctrls : 7
DistroRelease: Ubuntu 10.04
HibernationDevice: RESUME=UUID=13e381ff-38f3-4280-9fc0-2c8e8df0ece8
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
MachineType: ASUSTeK Computer INC. 1000HE
Package: linux (not installed)
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.32-22-generic root=UUID=5932f02c-dae7-458d-9c70-e9531fd95401 ro quiet splash
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-22.33-generic 2.6.32.11+drm33.2
Regression: Yes
RelatedPackageVersions: linux-firmware 1.34
Reproducible: Yes
StagingDrivers: rt2860sta
Tags: lucid filesystem regression-release needs-upstream-testing staging
Title: [STAGING]
Uname: Linux 2.6.32-22-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare
dmi.bios.date: 07/23/2009
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 1002
dmi.board.asset.tag: To Be Filled By O.E.M.
dmi.board.name: 1000HE
dmi.board.vendor: ASUSTeK Computer INC.
dmi.board.version: x.xx
dmi.chassis.asset.tag: 0x00000000
dmi.chassis.type: 10
dmi.chassis.vendor: ASUSTek Computer INC.
dmi.chassis.version: x.x
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr1002:bd07/23/2009:svnASUSTeKComputerINC.:pn1000HE:pvrx.x:rvnASUSTeKComputerINC.:rn1000HE:rvrx.xx:cvnASUSTekComputerINC.:ct10:cvrx.x:
dmi.product.name: 1000HE
dmi.product.version: x.x
dmi.sys.vendor: ASUSTeK Computer INC.

Nuno Lucas (ntlucas)
visibility: private → public
Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

Hi Nuno,

Please be sure to confirm this issue exists with the latest development release of Ubuntu. ISO CD images are available from http://cdimage.ubuntu.com/releases/ . If the issue remains, please run the following command from a Terminal (Applications->Accessories->Terminal). It will automatically gather and attach updated debug information to this report.

apport-collect -p linux 577031

Also, if you could test the latest upstream kernel available that would be great. It will allow additional upstream developers to examine the issue. Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Once you've tested the upstream kernel, please remove the 'needs-upstream-testing' tag. This can be done by clicking on the yellow pencil icon next to the tag located at the bottom of the bug description and deleting the 'needs-upstream-testing' text. Please let us know your results.

Thanks in advance.

    [This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: needs-kernel-logs
tags: added: needs-upstream-testing
tags: added: kj-triage
Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Nuno Lucas (ntlucas) wrote : AlsaDevices.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
Nuno Lucas (ntlucas) wrote : BootDmesg.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : Card0.Amixer.values.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : Card0.Codecs.codec.0.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : IwConfig.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : Lspci.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : Lsusb.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : PciMultimedia.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : ProcModules.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : RfKill.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : UdevDb.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : UdevLog.txt

apport information

Revision history for this message
Nuno Lucas (ntlucas) wrote : WifiSyslog.txt

apport information

tags: removed: needs-upstream-testing
Changed in linux (Ubuntu):
status: Incomplete → New
Revision history for this message
Nuno Lucas (ntlucas) wrote :

I sent the requested information, but this is stupid. The requested information doesn't do nothing to help this bug...
Besides, it's an upstream bug, so it should be followed upstream, not here...

Changed in linux (Ubuntu):
status: New → Confirmed
Changed in linux:
status: Unknown → Won't Fix
Changed in linux:
importance: Unknown → High
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

As per upstream comments, marking "Won't Fix". Please see the upstream bug for more information.

Changed in linux (Ubuntu):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.