glibc/glibc-rh688948.patch
Carlos O'Donell b21e067fb2 2.16-30.fc18
- Fix ownership of /usr/lib[64]/audit (#894307).
  - Rename release engineering directory to `releng' (#903754).
  - Fix multibyte character processing crash in regexp (#905874, #905877, CVE-2013-0242)
2013-03-18 13:41:20 -04:00

38 lines
1.2 KiB
Diff

diff -rNup a/releng/glibc_post_upgrade.c b/releng/glibc_post_upgrade.c
--- a/releng/glibc_post_upgrade.c 2011-10-19 05:04:41.000000000 -0600
+++ b/releng/glibc_post_upgrade.c 2012-02-06 11:02:03.236713830 -0700
@@ -60,6 +60,7 @@ is_ia64 (void)
int
main (void)
{
+ struct stat statbuf;
char initpath[256];
char buffer[4096];
@@ -170,12 +171,24 @@ main (void)
|| ((!!access ("/dev/initctl", F_OK))
^ !access ("/sbin/initctl", X_OK)))
_exit (0);
+
/* Check if we are not inside of some chroot, because we'd just
- timeout and leave /etc/initrunlvl. */
+ timeout and leave /etc/initrunlvl.
+
+ On more modern systems this test is not sufficient to detect
+ if we're in a chroot. */
if (readlink ("/proc/1/exe", initpath, 256) <= 0 ||
readlink ("/proc/1/root", initpath, 256) <= 0)
_exit (0);
+ /* Here's another well known way to detect chroot, at least on an
+ ext and xfs filesystems and assuming nothing mounted on the chroot's
+ root. */
+ if (stat ("/", &statbuf) != 0
+ || (statbuf.st_ino != 2
+ && statbuf.st_ino != 128))
+ _exit (0);
+
if (check_elf ("/proc/1/exe"))
verbose_exec (116, "/sbin/telinit", "/sbin/telinit", "u");