Bug 28968 - Drawable NULL-pointer dereference causes SEGV
Summary: Drawable NULL-pointer dereference causes SEGV
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Security (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Adam Jackson
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-08 17:06 UTC by halfdog
Modified: 2014-04-22 15:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description halfdog 2010-07-08 17:06:44 UTC
During X server security testing, current lucid xserver was terminated on
invalid request (1:7.5+5ubuntu1)

Example:

X_RenderCreateSolidFill
0000000: 6c00 0b00 0000 0000 0000 0000 9521 0500  l............!..
0000010: 9400 2000 0000 0000 0000 0000 8802 1d00  ................

X_XFixesQueryVersion
0000020: 9400 0300 0400 0000 0000 0000

X_XFixesSetPictureClipRegion
                                       9416 0400  ................
0000030: 9400 2000 0000 0800 0000 0000            ............


(gdb) bt
#0  0x080f0a79 in ProcXFixesSetPictureClipRegion (client=0x95a6410)
    at ../../xfixes/region.c:782
#1  0x080f1f9a in ProcXFixesDispatch (client=0x95a6410)
    at ../../xfixes/xfixes.c:157
#2  0x08072477 in Dispatch () at ../../dix/dispatch.c:439
#3  0x08066d7a in main (argc=1, argv=0xbf8c3f84, envp=0xbf8c3f8c)
    at ../../dix/main.c:285


ProcRenderCreateSolidFill creates picture with drawable=0

Other functions use the drawable without checking it, e.g.

./xfixes/region.c:782
int
ProcXFixesSetPictureClipRegion (ClientPtr client)
{
#ifdef RENDER
    PicturePtr          pPicture;
    RegionPtr           pRegion;
    ScreenPtr           pScreen;
    PictureScreenPtr    ps;
    REQUEST(xXFixesSetPictureClipRegionReq);

    REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
    VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess,
                   RenderErrBase + BadPicture);
    pScreen = pPicture->pDrawable->pScreen;
    ps = GetPictureScreen (pScreen);   <<<< crash


This might also affect

int
ProcXFixesCreateRegionFromPicture (ClientPtr client)

in xfixes/region.c and 

static int dmxProcRenderSetPictureTransform(ClientPtr client)
{

in xfixes/region.c (search for VERIFY_PICTURE)


Credits to me@halfdog.net
Comment 1 Adam Jackson 2014-04-10 15:10:03 UTC
Not exploitable (assuming the zero page is never mapped, which is true), clearing security group.
Comment 2 Adam Jackson 2014-04-22 15:42:45 UTC
commit ba2432a020a9f9bd0892f643117795336ba0fc16
Author: Adam Jackson <ajax@redhat.com>
Date:   Thu Apr 10 11:34:28 2014 -0400

    xfixes: Forbid manipulating clip for source-only pictures (#28968)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.