Bug 109014

Summary: pam_console locks with mount point in fstab which device file does not exist
Product: [Fedora] Fedora Reporter: Behdad Esfahbod <behdad>
Component: pamAssignee: Tomas Mraz <t8m>
Status: CLOSED WORKSFORME QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: rawhideCC: johnsonm, t8m
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-09-22 08:13:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to fix. none

Description Behdad Esfahbod 2003-11-04 12:28:29 UTC
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
/proc/asdf/fd/


Version-Release number of selected component (if applicable):
pam-0.77-15

How reproducible:
Always

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 15:39:21 UTC
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 19:12:41 UTC
The patch is obvious and just needs to be applied.

Comment 3 Tomas Mraz 2004-09-21 14:46:20 UTC
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 17:23:28 UTC
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 08:13:18 UTC
I'll add a recursion test to be sure as part of solving the bug 88370.