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
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).
|All times are GMT -5. The time now is 07:55 PM.|