Commit Graph

894 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Aaron Plattner 4308f5d3d1 os: Don't crash in AttendClient if the client is gone
If a client is in the process of being closed down, then its client->osPrivate
pointer will be set to NULL by CloseDownConnection. This can cause a crash if
freeing the client's resources results in a call to AttendClient. For example,
if the client has a pending sync fence:

 Thread 1 "X" received signal SIGSEGV, Segmentation fault.
 AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942
 (gdb) bt
 #0  AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942
 #1  0x00005571c3dbb865 in SyncAwaitTriggerFired (pTrigger=<optimized out>) at ../Xext/sync.c:694
 #2  0x00005571c3dd5749 in miSyncDestroyFence (pFence=0x5571c5063980) at ../miext/sync/misync.c:120
 #3  0x00005571c3dbbc69 in FreeFence (obj=<optimized out>, id=<optimized out>) at ../Xext/sync.c:1909
 #4  0x00005571c3d7a01d in doFreeResource (res=0x5571c506e3d0, skip=skip@entry=0) at ../dix/resource.c:880
 #5  0x00005571c3d7b1dc in FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1146
 #6  FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1109
 #7  0x00005571c3d5525f in CloseDownClient (client=0x5571c4aed9a0) at ../dix/dispatch.c:3473
 #8  0x00005571c3d55eeb in Dispatch () at ../dix/dispatch.c:492
 #9  0x00005571c3d59e96 in dix_main (argc=3, argv=0x7ffe7854bc28, envp=<optimized out>) at ../dix/main.c:276
 #10 0x00007fea4837cb6b in __libc_start_main (main=0x5571c3d1d060 <main>, argc=3, argv=0x7ffe7854bc28, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe7854bc18) at ../csu/libc-start.c:308
 #11 0x00005571c3d1d09a in _start () at ../Xext/sync.c:2378
 (gdb) print client->osPrivate
 $1 = (void *) 0x0

Since the client is about to be freed, its ignore count doesn't matter and
AttendClient can simply be a no-op. Check for client->clientGone in AttendClient
and remove similar checks from two callers that had them.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2019-11-19 10:15:05 -08:00
Adam Jackson 516e75dbb6 dix: Call SourceValidate before GetImage
This ensures that any prep work for the drawable we're about to read
from is already done before we call down to GetImage. This should be no
functional change as most of the callers with a non-trivial
SourceValidate are already wrapping GetImage and doing the equivalent
thing, but we'll be simplifying that shortly.

More importantly this ensures that if any of that prep work would
generate events - like automatic compositing flushing rendering to a
parent pixmap which then triggers damage - then it happens entirely
before we start writing the GetImage reply header.

Note that we do not do the same for GetSpans, but that's okay. The only
way to get to GetSpans is through miCopyArea or miCopyPlane - where the
callers must already call SourceValidate - or miGetImage - which this
commit now protects with SourceValidate.

Fixes: xorg/xserver#902
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-10-30 16:26:01 +00:00
Adam Jackson 6fe7c43fa5 dix: Fix undefined shift in ht_generic_hash
The hits keep coming.
2019-10-15 14:06:30 -04:00
Alex Goins 7f962c70b6 xsync: Add resource inside of SyncCreate, export SyncCreate
As shown by DRI3 adding the SyncCreateFenceFromFD() function, extensions may
want to create a fence, then initialize it in their own way. This currently
can't be done without adding a function directly to Xext/sync.c due to the fact
that the RTFence resource type is private and there is no external interface to
add to it.

To facilitate other X extensions creating fences and initializing them, this
change exports SyncCreate() and adds the resource directly within it. Callers no
longer need to call AddResource() after SyncCreate(), they only need to
initialize the SyncObject.

To prevent FreeFence() and FreeCounter() from segfaulting if the call to
AddResource() fails before the sync object is initialized, this adds a new
'initialized' parameter to SyncObject that, when FALSE, causes FreeFence() and
FreeCounter() to skip de-initialization and simply free the object.
Initialization after adding the resource shouldn't otherwise be a problem due to
the single-threaded nature of X.

Signed-off-by: Alex Goins <agoins@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2019-04-17 14:01:17 -07:00
Alexander Volkov f6753c117e shm: Use memfd_create when possible
It doesn't require shared memory dir and thus allows
to avoid cases when this dir is detected incorrectly,
as in https://bugreports.qt.io/browse/QTBUG-71440

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
2019-02-14 12:53:06 +03:00
Eric Anholt 19f6cb570b shm: Pick the shm dir at run time, not build time.
Prodding the builder's filesystem for tmp dirs doesn't necessarily
tell you anything about what the actual host's filesystem is going to
look like, so we should just try the dirs at runtime.

Signed-off-by: Eric Anholt <eric@anholt.net>
2018-09-19 21:36:16 +00:00
Eric Anholt 804a9b4f57 shm: reindent shm_tmpfile to follow our standards.
Signed-off-by: Eric Anholt <eric@anholt.net>
2018-09-19 21:36:16 +00:00
Dave Airlie 3439929c51 shm: move shmsize verify before allocating the drawable.
Otherwise if the VERIFY_SHMSIZE macro fails we leak the drawables
we allocated earlier.

Noticed by coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-09-12 10:30:13 +10:00
Adam Jackson 047794e350 xselinux: warning fix
../Xext/xselinux_ext.c: In function ‘SELinuxExtensionInit’:
../Xext/xselinux_ext.c:692:21: warning: variable ‘extEntry’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-11 20:03:38 +00:00
Peter Hutterer 93cafb0828 Xext: dynamically allocate the PanoramiXDepths[j].vids array
Control flow is:
   PanoramiXMaybeAddDepth() allocates an array size 240 (pDepth->numVisuals)
   PanoramiXMaybeAddVisual() finds up to 270 matches (pScreen->numVisuals)
   and writes those into the previously allocated array.

This caused invalid reads/writes followed by eventually a double-free abort.

Reproduced with xorg-integration-tests server test
XineramaTest.ScreenCrossing/* (and a bunch of others).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2018-07-19 11:52:14 +10:00
John Lumby f5aace7a27 Change the DPMS initialization to be conditional on not set from config
Any DPMS timeout values set in ServerFlags section of the xorg.conf
are being overwritten by DPMS extension initialization.  Therefore
change the DPMS initialization of timeout values to be conditional on
not set from config.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106963
Signed-off-by: John Lumby <johnlumby@hotmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-06-26 17:14:34 -07:00
Alexander Volkov ec7e2b54c5 Xext/shm: Refuse to work for remote clients
Avoid access to System V shared memory segment on the X server side
for clients forwarded via SSH. Also prevent them from hanging while
waiting for the reply from the ShmCreateSegment request.

v2: Allow ShmQueryVersion request even for remote clients

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=11080
Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-06-14 12:35:09 -04:00
Lyude Paul 4e28a6a223 meson: Ensure we always build Xext/hashtable.c for glx
Seems that while glxvnd relies on some of the hashtable functions in
Xext, we only build hashtable support for Xext if we're also building
the res extension. This leads to some errors if you try to build glx
without res enabled:

glx/liblibglxvnd.a(vndcmds.c.o): In function `LookupVendorPrivDispatch':
/home/lyudess/Projects/xserver/glx/vndcmds.c:65: undefined reference to `ht_find'
/home/lyudess/Projects/xserver/glx/vndcmds.c:67: undefined reference to `ht_add'
glx/liblibglxvnd.a(vndcmds.c.o): In function `GlxDispatchInit':
/home/lyudess/Projects/xserver/glx/vndcmds.c:405: undefined reference to `ht_generic_compare'
/home/lyudess/Projects/xserver/glx/vndcmds.c:405: undefined reference to `ht_generic_hash'
/home/lyudess/Projects/xserver/glx/vndcmds.c:405: undefined reference to `ht_create'
glx/liblibglxvnd.a(vndcmds.c.o): In function `GlxDispatchReset':
/home/lyudess/Projects/xserver/glx/vndcmds.c:468: undefined reference to `ht_destroy'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

So, make sure that hashtable.c gets both for both glx and res

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
2018-04-19 16:20:22 -04:00
Michal Srb 14be894b3f Xext: Fix memory leaks in hashtable.
Do not forget to delete key and value of every item and the hashtable itself.
2018-04-10 14:41:29 -04:00
Thierry Reding 88c7b8bf4b meson: Distribute more SDK headers
Install missing headers to the SDK directory to allow external modules
to properly build against the SDK. After this commit, the list of files
installed in the SDK include directory is the same as the list of files
installed by the autotools-based build.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-04-02 13:42:08 -04:00
Alexander Volkov d36128a72a Xext/shm: Downgrade from error to debug log output about success
Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-21 11:20:05 -04:00
Keith Packard 52048ce29f Xext/saver: Swap ScreenSaverSuspend 'suspend' field. Handle old XCB clients.
This field was defined as a Bool in the protocol headers and BOOL in
xcb. Bool is not a valid type for protocol fields. It is defined as
'int' by Xdefs.h, which we expect to be 32-bits on all machines.

The protocol headers and xcb have patches posted to switch to CARD32,
which is at least well defined.

This change adds the necessary byte swapping to handle other-endian
clients with this 32-bit field, and then changes the request
processing to compare all 32-bits against zero so that it works with
both new and old clients.

On MSB machines, Xlib will continue to work properly, but old XCB will
not interoperate with the X server (either before or after this patch).

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Mihai Moldovan <ionic@ionic.de>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-14 10:14:04 -07:00
Jan Beich 1e23f03dd5 shm, xwayland: prefer atomic close-on-exec without O_TMPFILE
Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-02 15:28:46 -05:00
David Weinehall 528cf6fcee sync: Fix diffgreater comparison
xsync: Fix diffgreater comparison

While transitioning from CARD64 to int64,
the GreaterThan call was mistakenly transformed into ">=".
Part of this was fixed already in
commit 8060196a3e

This patch fixes the remaining issue.

Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2018-01-18 14:08:46 -05:00
Adam Jackson eafcd009f1 xres: Return the atom naming the type, not its internal type number
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-11-14 16:02:49 -05:00
Daniel Martin d5379b350f Use ARRAY_SIZE all over the tree
Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with
the ARRAY_SIZE macro from dix.h when possible. A semantic patch for
coccinelle has been used first. Additionally, a few macros have been
inlined as they had only one or two users.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-30 13:45:20 -04:00
Nikolay Martynov 885636b7d4 XShmGetImage: fix censoring
It looks like offsets calculated during image censoring are wrong.
This results in black (empty) images returns.

This fix is very similar to 6c6f09aac7
that was applied to XGetImage

Visually this fixes chromium/firefox window sharing in multiscreen
configurations - without this patch most of the windows on 'secodnary'
screens are black.

This also should fix https://bugs.freedesktop.org/show_bug.cgi?id=101730.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-12 15:51:36 -04:00
Nathan Kidd 1b1d4c0469 hw/xfree86: unvalidated lengths
This addresses:
CVE-2017-12180 in XFree86-VidModeExtension
CVE-2017-12181 in XFree86-DGA
CVE-2017-12182 in XFree86-DRI

Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2017-10-10 23:33:44 +02:00
Nathan Kidd cad5a1050b Unvalidated lengths
v2: Add overflow check and remove unnecessary check (Julien Cristau)

This addresses:
CVE-2017-12184 in XINERAMA
CVE-2017-12185 in MIT-SCREEN-SAVER
CVE-2017-12186 in X-Resource
CVE-2017-12187 in RENDER

Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2017-10-10 23:33:34 +02:00
Michal Srb b95f25af14 Xext/shm: Validate shmseg resource id (CVE-2017-13721)
Otherwise it can belong to a non-existing client and abort X server with
FatalError "client not in use", or overwrite existing segment of another
existing client.

Signed-off-by: Julien Cristau <jcristau@debian.org>
2017-10-04 21:06:17 +02:00
Louis-Francis Ratté-Boulianne 8060196a3e sync: Fix delta value check
While transitionning from CARD64 to int64, the GreaterThan call
as mistakenly been transformed into ">=". That was at least
causing problems with Mutter.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-09-27 11:06:09 -04:00
Eric Anholt e0f872207a sync: Convert from "CARD64" to int64_t.
The extension was using the name CARD64 to represent 64-bit values,
with a #define from CARD64 to XSyncValue, a struct with a pair of
32-bit values representing a signed 64-bit value.  This interfered
with protocol headers using CARD64 to try to actually store a
uint64_t.  Now that stdint.h exists, let's just use that here,
instead.

v2: Fix alarm delta changes.
v3: Do the potentially overflowing math as uint and convert to int
    afterward, out of C spec paranoia.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-09-20 13:19:27 -04:00
Adam Jackson f44e0af4da dix: Remove extension aliases
This appears to be essentially unused. The only known client-side
library for the SELinux extension is xcb, which does not look for the
name "Flask". The "SGI-GLX" alias for GLX appears to be a bit of
superstition at this point, NVIDIA's driver does not expose it and Mesa
does not check for it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2017-06-20 16:37:24 -04:00
Eric Anholt d8ccfb1326 meson: Fix enabling of xshmfence.
I misspelled the enable flag, so DRI3 would throw BadImplementation
when you tried to start any GL app.  Same as in
c7be7a688a, we also convert it to #ifdef
for consistency.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 09:04:10 -07:00
Julien Cristau 6634ffc4d2 Drop workaround for pre-glibc linux
It seems unlikely anyone still needs to build against libc4/libc5.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2017-05-11 15:24:01 -04:00
Eric Anholt 1549e30372 Add a Meson build system alongside autotools.
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest,
and Xdmx so far.  The outline of Xquartz/Xwin support is in tree, but
hasn't been built yet.  The unit tests are also not done.

The intent is to build this as a complete replacement for the
autotools system, then eventually replace autotools.  meson is faster
to generate the build, faster to run the bulid, shorter to write the
build files in, and less error-prone than autotools.

v2: Fix indentation nits, move version declaration to project(), use
    existing meson_options for version-config.h's vendor name/web.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 15:25:27 -07:00
Adam Jackson 3360418767 dpms: Consolidate a bunch of stuff into Xext/dpms.c
Most of this is a legacy of the old "extmod" design where you could load
_some_ extensions dynamically but only if the server had been built with
support for them in the first place.

Note that since we now only initialize the DPMS extension if at least
one screen supports it, we no longer need DPMSCapableFlag: if it would
be false, we would never read its value.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-27 15:59:47 -04:00
Adam Jackson 7f1ef9289d dix: Lift DPMS to a screen hook
Following on from the previous change, this adds a DPMS hook to the
ScreenRec and uses that to infer DPMS support. As a result we can drop
the dpms stub code from Xext.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-27 15:59:42 -04:00
Adam Jackson 8ed0b00fce xfree86: Clean up DPMS support
Rather than setting up a per-screen private, just conditionally
initialize ScrnInfoRec::DPMSSet based on the config options, and inspect
that to determine whether DPMS is supported.

We also move the "turn the screen back on at CloseScreen" logic into the
DPMS extension's (new) reset hook. This would be a behavior change for
the non-xfree86 servers, if any of them had non-stub DPMS support.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-27 15:59:35 -04:00
Adam Jackson e337de2d48 xinerama: Implement graphics exposures for window->pixmap copies (v4)
This code is using GetImage to accumulate a logical view of the window
image (since the windows will be clipped to their containing screen),
and then PutImage to load that back into the pixmap.  What it wasn't
doing was constructing a region for the obscured areas of the window and
emitting graphics exposures for same.

v2: Fix coordinate translation when the source is the root window
v3: Create sourceBox with the right coordinates initially instead of
translating (Keith Packard)
v4: Clamp the region to 15 bits to avoid overflow (Keith Packard)

Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-15 16:16:36 -04:00
Adam Jackson dc7ceda90f dispatch: Mark swapped dispatch as _X_COLD
This touches everything that ends up in the Xorg binary; the big missing
part is GLX since that's all generated code. Cuts about 14k from the
binary on amd64.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-01 10:16:20 -05:00
Keith Packard 6c6f09aac7 xace: Don't censor window borders
GetImage is allowed to return window border contents, so don't remove
that from the returned image.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-28 15:25:07 -04:00
Hans de Goede 380c2ca25e XF86VidMode: Fix free() on walked pointer
Based on: https://patchwork.freedesktop.org/patch/85636/

Rewritten to just not walk the pointer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emi Velikov <emil.l.velikov@gmail.com>
2016-09-28 14:53:39 -04:00
Hans de Goede 220d327ee0 Xext: Fix a memory leak
Based on: https://patchwork.freedesktop.org/patch/85636/

Rewritten to also free the resources allocated by
panoramix_setup_ids().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emi Velikov <emil.l.velikov@gmail.com>
2016-09-28 14:53:39 -04:00
Jeremy Huddleston Sequoia a5769de0f5 Xext/shm: Fix usage of F_GETFD to match standard
flags = fcntl(fd, F_GETFD) is compliant.

fcntl(fd, F_GETFD, &flags) is non-compliant (Linux extension?)

cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2016-09-13 10:00:51 -07:00
Adam Jackson 65493c0b73 sync: Don't do return client->noClientException
Hasn't been necessary since:

    commit 92ed75ac59
    Author: Jamey Sharp <jamey@minilop.net>
    Date:   Mon May 10 20:22:05 2010 -0700

        Eliminate boilerplate around client->noClientException.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-02 13:41:05 -04:00
Adam Jackson 2f981c06a5 xv: Remove some dumb calls SendErrorToClient
We already generate errors from the top level when non-Success is
returned from a dispatch function, so really we were emitting errors
twice.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-08-16 15:56:22 -04:00
Aaron Plattner 92b3cd3206 xace: Fix XaceCensorImage to actually censor the right part of the image
The caller passes arguments into XaceCensorImage that are in
window-relative coordinates. However, the pBuf that it uses to construct
a temporary pixmap has its origin at (x, y) relative to the window in
question. The code to convert the censor region into boxes adjusts for
the Y coordinate, but leaves the X coordinate alone. The result is that
if x is not zero, it censors the wrong part of the image.

Fix this by just translating censorRegion into pixmap-relative
coordinates and using the resulting boxes as-is.

Reported-by: Fabien Lelaquais <Fabien.Lelaquais@roguewave.com>
Link: https://lists.x.org/archives/xorg/2016-August/058165.html
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2016-08-15 13:12:06 -04:00
Keith Packard 9d15912aa4 Remove fd_set from Block/Wakeup handler API
This removes the last uses of fd_set from the server interfaces
outside of the OS layer itself.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:27:51 -04:00
Keith Packard 05a793f5b3 dix: Switch to the libXfont2 API (v2)
This new libXfont API eliminates exposing internal X server symbols to
the font library, replacing those with a struct full of the entire API
needed to use that library.

v2: Use libXfont2 instead of libXfont_2

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:25:59 -04:00
Andrew Eikum 4926845a57 shm: Also censor images returned by ShmGetImage
We currently censor images from dix's GetImage, but not from
ShmGetImage. This is a method to bypass XACE, creating a potential
leak. We should censor in both methods.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
2016-07-15 10:56:28 -04:00
Adam Jackson 4f8a72034c res: Simplify QueryClientPixmapBytes
I suspect this code predates the common resource hooks for computing
sizes.  It's ugly in any case since the Resource extension shouldn't
need to know which extensions can take a reference on pixmaps.  Instead,
let's just walk every resource for the client and sum up all the pixmap
bytes that way.

This might be slightly slower since we're calling the size func once for
every resource.  On the other hand, it might be slightly faster since we
only walk the resource table once instead of 3-5 times.  Probably a
wash, and not really a performance path in any case.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-06-21 11:11:44 -04:00
Adam Jackson 6cb34816af xace: Remove the audit hooks and tune dispatch
There are no in-tree consumers of the audit hooks, and they are in any
case redundant with the dtrace dispatch hooks. Neither is there any
in-tree user of the core request dispatch hook. The extension hook is
only used for non-default security cases, but in the absence of LTO we
always have to take the function call into XaceHookDispatch to find out
that there's no callback registered.

Cc: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-06-10 13:26:19 -04:00
Adam Jackson 6178b1c91c dix: Use OsSignal() not signal()
As the man page for the latter states:

    The effects of signal() in a multithreaded process are unspecified.

We already have an interface to call sigaction() instead, use it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-06-08 11:36:31 -04:00