Bug 109014 - pam_console locks with mount point in fstab which device file does not exist
pam_console locks with mount point in fstab which device file does not exist
Product: Fedora
Classification: Fedora
Component: pam (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Tomas Mraz
: EasyFix, Triaged
Depends On:
  Show dependency treegraph
Reported: 2003-11-04 07:28 EST by Behdad Esfahbod
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-09-22 04:13:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to fix. (579 bytes, patch)
2003-11-24 10:39 EST, Behdad Esfahbod
no flags Details | Diff

  None (edit)
Description Behdad Esfahbod 2003-11-04 07:28:29 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Gecko/20031027 Epiphany/1.0.4

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):

How reproducible:

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

Additional info:
Comment 1 Behdad Esfahbod 2003-11-24 10:39:21 EST
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.
Comment 2 Behdad Esfahbod 2003-12-08 14:12:41 EST
The patch is obvious and just needs to be applied.
Comment 3 Tomas Mraz 2004-09-21 10:46:20 EDT
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.
Comment 4 Behdad Esfahbod 2004-09-21 13:23:28 EDT
Humm, tested on FC2 now and works.  Maybe something changed in the
mean time...  Feel free to close.  They say time heals everything!
Comment 5 Tomas Mraz 2004-09-22 04:13:18 EDT
I'll add a recursion test to be sure as part of solving the bug 88370.

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