Files hardlinked to others may be set to zero size

Bug #1051901 reported by Thomas Schweikle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Install Ubuntu 12.04, then upgrade to the latest kernel-image. Create a filesystem like:

mkdir orig

move various picture files into "orig", then do

ln orig/* .

now you'll have a directory with the original files in "orig" and hardlinked copies in "."

Next start up digikam, work on these hardlinked pictures: change them, add or delete comments, upload them ...

Next step: run

find . -size 0

You'll find all pictures you've worked on in "orig" to show up with size 0!

The original data contained in these is lost. No recover. The files are actually of zero size! It is not only digicam, but others to: as soon as a file is read, and then overwritten, all not opened hardlinked files show zero size. Only the one file you've opened keeps its size and holds data.

I've found this behaviour with:
- digikam
- rsync
- kate

I am assuming the kernel not korrectly handling hardlinks under certain circumstances.

Only possible workaround at the moment: do not use hardlinks! Copy files!

The bug may be used to zero out configuration files and, if they are empty gain access to things no access was granted, if you do

ln /etc/configfile /home/user/configfile

then work on /home/user/configfile. /etc/configfile will, after this operation, have size 0 and hold nothing. It is at least possible to use it for denial of service, if services depend on configfiles and do not accept empty ones.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: bash 4.2-2ubuntu2
Uname: Linux 3.4.10 x86_64
ApportVersion: 2.0.1-0ubuntu13
Architecture: amd64
Date: Mon Sep 17 12:29:14 2012
InstallationMedia: Xubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
ProcEnviron:
 LANGUAGE=de_DE:en
 TERM=screen-bce
 PATH=(custom, user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
SourcePackage: bash
UpgradeStatus: Upgraded to precise on 2012-07-16 (62 days ago)
modified.conffile..etc.bash.bashrc: [modified]
modified.conffile..etc.skel..bashrc: [modified]
mtime.conffile..etc.bash.bashrc: 2012-07-16T19:54:47.049684
mtime.conffile..etc.skel..bashrc: 2012-07-16T19:42:08.188571
---
ApportVersion: 2.0.1-0ubuntu13
Architecture: amd64
DistroRelease: Ubuntu 12.04
InstallationMedia: Xubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
Package: linux (not installed)
ProcEnviron:
 LANGUAGE=de_DE:en
 TERM=screen-bce
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
Tags: precise
Uname: Linux 3.4.11 x86_64
UnreportableReason: The running kernel is not an Ubuntu kernel
UpgradeStatus: Upgraded to precise on 2012-07-16 (63 days ago)
UserGroups: pkcs11

Revision history for this message
Thomas Schweikle (tps) wrote :
Revision history for this message
Thomas Schweikle (tps) wrote :

This is true for all 3.2.x, 3.3.x, 3.4.x kernels. I didn't test the 3.5.x series, nor 3.6.x series

Matthias Klose (doko)
affects: bash (Ubuntu) → ubuntu
affects: ubuntu → linux (Ubuntu)
Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1051901

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

Would it be possible for you to test the latest upstream kernel? Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Please test the latest v3.6 kernel[0] (Not a kernel in the daily directory) and install both the linux-image and linux-image-extra .deb packages.

Once you've tested the upstream kernel, please remove the 'needs-upstream-testing' tag. Please only remove that one tag and leave the other tags. 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.

If this bug is fixed in the mainline kernel, please add the following tag 'kernel-fixed-upstream'.

If the mainline kernel does not fix this bug, please add the tag: 'kernel-bug-exists-upstream'.

If you are unable to test the mainline kernel, for example it will not boot, please add the tag: 'kernel-unable-to-test-upstream'.
Once testing of the upstream kernel is complete, please mark this bug as "Confirmed".

Thanks in advance.

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-rc6-quantal/

Changed in linux (Ubuntu):
importance: Undecided → Medium
tags: added: needs-upstream-testing
Thomas Schweikle (tps)
tags: added: apport-collected
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for linux (Ubuntu) because there has been no activity for 60 days.]

Changed in linux (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers