Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-03-2008, 08:44 PM   #1
Registered: Jun 2004
Distribution: Turtle Kevux 0.8.8
Posts: 129

Rep: Reputation: 15
Modifying /proc/mounts without confusing filesystems

I wrote a patch for util-linux that allows me to exclusively use /proc/mounts over /etc/mtab, given that I could see no difference between the two.
I quickly found out that the /proc/mounts does not append the user=blah option to specify that some non-root user should be able to umount the device.
I then followed with a new patch that effectively appends the option umount=somegid.

I am using umount= so that I do not conflict with any special parameters in existing filesystems.

The problem is that I am trying to look through the kernel to see what I need to change to allow /proc/mounts to have umount=somegid and not have the filesystem upchuck because it does not recognize the umount=somegid option.

I can see the good way and the bad way to implement this.
The good way would be to remove the umount=somegid option after it gets placed into /proc/mounts and before the options get passed to the filesystem.
The bad way would be to tweak every single filesystem and have them explicitly ignore the umount=somegid option.

I am having trouble finding in the linux source, where in the code I need to make this change and remove the umount=somegid option.

Could I get some help?
I would really like to avoid the bad way.

I am currently looking at the file: fs/namespace.c
Old 06-03-2008, 09:52 PM   #2
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 76
I think you misunderstand a few things. There is a reason that mtab has more information than /proc/mounts, and it is not that the kernel is stingy. The “user=” feature is implemented completely in userspace. In particular, that information never travels to the kernel via the mount(2) system call, but is enforced by the SUID-root program umount. Besides the “user=” information, there is also information pertaining to loopback devices that ensures proper unmounting of those as well.

So that information is written to mtab by the mount utility with the sole intention of its use by the umount utility.

If you want to know, the procfile output is controlled by the show_vfsmnt() function. In order for you to change the current state of affairs, however, I believe you will have to ammend the sys_mount() and sys_umount() functions (but I may be wrong about that).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/mtab vs. /proc/self/mounts ciotog Slackware 1 10-10-2005 05:31 AM
About /proc/mounts A-Liang Programming 3 11-27-2004 10:52 PM
/proc/mounts and /etc/mtab differs pradi_net Linux - Software 0 05-19-2004 10:47 AM
Can't find file '/proc/mounts' TY2K4 Red Hat 1 01-10-2004 08:39 AM
Help! /proc/mounts not found during bootup artemis Linux - General 15 11-10-2003 04:31 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration