Bug 174111 - mount allows loopback devices to be mounted more than once to the same mount point
Summary: mount allows loopback devices to be mounted more than once to the same mount ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: 3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-11-24 18:00 UTC by Radek Bíba
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-01-03 18:10:27 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Radek Bíba 2005-11-24 18:00:44 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc3 Firefox/1.0.7

Description of problem:
SSIA. Additional problem is that if a user has privilege to mount a loopback
device (also an encrypted partition) and accidentally mounts it once more he
can't unmount it, umount says it's mounted multiple times, and only root can
resolve it.

Version-Release number of selected component (if applicable):
util-linux-2.12a-24.5

How reproducible:
Always

Steps to Reproduce:
Scenario for root:
1. dd if=/dev/zero of=/tmp/testloop ibs=1024 count=1024; mkdir /tmp/testmnt;
mke2fs -F /tmp/testloop
2. mount -o loop /tmp/testloop /tmp/testmnt
3. mount -o loop /tmp/testloop /tmp/testmnt
(yeah, twice)

Scenario for a common user:
1. = the first step, as above
2. echo /tmp/testloop /tmp/testmnt ext2 loop,user 0 0 >> /etc/fstab
3. (as a common user)  mount /tmp/testmnt ; mount /tmp/testmnt
4. (as a the same common user) umount /tmp/testmnt

Actual Results:  
[1] no error, mounted twice (see `mount`)
[2] = [1] + the user cannot unmount it

Expected Results:  
[1] error message, mounted only once
[2] = [1] (thus mounted once) + unmountable by user

Additional info:

Comment 1 Karel Zak 2006-01-03 11:23:47 UTC
Good catch! The check for "alredy mounted" is based on EBUSY (mount(2)), but
this is not true for "-o loop" where the mount command creates always new device :-)

$ cat /etc/mtab | grep loop
/tmp/testloop /tmp/testmnt ext2
rw,noexec,nosuid,nodev,loop=/dev/loop0,user=zakkr 0 0
/tmp/testloop /tmp/testmnt ext2
rw,noexec,nosuid,nodev,loop=/dev/loop1,user=zakkr 0 0

$ cat /proc/mounts | grep loop
/dev/loop0 /tmp/testmnt ext2 rw,nosuid,nodev,noexec,nogrpid 0 0
/dev/loop1 /tmp/testmnt ext2 rw,nosuid,nodev,noexec,nogrpid 0 0


Comment 2 Karel Zak 2006-01-03 18:10:27 UTC
Fixed in FC4 and FC5. I'm going to fix it in FC3 with something more important...

Comment 3 Radek Bíba 2006-01-04 08:29:15 UTC
Thanks very much. I tried the new version on rawhide and it indeed works as
expected.


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