Bug 177595 - init.d/named script performs flawed grep of /proc/mounts
init.d/named script performs flawed grep of /proc/mounts
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: bind (Show other bugs)
5
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Martin Stransky
Ben Levenson
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-11 20:51 EST by JW
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 9.3.3-0.1.rc2.fc5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-12-06 03:49:03 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description JW 2006-01-11 20:51:31 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; MSIE 6.0; Windows; U; AIIEEEE!; Win98; Windows 98; en-US; Gecko masquerading as IE; should it matter?; rv:1.8b) Gecko/20050217

Description of problem:
There is code in /etc/rc.d/init.d/named that attempts to bind-mount /proc if it isn't already mounted under chrooted (sic) hierarchy.
It does this by grep'ing /proc/mounts for "/proc ${ROOTDIR}/proc".

This is wrong because it presumes that the real path of ${ROOTDIR}/proc is the same as the ${ROOTDIR}/proc.


Version-Release number of selected component (if applicable):
bind-9.3.1-14_FC4

How reproducible:
Always

Steps to Reproduce:
1.mv /var/named/chroot /X
2.ln -s /X /var/named/chroot
3./etc/rc.d/init.d/named start
4./etc/rc.d/init.d/named restart
5./etc/rc.d/init.d/named restart
6.cat /proc/mounts
 

Actual Results:  ....
/proc /X/proc proc rw,nodiratime 0 0
/proc /X/proc proc rw,nodiratime 0 0
/proc /X/proc proc rw,nodiratime 0 0


Expected Results:  ....
/proc /X/proc proc rw,nodiratime 0 0 #just once


Additional info:

There is a lot of horrible grep'ing in RedHat/Fedora scripts.
This is just another example amongst many.

It would be better to a use more robust and reliable way to determine whether a node is mounted, especially where aliasing can occur because of symlinks.

Possibilities that come to mind:
1. df ${ROOTDIR}/proc >/dev/null; use $?
2. somehow invoke a realpath(3) translation of ${ROOTDIR}/proc, then grep it.
3. mount -o remount,rw ${ROOTDIR}/proc 2>/dev/null || mount /proc ${ROOTDIR}/proc

I think 3) is the one that I will be patching for.
Comment 1 JW 2006-01-11 20:56:12 EST
Correction (omitted the --bind):

3. mount -o remount,rw ${ROOTDIR}/proc 2>/dev/null || mount --bind /proc
${ROOTDIR}/proc

Comment 2 Jason Vas Dias 2006-03-07 11:21:35 EST
This bug is now fixed with bind-9.3.2-6 in Rawhide, and will be fixed in 
bind-9.3.1-16.FC4, to be released to FC-4 updates/testing today.
Comment 3 Fedora Update System 2006-03-07 23:43:11 EST
From User-Agent: XML-RPC

bind-9.3.1-16_FC4 has been pushed for FC4, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 4 Fedora Update System 2006-03-21 12:55:55 EST
bind-9.3.2-10.FC5 has been pushed for FC5, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 5 Fedora Update System 2006-03-21 12:56:11 EST
bind-9.3.1-18.FC4 has been pushed for FC4, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 6 Bill Nottingham 2006-09-21 22:11:16 EDT
Closing bugs in MODIFIED state from prior Fedora releases. If this bug persists
in a current Fedora release (such as Fedora Core 5 or later), please reopen and
set the version appropriately.
Comment 7 Martin Stransky 2006-10-26 07:17:08 EDT
Are you sure that it isn't fixed in FC5? I've just checked it and it works fine...
Comment 8 JW 2006-10-26 07:48:51 EDT
You have checked with symlinked chroot hierarchy?
Comment 9 Martin Stransky 2006-10-26 10:06:44 EDT
I've checked your steps to reproduce, package bind-9.3.3-0.1.rc2.fc5 (the latest
FC5 update)...
Comment 10 JW 2006-10-26 10:13:59 EDT
Must be fixed then.

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