FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 01-07-2010, 01:15 PM
Tetsuo Handa
 
Default file corruption on ext3 filesystem?

Hello.

I'm experiencing file corruption problem.
I don't know whether this is a bug of kernel or not.
Can somebody reproduce below result?

My environment:
VMware Workstation 6.5.3 with 2CPUs / 512MB RAM.
Ubuntu Karmic with 2.6.31-17-generic-pae kernel.
Filesystem is ext3 (according to /etc/mtab and dmesg).
e2fsck 1.41.9 (22-Aug-2009)

Steps to reproduce:

Compile below program using "gcc -Wall -O3".

----------
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
FILE *fp = fopen("/testfile", "a");
char buffer[4096];
memset(buffer, 0x20, sizeof(buffer));
buffer[sizeof(buffer) - 1] = '
';
fwrite(buffer, 1, sizeof(buffer), fp);
fflush(fp);
sleep(5);
fprintf(stderr, "Let power fail after a few seconds.
");
while (1) {
sleep(1);
fwrite(buffer, 1, sizeof(buffer), fp);
}
return 0;
}
----------

Create files with large amount of data (e.g.
tar -zxf linux_2.6.31.orig.tar.gz ) and wait for more than 5 seconds
(i.e. longer than kjournald's commit interval) so that the file's data is
actually written to disk. Then, delete files (e.g. rm -fR linux-2.6.31/ )
and wait again so that deleted files are actually written to disk.

Run the above program and let the power fail (i.e. unplug the electric cable
or do equivalent) after more than 5 seconds (i.e. longer than kjournald's
commit interval).

Restart the system (and fsck will be executed).

Run "cat /testfile". It should contain only lines of 4095 spaces + '
'.
But it contains different data.

Regards.

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-08-2010, 01:34 PM
Tetsuo Handa
 
Default file corruption on ext3 filesystem?

Tetsuo Handa wrote:
> I'm experiencing file corruption problem.
> I don't know whether this is a bug of kernel or not.
It turned out that this was because Karmic mounts ext3 filesystem with
data=writeback mode.

CONFIG_EXT3_DEFAULTS_TO_ORDERED says

The use of "data=writeback" can cause
unwritten data to appear in files after an system crash or
power failure, which can be a security issue.

and I think that "unprivileged user can steal the content of deleted files
(e.g. /etc/shadow deleted by /usr/bin/passwd) when power failure occurred"
is a security problem.

http://valhenson.livejournal.com/37921.html

Thanks.

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2010, 02:43 PM
Stefan Bader
 
Default file corruption on ext3 filesystem?

Tetsuo Handa wrote:
> Tetsuo Handa wrote:
>> I'm experiencing file corruption problem.
>> I don't know whether this is a bug of kernel or not.
> It turned out that this was because Karmic mounts ext3 filesystem with
> data=writeback mode.
>
> CONFIG_EXT3_DEFAULTS_TO_ORDERED says
>
> The use of "data=writeback" can cause
> unwritten data to appear in files after an system crash or
> power failure, which can be a security issue.
>
> and I think that "unprivileged user can steal the content of deleted files
> (e.g. /etc/shadow deleted by /usr/bin/passwd) when power failure occurred"
> is a security problem.
>
> http://valhenson.livejournal.com/37921.html
>
> Thanks.
>

Seems we need to revisit this config option as it was introduced in a way that
made the default change without noticing. Thanks for bringing the issue to our
attention.

-Stefan


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 04:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org