Commit Graph

824 Commits

Author SHA1 Message Date
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
Adam Jackson
f466fb2432 xres: Fix size estimation for <8bpp pixmaps (#69057)
Just use floats, it's not like this is a performance path.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-21 21:39:43 -07:00
Jon TURNEY
45b223e1c2 Build dpmsstubs.c once as a convenience library, rather than once for each DDX which wants to use it
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2014-03-27 14:09:33 +00:00
Mark Kettenis
ddeca92749 sync: Avoid ridiculously long timeouts
On OpenBSD, passing a timeout longer than 100000000 seconds to select(2) will
make it fail with EINVAL.  As this is original 4.4BSD behaviour it is not
inconceivable that other systems suffer from the same problem.  And Linux,
though not suffering from any 4.4BSD heritage, briefly did something similar:

<https://lkml.org/lkml/2012/8/31/263>

So avoid calling AdjustWaitForDelay() instead of setting the timeout to
(effectively) ULONG_MAX milliseconds.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2014-02-09 10:41:18 +01:00
Keith Packard
2d2d49dab5 Clean up a few function prototypes to not place formals in /**/
This just removes the comment markers from around the formals in
several function prototypes near where pointer -> void * changes were
made. There are plenty more of these to fix.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-01-12 10:24:12 -08:00
Keith Packard
60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Keith Packard
af04cf6968 Xext: Clean up warnings in hashtable code
Make keys const void *

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Keith Packard
a1cb69dc28 Xext: Clean up warnings
GC funcs and ops are const.
Remove unused variables.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Keith Packard
d89b42bda4 Clean up warnings in DIX
As usual, mostly const char changes. However, filter_device_events had
a potentially uninitialized value, 'raw', which I added a bunch of
checks for. I suspect most of those are 'can't happen', but it's hard
to see that inside the function.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Keith Packard
1ce15ed5ba Xext: _X_EXPORT DPMSSet and DPMSSupported
These are needed by drivers, and it's better to export them from here
rather than redefining them in hw/xfree86 and exporting them from there.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Adam Jackson
f10f36d91d damageext: Xineramify (v7)
v7: Don't bother making resources for the backing listeners. [keithp]

This is now slightly unlike how other resources are xineramified.  We
create N+1 internal damage listeners, one that's a real resource and
reflects the protocol view, and then one per backend screen where the
report function piles onto the protocol view.  The internal listeners
are not stored in the resource database directly, they just hang off the
xinerama resource. We don't wrap Subtract at the dispatch level, but we
do extend it for the Xinerama case to clip to the root window geometry.

As a result of the N+1 design here, the damage reports we generate are
not quite minimal.  However they are indistinguishable from sequential
rendering events happening before the client hears damage, and we don't
need to add a post-dispatch callback just for this one extension.

Add is probably (still) somewhat broken since it will only hit screen 0,
but Add really only exists for DRI1's sake, and DRI1 disables itself
with Xinerama enabled anyway.  In the absence of a use case, I'm leaving
it unwrapped under Xinerama; if someone wants to define how it ought to
work, be my guest.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-09 13:20:37 -05:00
Adam Jackson
8dbe456aba xinerama: Export the screen region
damageext wants this so it can intersect subtract requests against the
root window geometry.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-09 13:20:36 -05:00
Keith Packard
cc63204926 Xext: Use SHMDIR and O_TMPFILE when creating mapping files
ShmCreateSegment asks for a file descriptor for a memory mapped file
created by the X server. This patch uses O_TMPFILE where available,
and also uses the SHMDIR directory to store the files, both for the
O_TMPFILE and mkstemp cases.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-12-02 12:57:05 -08:00
Keith Packard
037566c57c Xext: Recover from miSyncInitFenceFromFD failure without crashing
miSyncDestroyFence must not be called unless miSyncInitFence has been
invoked, so if miSyncInitFenceFromFD fails, we must free the fence
manually.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Fredrik Höglund <fredrik@kde.org>
2013-11-23 22:06:19 -08:00
Keith Packard
9309d2a009 xext: Fix shmint.h to not use headers outside of sdk_HEADERS
shmint.h is part of sdk_HEADERS, and so can't use anything not
included in sdk_HEADERS.

busfault.h includes dix-config.h which is not. Leave the use of
struct busfault in shmint.h and move the include of busfault.h to
shm.c.

protocol-versions.h is not part of sdk_HEADERS, so instead of using
that, just use XTRANS_SEND_FDS to choose whether to expose the fd
passing requests directly.

Reported-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Knut Petersen <Knut_Petersen@t-online.de>
Reviewed-by: Julien Cristau <jcristau@debian.org>

v2: also avoid using protocol-versions.h
2013-11-14 10:22:15 +09:00
Keith Packard
41da295eb5 Trap SIGBUS to handle truncated shared memory segments
If a client passes a section of memory via file descriptor and then
subsequently truncates that file, the underlying pages will be freed
and the addresses invalidated. Subsequent accesses to the page will
fail with a SIGBUS error.

Trap that SIGBUS, figure out which segment was causing the error and
then allocate new pages to fill in for that region. Mark the offending
shared segment as invalid and free the resource ID so that the client
will be able to tell when subsequently attempting to use the segment.

Signed-off-by: Keith Packard <keithp@keithp.com>

v2: Use MAP_FIXED to simplify the recovery logic (Mark Kettenis)
v3: Also catch errors in ShmCreateSegment

Conflicts:
	include/dix-config.h.in
	include/xorg-config.h.in
2013-11-11 15:16:07 -08:00
Keith Packard
bee2ec5404 Xext: Enable MIT-SHM FD-passing request definitions only when possible
Check to see if xtrans FD passing is available and use that to
advertise the appropriate version of the SHM extension

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-11-11 15:12:50 -08:00
Keith Packard
aaf0e29619 Disable DRI3 and sync fence FD functions if xshmfence isn't available
Make sure the server can build when the xshmfence library isn't present

Signed-off-by: Keith Packard <keithp@keithp.com>
2013-11-04 18:53:36 -08:00
Keith Packard
977e2644b1 Merge remote-tracking branch 'whot/for-keith' 2013-11-01 00:34:18 -07:00
Peter Hutterer
f36f5a65f6 sync: fix corner-case in triggering idle alarms
ProcessInputEvent() resets the device idle times. If idle time was higher than
the lower bracket, this should trigger an event in the idle time wakeup
handler.

If processing is slow, the idle time may advance past the lower bracket
between the reset and the time the BlockHandler is called. In that case, we'd
never schedule a wakeup to handle the event, causing us to randomly miss
events.

Ran tests with a neg transition trigger on 5ms with 200 repeats of the test
and it succeeded. Anything below that gets a bit tricky to make sure the
server sees the same idle time as the client usleeps for.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-11-01 17:08:22 +10:00
Keith Packard
5631382988 dri3: Add DRI3 extension
Adds DRM compatible fences using futexes.
Uses FD passing to get pixmaps from DRM applications.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 16:58:30 -07:00
Keith Packard
fdec793cdc Add support for MIT-SHM AttachFd request
This passes a file descriptor from the client to the server, which is
then mmap'd

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 16:58:28 -07:00