diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2023-12-06 12:09:41 +0100 |
---|---|---|
committer | José Expósito <jose.exposito89@gmail.com> | 2024-01-16 09:25:49 +0100 |
commit | e5e8586a12a3ec915673edffa10dc8fe5e15dac3 (patch) | |
tree | 7a7990bcfb47785815da67b9fe835781c55bba2a | |
parent | 26769aa71fcbe0a8403b7fb13b7c9010cc07c3a8 (diff) |
glx: Call XACE hooks on the GLX buffer
The XSELINUX code will label resources at creation by checking the
access mode. When the access mode is DixCreateAccess, it will call the
function to label the new resource SELinuxLabelResource().
However, GLX buffers do not go through the XACE hooks when created,
hence leaving the resource actually unlabeled.
When, later, the client tries to create another resource using that
drawable (like a GC for example), the XSELINUX code would try to use
the security ID of that object which has never been labeled, get a NULL
pointer and crash when checking whether the requested permissions are
granted for subject security ID.
To avoid the issue, make sure to call the XACE hooks when creating the
GLX buffers.
Credit goes to Donn Seeley <donn@xmission.com> for providing the patch.
CVE-2024-0408
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | glx/glxcmds.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c index fc26a2e34..1e46d0c72 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -48,6 +48,7 @@ #include "indirect_util.h" #include "protocol-versions.h" #include "glxvndabi.h" +#include "xace.h" static char GLXServerVendorName[] = "SGI"; @@ -1392,6 +1393,13 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, if (!pPixmap) return BadAlloc; + err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP, + pPixmap, RT_NONE, NULL, DixCreateAccess); + if (err != Success) { + (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap); + return err; + } + /* Assign the pixmap the same id as the pbuffer and add it as a * resource so it and the DRI2 drawable will be reclaimed when the * pbuffer is destroyed. */ |