xserver: Branch 'master' - 2 commits
Adam Jackson
ajax at kemper.freedesktop.org
Wed Mar 15 19:39:22 UTC 2017
glamor/glamor.c | 3 +++
hw/kdrive/ephyr/ephyr.c | 6 ++++--
hw/kdrive/ephyr/hostx.c | 5 +++++
3 files changed, 12 insertions(+), 2 deletions(-)
New commits:
commit b0ce1d088a863492f5de11e4dbde10af4261d892
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Mar 14 15:22:32 2017 +0100
Xephyr: Check screen resources creation success
If the screen pixmap or the corresponding texture creation with glamor
fails, exit cleanly with an error message instead of segfaulting.
Fixes: https://bugzilla.redhat.com/1431633
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 4eec72a..ef5350e 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -725,8 +725,10 @@ ephyrCreateResources(ScreenPtr pScreen)
ephyrShadowUpdate, ephyrWindowLinear);
else {
#ifdef GLAMOR
- if (ephyr_glamor)
- ephyr_glamor_create_screen_resources(pScreen);
+ if (ephyr_glamor) {
+ if (!ephyr_glamor_create_screen_resources(pScreen))
+ return FALSE;
+ }
#endif
return ephyrSetInternalDamage(pScreen);
}
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index fe69f84..a9ea372 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1559,6 +1559,8 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
pScreen->height,
pScreen->rootDepth,
GLAMOR_CREATE_NO_LARGE);
+ if (!screen_pixmap)
+ return FALSE;
pScreen->SetScreenPixmap(screen_pixmap);
if (pScreen->root && pScreen->SetWindowPixmap)
@@ -1566,6 +1568,9 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
/* Tell the GLX code what to GL texture to read from. */
tex = glamor_get_pixmap_texture(screen_pixmap);
+ if (!tex)
+ return FALSE;
+
ephyr_glamor_set_texture(scrpriv->glamor, tex);
return TRUE;
commit f40ff18c96e02ff18a367bf53feeb4bd8ee952a0
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Mar 14 15:22:31 2017 +0100
glamor: Check for NULL pixmap in glamor_get_pixmap_texture()
glamor_create_pixmap() would return a NullPixmap if the given size is
larger than the maximum size of a pixmap.
But glamor_get_pixmap_texture() won't check if the given pixmap is
non-null, leading to a segfault if glamor_create_pixmap() failed.
This can be reproduced by passing Xephyr a very large screen width,
e.g.:
$ Xephyr -glamor -screen 32768x1024 :10
(EE)
(EE) Backtrace:
(EE) 0: Xephyr (OsSigHandler+0x29)
(EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0)
(EE) 2: Xephyr (glamor_get_pixmap_texture+0x30)
(EE) 3: Xephyr (ephyr_glamor_create_screen_resources+0xc6)
(EE) 4: Xephyr (ephyrCreateResources+0x98)
(EE) 5: Xephyr (dix_main+0x275)
(EE) 6: /lib64/libc.so.6 (__libc_start_main+0xf1)
(EE) 7: Xephyr (_start+0x2a)
(EE) 8: ? (?+0x2a) [0x2a]
(EE)
(EE) Segmentation fault at address 0x0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE)
Aborted (core dumped)
Bugzilla: https://bugzilla.redhat.com/1431633
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
diff --git a/glamor/glamor.c b/glamor/glamor.c
index c54cf3b..2467443 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -133,6 +133,9 @@ glamor_get_pixmap_texture(PixmapPtr pixmap)
{
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!pixmap_priv)
+ return 0;
+
if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
return 0;
More information about the xorg-commit
mailing list