[Bug 408959] New: chroot detection code in pre/postinstall broken
https://bugzilla.novell.com/show_bug.cgi?id=408959 Summary: chroot detection code in pre/postinstall broken Product: openSUSE 11.0 Version: Final Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Installation AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: martin.koegler@brz.gv.at QAContact: jsrain@novell.com Found By: --- Many packages (eg. udev, sysvinit) use something like the following for chroot detection: if test -f /proc/1/exe -a -d /proc/1/root; then if test $(stat -Lc '%i' /) -eq $(stat -Lc '%i' /proc/1/root); then if test -x /sbin/udevd; then echo "DO SOMETHING" fi fi fi This code is broken, if the chroot is on a different file system than /. In this case, the inode numbers of the chroot directory can be the same as the inode number of /. HowTo reproduce: * format / and /chroot as XFS filesystem and install a system into both * mount /chroot * chroot /chroot => stat -Lc '%i' / and stat -Lc '%i' /proc/1/root are the same (128) To fix it, the device must be checked too, eg: if test -f /proc/1/exe -a -d /proc/1/root; then if test $(stat -Lc '%D-%i' /) -eq $(stat -Lc '%D-%i' /proc/1/root); then if test -x /sbin/udevd; then echo "DO SOMETHING" fi fi fi mfg Martin Kögler -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 Robert Vojcik <rvojcik@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.provo.novell.com |locilka@novell.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 Lukas Ocilka <locilka@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|locilka@novell.com |bnc-team-screening@forge.provo.novell.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User nadvornik@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c2 Vladimir Nadvornik <nadvornik@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |werner@novell.com, nadvornik@novell.com AssignedTo|nadvornik@novell.com |kasievers@novell.com --- Comment #2 from Vladimir Nadvornik <nadvornik@novell.com> 2008-07-28 09:59:18 MDT --- Can you please be more specific about affected packages? I was able to find the bug only in the two mentioned above, udev and sysvinit. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User werner@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c3 Dr. Werner Fink <werner@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mmarek@novell.com --- Comment #3 from Dr. Werner Fink <werner@novell.com> 2008-07-28 10:14:04 MDT --- Is this a XFS specific behaviour or why we see here identical inodes for different file systems? There are many code out there which identifies files and directories on the base of inodes ... now if we can not belive therein this would be a big problem. Adding maintainer of xfsprogs. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User mmarek@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c4 --- Comment #4 from Michal Marek <mmarek@novell.com> 2008-07-28 11:53:10 MDT --- Who says that inode numbers are unique across filesystems? # dd if=/dev/zero of=img1 bs=1M count=10 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 0.0422199 s, 248 MB/s # dd if=/dev/zero of=img2 bs=1M count=10 .. # mkfs.ext3 img1 mke2fs 1.40.8 (13-Mar-2008) img1 is not a block special device. Proceed anyway? (y,n) y .. This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. # mkfs.ext3 img2 .. # mkdir 1 2 # mount -o loop img1 1 # mount -o loop img2 2 # ls -1id / 1/ 2/ 2 / 2 1/ 2 2/ # ls -1id /proc/ /sys/ /dev/pts/ /sys/kernel/debug/ /sys/fs/fuse/connections/ 1 /dev/pts/ 1 /proc/ 1 /sys/ 1 /sys/fs/fuse/connections/ 1 /sys/kernel/debug/ -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User kasievers@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c5 --- Comment #5 from Kay Sievers <kasievers@novell.com> 2008-07-29 04:44:59 MDT --- (In reply to comment #0 from Martin Kögler)
To fix it, the device must be checked too, eg: if test -f /proc/1/exe -a -d /proc/1/root; then if test $(stat -Lc '%D-%i' /) -eq $(stat -Lc '%D-%i' /proc/1/root);
The result of stat is not an integer anymore, and this can not work, right? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User martin.koegler@brz.gv.at added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c6 --- Comment #6 from Martin Kögler <martin.koegler@brz.gv.at> 2008-07-29 05:10:30 MDT --- (In reply to comment #5 from Kay Sievers)
(In reply to comment #0 from Martin Kögler)
To fix it, the device must be checked too, eg: if test -f /proc/1/exe -a -d /proc/1/root; then if test $(stat -Lc '%D-%i' /) -eq $(stat -Lc '%D-%i' /proc/1/root);
The result of stat is not an integer anymore, and this can not work, right?
Yes. I use the following for udev: %pre # kill daemon if we are not in a chroot if test -f /proc/1/exe -a -d /proc/1/root; then if test $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root); then if test -x /sbin/udevd; then kill $(pidof udevd) >/dev/null 2>&1 || : fi fi fi -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User martin.koegler@brz.gv.at added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c7 --- Comment #7 from Martin Kögler <martin.koegler@brz.gv.at> 2008-07-29 05:18:11 MDT --- (In reply to comment #2 from Vladimir Nadvornik)
Can you please be more specific about affected packages? I was able to find the bug only in the two mentioned above, udev and sysvinit.
I noticed the code in udev and sysvinit, as they affected my main system. I didn't check any of the other used packages, as they are not causing any problems with DISABLE_RESTART_ON_UPDATE="yes" and DISABLE_STOP_ON_REMOVAL="yes". -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User kasievers@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c8 Kay Sievers <kasievers@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|kasievers@novell.com |werner@novell.com --- Comment #8 from Kay Sievers <kasievers@novell.com> 2008-08-04 00:48:41 MDT --- Fixed in new udev package. Thanks! Pass bug to sysvinit. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=408959 User werner@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=408959#c9 Dr. Werner Fink <werner@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #9 from Dr. Werner Fink <werner@novell.com> 2008-08-04 11:40:11 MDT --- Fixed in sysvinit -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com