xserver: Branch 'master' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Feb 21 05:05:09 UTC 2021


 hw/xquartz/GL/visualConfigs.c |   26 ++++++++++++--------------
 hw/xquartz/X11Application.m   |    8 ++++++++
 hw/xquartz/X11Controller.m    |   20 +++++++++-----------
 hw/xquartz/xpr/driWrap.c      |    2 +-
 4 files changed, 30 insertions(+), 26 deletions(-)

New commits:
commit 25035229b73742f9e6a96ac3e535b30b5c6196a8
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Fri Feb 19 23:16:56 2021 -0800

    xquartz: Don't process AppKit events if we haven't finished initializing
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index af1ea5839..8b9b1f104 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -200,6 +200,14 @@ QuartzModeBundleInit(void);
 
 - (void) sendEvent:(NSEvent *)e
 {
+    /* Don't try sending to X if we haven't initialized.  This can happen if AppKit takes over
+     * (eg: uncaught exception) early in launch.
+     */
+    if (!eventTranslationQueue) {
+        [super sendEvent:e];
+        return;
+    }
+
     OSX_BOOL for_appkit, for_x;
     OSX_BOOL const x_active = self.x_active;
 
commit 487286d47260782d331229af10df17711cbca1ea
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sat Feb 20 17:24:14 2021 -0800

    xquartz: Allocate each fbconfig separately
    
    A change during the 1.20 development cycle resulted in fbconfigs being walked
    and deallocated individually during __glXScreenDestroy.  This change
    now avoids a use-after-free caused by that change.
    
    ==50859==ERROR: AddressSanitizer: heap-use-after-free on address 0x00010d3819c8 at pc 0x0001009d4230 bp 0x00016feca7a0 sp 0x00016feca798
    READ of size 8 at 0x00010d3819c8 thread T5
        #0 0x1009d422c in __glXScreenDestroy glxscreens.c:448
        #1 0x10091cc98 in __glXAquaScreenDestroy indirect.c:510
        #2 0x1009d2734 in glxCloseScreen glxscreens.c:169
        #3 0x100740a24 in dix_main main.c:325
        #4 0x10023ed50 in server_thread quartzStartup.c:65
        #5 0x199ae7fd0 in _pthread_start+0x13c (libsystem_pthread.dylib:arm64e+0x6fd0)
        #6 0x199ae2d38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d38)
    
    0x00010d3819c8 is located 200 bytes inside of 12800-byte region [0x00010d381900,0x00010d384b00)
    freed by thread T5 here:
        #0 0x101477ba8 in wrap_free+0x98 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3fba8)
        #1 0x1009d4240 in __glXScreenDestroy glxscreens.c:449
        #2 0x10091cc98 in __glXAquaScreenDestroy indirect.c:510
        #3 0x1009d2734 in glxCloseScreen glxscreens.c:169
        #4 0x100740a24 in dix_main main.c:325
        #5 0x10023ed50 in server_thread quartzStartup.c:65
        #6 0x199ae7fd0 in _pthread_start+0x13c (libsystem_pthread.dylib:arm64e+0x6fd0)
        #7 0x199ae2d38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d38)
    
    previously allocated by thread T5 here:
        #0 0x101477e38 in wrap_calloc+0x9c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3fe38)
        #1 0x100925a40 in __glXAquaCreateVisualConfigs visualConfigs.c:116
        #2 0x10091cb24 in __glXAquaScreenProbe+0x224 (X11.bin:arm64+0x100730b24)
        #3 0x1009cd840 in xorgGlxServerInit glxext.c:528
        #4 0x10074539c in _CallCallbacks dixutils.c:743
        #5 0x100932a70 in CallCallbacks callback.h:83
        #6 0x100932478 in GlxExtensionInit vndext.c:244
        #7 0x10020a364 in InitExtensions miinitext.c:267
        #8 0x10073fe7c in dix_main main.c:197
        #9 0x10023ed50 in server_thread quartzStartup.c:65
        #10 0x199ae7fd0 in _pthread_start+0x13c (libsystem_pthread.dylib:arm64e+0x6fd0)
        #11 0x199ae2d38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d38)
    
    Regressed-in: 4b0a3cbab131eb453e2b3fc0337121969258a7be
    CC: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index 69b18f6a0..d810e2dfe 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -59,7 +59,7 @@
 /* Based originally on code from indirect.c which was based on code from i830_dri.c. */
 __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) {
     int numConfigs = 0;
-    __GLXconfig *visualConfigs, *c;
+    __GLXconfig *visualConfigs, *c, *l;
     struct glCapabilities caps;
     struct glCapabilitiesConfig *conf;
     int stereo, depth, aux, buffers, stencil, accum, color, msample;
@@ -113,14 +113,13 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
     if(numConfigsPtr)
         *numConfigsPtr = numConfigs;
 
-    visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
-
-    if(NULL == visualConfigs) {
-        ErrorF("xcalloc failure when allocating visualConfigs\n");
-        freeGlCapabilities(&caps);
-        return NULL;
-    }
+    /* Note that as of 1.20.0, we cannot allocate all the configs at once.
+     * __glXScreenDestroy now walks all the fbconfigs and frees them one at a time.
+     * See 4b0a3cbab131eb453e2b3fc0337121969258a7be.
+     */
+    visualConfigs = calloc(sizeof(*visualConfigs), 1);
 
+    l = NULL;
     c = visualConfigs; /* current buffer */
     for(conf = caps.configurations; conf; conf = conf->next) {
         for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
@@ -137,7 +136,8 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
                                         // Global
                                         c->visualID = -1;
                                         c->visualType = GLX_TRUE_COLOR;
-                                        c->next = c + 1;
+                                        c->next = calloc(sizeof(*visualConfigs), 1);
+                                        assert(c->next);
 
                                         c->level = 0;
                                         c->indexBits = 0;
@@ -260,6 +260,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
                                         /* EXT_framebuffer_sRGB */
                                         c->sRGBCapable = GL_FALSE;
 
+                                        l = c;
                                         c = c->next;
                                     }
                                 }
@@ -271,11 +272,8 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
         }
     }
 
-    (c-1)->next = NULL;
-
-    if (c - visualConfigs != numConfigs) {
-        FatalError("numConfigs calculation error in setVisualConfigs!  numConfigs is %d  i is %d\n", numConfigs, (int)(c - visualConfigs));
-    }
+    free(c);
+    l->next = NULL;
 
     freeGlCapabilities(&caps);
     return visualConfigs;
commit 6a83fb51b7a8b2e167e7d6380229b69e5452f91f
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sat Feb 20 15:17:18 2021 -0800

    xquartz: Fix a compiler warning about const incompatible pointer assignment
    
    driWrap.c:541:30: error: assigning to 'GCOps *' (aka 'struct _GCOps *') from 'const GCOps *' (aka 'const struct _GCOps *') discards
          qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
            pGCPriv->originalOps = pGC->ops;
                                 ^ ~~~~~~~~
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c
index 42282d52b..f588a834d 100644
--- a/hw/xquartz/xpr/driWrap.c
+++ b/hw/xquartz/xpr/driWrap.c
@@ -45,7 +45,7 @@
 #include <OpenGL/OpenGL.h>
 
 typedef struct {
-    GCOps *originalOps;
+    GCOps const *originalOps;
 } DRIGCRec;
 
 typedef struct {
commit a3ddcdd56c246e2226c7cdf372c2a1294eb6d888
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Feb 18 23:16:15 2021 -0800

    xquartz: Fix build with sparkle enabled
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index b5aeda647..3efda5083 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -312,29 +312,27 @@ extern char *bundle_id_prefix;
 #ifdef XQUARTZ_SPARKLE
 - (void) setup_sparkle
 {
-    if (check_for_updates_item)
+    if (self.check_for_updates_item)
         return;  // already did it...
 
     NSMenu *menu = [self.x11_about_item menu];
 
-    check_for_updates_item =
-        [menu insertItemWithTitle:NSLocalizedString(
-             @"Check for X11 Updates...",
-             @"Check for X11 Updates...")
-         action:@selector (
-             checkForUpdates:)
-         keyEquivalent:@""
-         atIndex:1];
+    NSMenuItem * const check_for_updates_item =
+        [menu insertItemWithTitle:NSLocalizedString(@"Check for X11 Updates...", @"Check for X11 Updates...")
+                           action:@selector(checkForUpdates:)
+                    keyEquivalent:@""
+                          atIndex:1];
     [check_for_updates_item setTarget:[SUUpdater sharedUpdater]];
     [check_for_updates_item setEnabled:YES];
 
+    self.check_for_updates_item = check_for_updates_item;
+
     // Set X11Controller as the delegate for the updater.
     [[SUUpdater sharedUpdater] setDelegate:self];
 }
 
 // Sent immediately before installing the specified update.
-- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)
-   update
+- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update
 {
     //self.can_quit = YES;
 }


More information about the xorg-commit mailing list