xserver: Branch 'master'

Keith Packard keithp at kemper.freedesktop.org
Thu Dec 11 11:44:31 PST 2014


 hw/xfree86/os-support/solaris/sun_init.c |   31 -------------------------------
 1 file changed, 31 deletions(-)

New commits:
commit 913416b718e73e7416c2128a82d2e5e5cd962d28
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Dec 9 10:15:08 2014 -0800

    Solaris: delete undocumented, unuseful -protect0 flag
    
    Solaris already makes the page at address 0 inaccessible by default to
    catch NULL pointer bugs, we don't need a double secret undocumented flag
    to try to make our own hacky attempt at it.
    
    As a bonus, deleting this code removes gcc warning of:
    
    sun_init.c: In function 'xf86OpenConsole':
    sun_init.c:103:17: warning: declaration of 'fd' shadows a previous local [-Wshadow]
                 int fd = -1;
                     ^
    sun_init.c:89:9: warning: shadowed declaration is here [-Wshadow]
         int fd;
             ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Mark Kettenis <kettenis at openbsd.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 16fc1b7..2e0af22 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -46,7 +46,6 @@
 #define	SOL_CONSOLE_DEV	"/dev/console"
 
 static Bool KeepTty = FALSE;
-static Bool Protect0 = FALSE;
 static Bool UseConsole = FALSE;
 
 #ifdef HAS_USL_VTS
@@ -97,27 +96,6 @@ xf86OpenConsole(void)
         if (geteuid() != 0)
             FatalError("xf86OpenConsole: Server must be suid root\n");
 
-        /* Protect page 0 to help find NULL dereferencing */
-        /* mprotect() doesn't seem to work */
-        if (Protect0) {
-            int fd = -1;
-
-            if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) {
-                xf86Msg(X_WARNING,
-                        "xf86OpenConsole: cannot open /dev/zero (%s)\n",
-                        strerror(errno));
-            }
-            else {
-                if (mmap(0, 0x1000, PROT_NONE,
-                         MAP_FIXED | MAP_SHARED, fd, 0) == MAP_FAILED)
-                    xf86Msg(X_WARNING,
-                            "xf86OpenConsole: failed to protect page 0 (%s)\n",
-                            strerror(errno));
-
-                close(fd);
-            }
-        }
-
 #ifdef HAS_USL_VTS
 
         /*
@@ -371,15 +349,6 @@ xf86ProcessArgument(int argc, char **argv, int i)
     }
 
     /*
-     * Undocumented flag to protect page 0 from read/write to help catch NULL
-     * pointer dereferences.  This is purely a debugging flag.
-     */
-    if (!strcmp(argv[i], "-protect0")) {
-        Protect0 = TRUE;
-        return 1;
-    }
-
-    /*
      * Use /dev/console as the console device.
      */
     if (!strcmp(argv[i], "-C")) {


More information about the xorg-commit mailing list