Distribution: Debian Hardware Environment: Athlon XP Software Environment: Problem Description: The usbfs filesystem does not seem to honor the devuid and devgid and what not from the mount option. Steps to reproduce: just try to mount /proc/bus/usb with devuid and devgid it will always by root.root
This is a terribly annoying bug, I have to agree. Too bad it has been ignored for so long :(
I agree, got time to work on a fix? Right now I don't sorry...
Work on a fix, why didn't I think of that :-) I will try to look at it this week. But as I'm a total newbie in kernel programming, I can not garantee anything. If one looks in inode.c all the option parsing seems to be present - but it is just not activated somehow. Anyway I will take a peek.
Sorry for sounding rude here. I really didn't mean it that way. I might try to see if I can trace it down a bit. Sorry.
Created attachment 1703 [details] partial fix
It looks like the problem is that there is some buffering going on. Thhe code that pulls out options isn't called after the first time through. When you modprobe *-hcd, it calls the code at that point. When you mount it with options that part of the code is skipped (because the superblock is already setup). There is a workaround for what is in 2.6.0. modprobe usbcore. mount /proc/bus/usb with options, then modprobe *-hcd. The patch should fix the problem for any device plugged in after the mount command is executed. You can then just do a rmmod *-hcd, then a modprobe *-hcd (which does the remove-attach for everything else). What remains to be done is applying the options to devices already plugged in. I have started looking at it, but I don't know when I will get time to figure something out.
In testing, I noticed that the previous values of *uid, *gid, *mode are used in subsequent mounts. This doesn't seem desirable. Is it, or should they be cleared to 0 on each (new) mount?
Created attachment 2374 [details] Gives users access to usb devices Of course you can modify the script to give any combination of user:group:others permissions that you want.
I investigated this a little. usbfs is not mounted on mount from userspace, but before, when the first bus is added: [<c0305c34>] usb_get_sb+0x14/0xa0 [<c0181c66>] do_kern_mount+0x56/0xd0 [<c01a84f2>] simple_pin_fs+0x1d2/0x350 [<c0305d13>] create_special_files+0x23/0x1c0 [<c0305fb9>] usbfs_add_bus+0x19/0x120 So this makes hard to process dev[ug]id options, because the files are already created. (Tyler's fix works only for devices added after mounting) Options for solving this: - drop dev[ug]id, do this from userspace like James suggested - chown files from kernel on each mount - rearrange code to mount only when we want to mount (don't know how this would work for files already created) Suggestions?
In my opinion, chown/chmod files from kernel on each mount is the correct way to handle this. I looked at it for a bit, but I don't have very much experiance in the kernel, and couldn't find a good way to do it.
*** Bug 2575 has been marked as a duplicate of this bug. ***
Should be now fixed in 2.6.8