Commit Graph

845 Commits

Author SHA1 Message Date
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
Adam Jackson
f523ebb549 dix: Remove pointless client-state callbacks
Private storage is pre-zeroed by the private system itself.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-05-11 11:21:08 -04:00
Adam Jackson
137ac094e7 dix: Push UpdateCurrentTimeIf down out of the main loop
This was added in:

    commit 312910b4e3
    Author: Chase Douglas <chase.douglas@canonical.com>
    Date:   Wed Apr 18 11:15:40 2012 -0700

        Update currentTime in dispatch loop

Unfortunately this is equivalent to calling GetTimeInMillis() once per
request. In the absolute best case (as on Linux) you're only hitting the
vDSO; on other platforms that's a syscall. Either way it puts a pretty
hard ceiling on request throughput.

Instead, push the call down to the requests that need it; basically,
grab processing and event generation.

Cc: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-04 10:58:01 -04:00
Adam Jackson
a5dd7b890f dix: Squash some new gcc6 warnings
-Wlogical-op now tells us:

    devices.c:1685:23: warning: logical ‘and’ of equal expressions

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-04-29 11:19:58 -04:00
Ángel González
4583fa9a6c security: Fix reversed comment
Commit 6045506be0 changed back
the behavior to only allow the trusted extensions to the untrusted clients,
but left the 8b5d21cc1d
comment intended for Security*Un*trustedExtensions saying that
"untrusted clients shouldn't have access to these".

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ángel González <ingenit@zoho.com>
2016-03-14 11:49:13 -04:00
Adam Jackson
4f8151c7a4 Fix the typo from the previous patch, d'oh
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-14 11:20:39 -04:00
Chris Wilson
75eecf28ae Xext/vidmode: Reduce verbosity of GetModeLine debug messages
In commit f175cf45ae
Author: Olivier Fourdan <ofourdan@redhat.com>
Date:   Wed Feb 10 09:34:34 2016 +0100

    vidmode: move to a separate library of its own

the verbosity of some old debug messages (which print the reply to every
GetModeLine client request and others) was increased leading to lots of
log spam. Downgrade the logging back to DebugF.

[ajax: Fix a typo so it compiles.]

Reviewed-by: Adam Jackson <ajax@redhat.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=94515
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Olivier Fourdan <ofourdan@redhat.com>
2016-03-14 10:40:08 -04:00
Julien Cristau
119d5c0e2f xvmc: Fix unchecked AddResource
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2016-03-08 10:19:33 -05:00
Julien Cristau
939ce0bae6 xv: fix double free in AddResource failure case
XvdiDestroyVideoNotifyList already frees the list if AddResource fails,
so don't do it twice.  And set tpn->client to NULL explicitly to avoid
confusing uninitialized memory with a valid value.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2016-03-02 10:03:29 -05:00
Adam Jackson
093f9505c1 xv: Fix unchecked AddResource
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-02 10:03:11 -05:00
Olivier Fourdan
ac4d8c7cee vidmode: build without xf86vidmodeproto
git commit f175cf45:

  vidmode: move to a separate library of its own

introduced a regression where the xserver would not build when
xf86vidmodeproto is not installed even if the configure option
"--disable-xf86vidmode" is specified.

Fix build failure when xf86vidmodeproto is not installed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-03-01 11:25:59 -05:00
Olivier Fourdan
f175cf45ae vidmode: move to a separate library of its own
XVidMode extension might be useful to non hardware servers as well (e.g.
Xwayand) so that applications that rely on it (e.g. lot of older games)
can at least have read access to XVidMode.

But the implementation is very XFree86 centric, so the idea is to add
a bunch of vfunc that other non-XFree86 servers can hook up into to
provide a similar functionality.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87806
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:29:01 -05:00
Adam Jackson
8c49c883dc sync: Don't allow creating a system counter before sync is initialized
It probably doesn't work very well since there's other extension setup
we're not doing on this path, and in any event it's not a thing that
happens currently.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-12-08 18:22:54 -05:00
Keith Packard
6a121f5538 Xext/xselinux: Use NotifyFd interface
Replace block/wakeup handlers with SetNotifyFd. Much nicer now.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:56 -05:00
Julien Cristau
524844c8c1 Xext: fix build with --disable-xace
Regression from 990cf5b282

Signed-off-by: Julien Cristau <jcristau@debian.org>
Cc: Andrew Eikum <aeikum@codeweavers.com>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
2015-10-27 10:51:38 -04:00
Chris Wilson
912f1fe2bb Xv: Only stop the adaptors when the Pixmap is finally destroyed
Pixmaps are reference counted and DestroyPixmap is called for the
removal of every reference. However, we only want to stop the adaptors
writing into the Pixmap just before the Pixmap is finally destroyed,
similar to how Windows are handled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-10-21 15:13:41 -04:00
Jeremy Huddleston
a7a00e4bd8 security: Silence some benign -Wformat warnings
XID may be either 'unsigned long' or 'unsigned int' depending on:

typedef unsigned long CARD64;
typedef unsigned int CARD32;
typedef unsigned long long CARD64;
typedef unsigned long CARD32;

typedef unsigned long XID;
typedef CARD32 XID;

so when building with -Wformat, we get some warnings that are benign.  This silences them.

security.c:215:52: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
    SecurityAudit("revoked authorization ID %d\n", pAuth->id);
                                            ~~     ^~~~~~~~~
                                            %lu
  CC       dpmsstubs.lo
security.c:553:25: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
         client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
                        ^~~~~~~~~
security.c:553:55: warning: format specifies type 'int' but the argument has type 'CARD32' (aka 'unsigned long')
      [-Wformat,Format String Issue]
         client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
                                                      ^~~~~~~~~~~~~~
security.c:554:10: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
         pAuth->group, eventMask);
         ^~~~~~~~~~~~
security.c:554:24: warning: format specifies type 'int' but the argument has type 'Mask' (aka 'unsigned long')
      [-Wformat,Format String Issue]
         pAuth->group, eventMask);
                       ^~~~~~~~~
security.c:781:19: warning: format specifies type 'unsigned int' but the argument has type 'Mask' (aka 'unsigned
long')
      [-Wformat,Format String Issue]
                  requested, rec->id, cid,
                  ^~~~~~~~~
security.c:781:30: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
                  requested, rec->id, cid,
                             ^~~~~~~
security.c:863:23: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
                      rec->pWin->drawable.id, wClient(rec->pWin)->index,
                      ^~~~~~~~~~~~~~~~~~~~~~
security.c:893:31: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
                              rec->pWin->drawable.id,
                              ^~~~~~~~~~~~~~~~~~~~~~
security.c:915:39: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
      [-Wformat,Format String Issue]
                  rec->client->index, rec->pWin->drawable.id,
                                      ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-10-19 11:49:54 -04:00
Jeremy Huddleston
aa73d587fe xres: Silence -Wunused-function warnings when building !COMPOSITE or !RENDER
xres.c:422:1: warning: unused function 'ResFindCompositeClientWindowPixmaps' [-Wunused-function,Unused Entity Issue]
ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
^

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-10-19 11:49:54 -04:00
Keith Packard
6c2c6fb5a7 Xext, os: Remove OS-internal usages within XACE and XSELinux
These extensions were accessing internal OS functions and
structures. Expose the necessary functionality to them and remove
their use of osdep.h

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-09-24 13:38:24 -04:00
Keith Packard
9af111fe04 Xext/xselinux: Warning fixes
There's a 'const char *' adventure here that I'm mostly ignoring; some
client information gets const poisoned. Worked around by adding a
couple of casts. Ick.

Added an _X_ATTRIBUTE_PRINTF to SELinuxLog.

Ignore a couple of unused return values.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-09-24 13:35:21 -04:00
Adam Jackson
49d7bae7f4 xge: Hide some implementation details
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:40:58 -04:00
Andrew Eikum
5dc2a9aae4 xace: Add XaceHookIsSet helper function
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-10 14:14:25 +10:00
Keith Packard
c39c3a9750 Merge remote-tracking branch 'ajax/xserver-next' 2015-05-11 16:34:48 -07:00
Brent Collins
7470578520 shm: Fix xselinux resource initialization for xinerama pixmaps
This is necessary to avoid a NULL pointer deference when the pixmap is
used later.

[ajax: massaged commit message, fixed it to compile]

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89748
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Brent Collins <bcollins@trustedcs.com>
2015-05-07 15:10:19 -04:00
Chris Wilson
bcec9f867d shm: Fix use-after-free in ShmDestroyPixmap
We pass the pPixmap->drawable.id to the ShmDetachSegment function after
the pPixmap is freed. Fortunately, we don't use the value inside
ShmDetachSegment and can simply pass zero instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
2015-05-07 14:07:43 -04:00
Alan Coopersmith
1c56ac63c0 Convert top level extensions to new *allocarray functions
v2: remove now useless parentheses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:08 -07:00
Alan Coopersmith
f3ba909753 Let calloc handle multiplication
It's going to multiply anyway, so if we have non-constant values, might
as well let it do the multiplication instead of adding another multiply,
and good versions of calloc will check for & avoid overflow in the process.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:07 -07:00
Peter Hutterer
f485a1af64 Drop valuator mask argument from GetKeyboardEvents
Nothing was using it and if anyone had they would've gotten a warning and
noticed that it doesn't actually work. Drop this, it has been unused for years.

Input ABI 22

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2015-03-13 12:31:21 +10:00
Alan Coopersmith
32a95fb7c7 Xv: unvalidated lengths in XVideo extension swapped procs [CVE-2014-8099]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-08 18:09:48 -08:00
Alan Coopersmith
7553082b9b xcmisc: unvalidated length in SProcXCMiscGetXIDList() [CVE-2014-8096]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-08 18:09:48 -08:00
Keith Packard
ec0ac8970b Merge remote-tracking branch 'whot/for-keith' 2014-11-24 15:39:51 -08:00
Peter Hutterer
732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Peter Hutterer
25315ee555 Xext: fix clang compiler warning
shm.c:1150:24: warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
    if ((shmdesc->addr == ((char *) -1))) {

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Thierry Reding
63bb5c5ef1 xv: Add missing gcstruct.h include
Commit ea3f3b0786 (xv: Move xf86 XV color key helper to core.) added
code that uses internals of struct _GC. This structure is defined in the
include/gcstruct.h header which wasn't included by the source file, only
gc.h was. That caused the following build failure:

	  CC       xvmain.lo
	Xext/xvmain.c: In function 'XvFillColorKey':
	Xext/xvmain.c:1114:13: error: dereferencing pointer to incomplete type
	         (*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
	             ^

Fix this by including the correct header file.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Tested-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-10-31 07:00:01 -07:00
Chris Wilson
9b29fa957a Xext/shm: Detach SHM segment after Pixmap is released
The GPU may still have a reference to the SHM segment which would only
be finally released when the Pixmap is destroy. So we can only detach
the SHM segment (and thereby making the memory unaccessible) after the
backend has had a chance to flush any remaining references.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85058
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-and-tested-by: gedgon@gmail.com
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-10-27 15:33:48 -07:00
Adam Jackson
3f4edd2e3f xinerama: Fix access mode in GetImage's drawable lookup
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-10-23 14:29:49 -07:00
Adam Jackson
1e56b2dfc6 mi: Move pScreen->SendGraphicsExpose up to dix
No DDX is overriding this and it's fairly absurd to expose it as a
screen operation anyway.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Daniel Martin
2aeb9d8f8b security: Remove XpExtension from SecurityTrustedExtensions
There's no XPrint extension (anymore).

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-10-02 10:16:45 -07:00
Eric Anholt
ef258fa4fd xv: Drop the ClientPtr from the interface to the DDX.
Nobody was using it.

v2: Merge the hunk that was accidentally in the previous commit into
    this one.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-07 12:39:53 -07:00
Eric Anholt
850b268e2b xv: Remove the no-op AllocatePort/FreePort interfaces.
v2: Fix accidentally squashed-in change for dropping client from the
    arguments, which should have been in the next commit.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com> (v2)
2014-08-07 12:39:48 -07:00
Eric Anholt
7eac142fb6 xv: Fix malloc-failure cases in the fill color key helper.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
ea3f3b0786 xv: Move xf86 XV color key helper to core.
Color key overlay implementations want to reuse this code, and XF86's
had bugs (to be fixed in the next commit).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
b01cfe5f23 xv: Move CloseScreen setup from a DIX hook to normal wrapping.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
6a71ee79aa xv: Drop unused XvdiVideoStopped().
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
4a095902a3 xv: Drop unused XvdiPreemptVideo().
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
e7dde86f23 xv: Move the DDX XV screen private allocation into the DDXes.
XV was going against convention by having the core infrastructure
allocate the private on behalf of the DDX.  I was interested in this
because I was trying to make multiple pieces of DDX be able to
allocate adaptors, and that wasn't going to work if DDX-specific code
was hung off of a single global screen private.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
a146c6d421 xv: Drop the ddQueryAdaptors() interface.
The core was passing pointers to pxvs's nAdaptors and pAdaptors, and
the two hardware implementations were copying pxvs's nAdaptors and
pAdaptors into those pointers.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-08-06 20:12:20 -07:00
Eric Anholt
cb42805c66 xv: Move common code for adaptor cleanup to xvmain.c
Since any DDX XV screen cleanup would need this same code for freeing
the tree of pointers for xv adaptors, move it to the dix.

v2: Unconditionalize the pPorts freeing, to match the block above it.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com> (v1)
2014-08-06 20:12:20 -07:00
Adam Jackson
2db71b232c saver: Don't open-code IsMapInstalled
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-07-29 09:52:22 -04:00
Ray Strode
a26578dbb9 selinux: don't checkout for AVCs on select() EINTR
wakeup handlers are called even when select() returns EINTR,
and when they're called the passed fd set is undefined.

This commit fixes the selinux wakeup handler to avoid checking
for AVCs over the netlink socket spuriously.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ray Strode <rstrode@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-30 08:56:35 -07:00