Bug 174111 - mount allows loopback devices to be mounted more than once to the same mount point
mount allows loopback devices to be mounted more than once to the same mount ...
Product: Fedora
Classification: Fedora
Component: util-linux (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2005-11-24 13:00 EST by Radek Bíba
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-01-03 13:10:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Radek Bíba 2005-11-24 13:00:44 EST
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):

How reproducible:

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 06:23:47 EST
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 13:10:27 EST
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 03:29:15 EST
Thanks very much. I tried the new version on rawhide and it indeed works as

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