Red Hat Bugzilla – Bug 109014
pam_console locks with mount point in fstab which device file does not exist
Last modified: 2007-11-30 17:10:33 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Description of problem:
pam_console hangs if you've got a line in /etc/fstab which the first
field is a file that does not exist, and the second field is listed
somewhere in /etc/security/console.perms (so it looks up for the
device). Having such a line is quite common: I set up devlabel for
my digital camera, so when the camera is not connected, devlabel
removes /dev/camera, and I have a line in fstab which mounts
/dev/camera /mnt/camera. So I once get locked in boot on when
pam_console_apply is called in rc.sysinit, and another time when gdm
tries to login and uses pam_console. killing gdm makes it work in
next try, I don't know why.
Discovered the bug first time when added a line like that in fstab,
and found whats wrong simply from the many many open fds of gdm in
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Add /123 /mnt/floppy123 auto defaults 0 0 to /etc/fstab
2. Make sure /mnt/floppy* is listed in /etc/security/console.perms
3. Run pam_console_apply
Actual Results: It never returns
Expected Results: Should return
Created attachment 96150 [details]
Patch to fix.
Patch to fix the problem. Here is the problem: In
pam/modules/pam_console/chmod.c, in function change_file, which is supposed to
chmod the file, in two cases it calls change_via_fstab, once if it's a
directory, and once if the file does not exist! Which the second case is not
needed, as a file that does not exist can't be a mount point either. But then
it calls change_via_fstab, and if the non-existant file happens to be a mount
point (which of course cannot be mounted), then the corresponding device file
is passed to change_file, which again calls change_via_fstab, ...
The patch simply removes the dead case.
The patch is obvious and just needs to be applied.
This shouldn't hang even without the patch because if the /123 file
doesn't exist it will try only /mnt/floppy123 and this doesn't exist
too so it recurses once more to change_via_fstab but this won't find
anything and it fails.
No infinite recursion.
Humm, tested on FC2 now and works. Maybe something changed in the
mean time... Feel free to close. They say time heals everything!
I'll add a recursion test to be sure as part of solving the bug 88370.