Commit Graph

11965 Commits

Author SHA1 Message Date
Peter Hutterer
55ff20eb37 dix: fix dereference before null check
Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-04 21:16:16 +10:00
Peter Hutterer
e3f47be9fb xfree86: fix use-after-free issue in checkInput
*dev is the condition of the while loop we're in, reset to NULL after
freeing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-04 21:16:16 +10:00
Peter Hutterer
252a69b592 xkb: use local variable instead of casting arg
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-04 21:16:16 +10:00
Peter Hutterer
d04dfe3f75 Drop custom sigio block/unblock functions from kdrive, ephyr and dmx
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-03 15:56:35 +10:00
Peter Hutterer
5d309af2ed xfree86: drop ddx-specific SIGIO blocking
The hooks are left for this cycle, we can drop it next cycle once the
drivers that need it (e.g. wacom) have been updated.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-03 15:56:35 +10:00
Peter Hutterer
ff67135bec xfree86: use OsBlockSIGIO from the ddx
We can ignore the "wasset" argument now since the DIX will keep proper
refcounting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-03 15:56:35 +10:00
Peter Hutterer
6bf356ef28 os: add OsBlockSIGIO and OsReleaseSIGIO
Let the dix be in charge of changing the sigprocmask so we only have one
entity that changes it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-03 15:56:33 +10:00
Keith Packard
24525d96a3 Merge branch 'sigsafe-logging-varargs'
This merge includes a minor fixup for '%p' arguments; must cast to
uintptr_t instead of uint64_t as we use -Werror=pointer-to-int-cast
which complains when doing a cast (even explicitly) from a pointer
to an integer of different size.
2012-07-02 22:35:39 -07:00
Peter Hutterer
35e3d22915 Bump to ABI_XINPUT_VERSION 18
The input ABI hasn't changed, but input drivers need something to hook on if
they want to log from within signal handlers and the input ABI is the
simplest way of doing so.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Peter Hutterer
541934168d xfree86: constify InputDriverPtr->driverName and default_options
Already treated as const anyway by all drivers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Peter Hutterer
c66089d220 xfree86: constify InputInfoPtr->type_name
This corresponds to XListInputDevice(3)'s "type" field (after being
converted to an Atom). Input drivers use the XI_KEYBOARD and similar
defines, even Wacom which falls out of the common defines uses constant
strings here. The use-case for having this non-const is small.

Input ABI break technically, since we never freed this information anyway it
is not a noticable change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Chase Douglas
505c8a2b2c Log in OsVendorFatalError() in a signal safe manner
The function can be called from a fatal signal handler.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Chase Douglas
d51aebdbf9 Log in LoaderUnload() in a signal safe manner
The function may be called from a fatal signal handler.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Chase Douglas
c3e1168778 Log in UnloadModuleOrDriver() in a signal safe manner
The function may be called from a fatal signal handler.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Chase Douglas
89e3ac07ac Log safely in fatal signal handler
While we probably don't need to be signal safe here since we will never
return to the normal context, the logging signal context check will
cause unsafe logging to be unhandled. Using signal safe logging here
resolves the issue.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Chase Douglas
6fd5add005 Log mieq enqueue overflow in a signal safe manner
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:33 -07:00
Chase Douglas
7f4a69b628 Log messages in TouchBeginDDXTouch() in a signal-safe manner
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
f752226e40 Log messages in GetTouchEvents() in a signal safe manner
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
82d1c6b310 Warn when attempting to log in a signal unsafe manner from signal context
Also, print out the offending message format. This will hopefully help
developers track down unsafe logging.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
512bec06be Make BUG_WARN* signal safe
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
0fa5217836 Print backtrace in a signal-safe manner
Backtraces are often printed in signal context, such as when a segfault
occurs.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

os: print offset as unsigned int, not long unsigned int

pnprintf() takes unsigned int for %u

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
ac20815d52 Add ErrorFSigSafe() alternative to ErrorF()
ErrorF() is not signal safe. Use ErrorSigSafe() whenever an error
message may be logged in signal context.

[whot: edited to "ErrorFSigSafe"]

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
164b38c72f Add LogMessageVerbSigSafe() for logging messages while in signal context
[whot: edited to use varargs, squashed commit below]

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

os: fix vararg length calculation

Make %u and %x sizeof(unsigned int), %p sizeof(void*). This is printf
behaviour and we can't guarantee that void* is uint64_t anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-07-02 22:34:32 -07:00
Alan Coopersmith
4cd91bd4c6 Enable no-undefined symbols mode in Solaris builds if -z parent is in ld
The Solaris linker recently added a -z parent flag for easier checking
of symbol definitions in plugins against the program that loads them.
If that's present, this enables it, along with -z defs to error on
undefined symbols to alert us if any modules call symbols that won't
be found at runtime.

This builds upon, and requires, the recent Cygwin work to build Xorg.
It moves a couple more modules to be after the Xorg binary in the build
order so that they can find the binary to check against, much as the
Cygwin changes did (these would be modules built on Solaris but not
Cygwin).

v2: This version only sets the flags for the xorg-server build itself,
and does not yet export them in xorg-server.pc to the drivers, since
most of the drivers are not ready to build with -no-undefined yet.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
2012-07-02 11:09:02 -07:00
Alan Coopersmith
d31942e15c Add pixman to module dependencies for pixman_region_* functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
2012-07-02 11:08:57 -07:00
Alan Coopersmith
339f38ef38 Build tda9885.c functions into fi1236 to avoid libtool relinking problems
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
2012-07-02 11:08:37 -07:00
Alan Coopersmith
a00066d291 Add dixGetGlyphs to replace GetGlyphs from libXfont to simplify linking
No other Xfont consumer used it, and this saves us from having to link
callers against libXfont for one simple function when doing
-no-undefined symbols builds.

The function is given a new name to avoid clashing with existing libXfont
binaries, but a #define is provided to preserve the API so we don't have
to fix all the callers at the same time.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
2012-07-02 10:09:08 -07:00
Aaron Plattner
212b980323 randr: Fix REQUEST vs. REQUEST_SIZE_MATCH mismatch
ProcRRGetScreenSizeRange uses REQUEST(xRRGetScreenSizeRangeReq) followed by
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq).  This happens to work out because both
requests have the same size, so this is not a functional change, just a cosmetic
one.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-29 23:34:30 -07:00
Dave Airlie
957bf959fb dix/render: consolidate window format matching code.
This code existed in 3 different forms, perhaps it should be
consolidated.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28 10:43:35 -07:00
Christopher James Halse Rogers
a7b97b0fa8 dri2: Fix authentication for < v8 clients (v2).
The legacy logic was embarassingly wrong; AuthMagic should return errno,
so returning FALSE only when AuthMagic returns nonzero is exactly wrong.

v2: Match drmAuthMagic by returning -EINVAL rather than EINVAL
    Fix trailing whitespace

https://bugs.freedesktop.org/show_bug.cgi?id=51400
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Knut Petersen <knut_petersen@t-online.de>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28 10:40:34 -07:00
Keith Packard
8b4f0a4fdd Merge remote-tracking branch 'jturney/master' 2012-06-28 10:38:26 -07:00
Keith Packard
59294a2179 Merge remote-tracking branch 'whot/for-keith' 2012-06-28 10:11:44 -07:00
Keith Packard
855003c333 randr: Catch two more potential unset rrScrPriv uses
Ricardo Salveti <ricardo.salveti@linaro.org> found one place where the
randr code could use the randr screen private data without checking
for null first. This happens when the X server is running with
multiple screens, some of which are randr enabled and some of which
are not. Applications making protocol requests to the non-randr
screens can cause segfaults where the server touches the unset private
structure.

I audited the code and found two more possible problem spots; the
trick to auditing for this issue was to look for functions not taking
a RandR data structure and where there was no null screen private
check above them in the call graph.

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28 10:06:40 -07:00
Ricardo Salveti de Araujo
32603f57ca randr: first check pScrPriv before using the pointer at RRFirstOutput
Fix a seg fault in case pScrPriv is NULL at ProcRRGetScreenInfo,
which later calls RRFirstOutput.

Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28 10:06:40 -07:00
Yaakov Selkowitz
d642e71287 configure.ac: link XWIN with GLX_SYS_LIBS
Link XWIN with GLX_SYS_LIBS, just like all the other DDXs

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-06-22 13:42:28 +01:00
Peter Hutterer
9f1edced9a xfree86: always enable SIGIO on OsVendorInit (#50957)
Drivers call xf86InstallSIGIOHandler() for their fd on DEVICE_ON. That
function does not actually enable the signal if it was blocked to begin
with. As a result, if one vt-switches away from the server (SIGIO is
blocked) and then triggers a server regeneration, the signal remains
blocked and input devices are dead.

Avoid this by always unblocking SIGIO when we start the server.

X.Org Bug 50957 <http://bugs.freedesktop.org/show_bug.cgi?id=50957>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-06-22 12:01:18 +10:00
Keith Packard
4ba340cfaa randr: Clean up compiler warnings about unused and shadowing variables
set but not used variables
shadowing a previous local

A hidden problem was that the VERIFY_RR_* macros define local 'rc'
variables, any other local definitions for those would be shadowed and
generate warnings from gcc. I've renamed the other locals 'ret'
instead of 'rc'.

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-21 18:42:46 -07:00
Peter Hutterer
191b630656 include: document _XkbErrCode2 macros
Why sending the number of the (implementation-dependent) error statement to
the client is a good idea is a bit beyond me, but at least document it so we
can all share the despair.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2012-06-22 10:51:00 +10:00
Peter Hutterer
7100118c8d AC_SUBST the GLX_SYS_LIBS
libxservertest needs -lpthread from glxapi.c's pthread_once() call. Usually
this would be pulled in by the XORG_LIBS but not when building without Xorg.

This commit has no visible effect on the current tree, preparation for test
cleanups.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-06-22 10:49:06 +10:00
Peter Hutterer
014ad46f1b os: print newline after printing display name
Much easier for scripts that try to read the display value off the file
descriptor. Plus, this restores the behaviour we had for this patch in
Fedora since server 1.6 (April 2009).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-22 10:49:06 +10:00
Sergei Trofimovich
e1f86a7c77 test/.gitignore: add hashtabletest
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-22 10:49:06 +10:00
Jon TURNEY
c9bbf8fe57 hw/xwin/glx: Fix glxWinCreateContext() function pointer mismatch
Fix glxWinCreateContext() function signature to align with commit 96d74138
"glx: Extend __GLXscreen::createContext to take attributes", which added more
parameters to the screen createContext function for implementing GLX_ARB_create_context

indirect.c: In function 'glxWinScreenProbe':
indirect.c:683:36: warning: assignment from incompatible pointer type

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-06-21 19:52:44 +01:00
Jon TURNEY
6e85660c75 hw/xwin/glx: Update gen_gl_wrappers.py for the current glx/dispatch.h
Fix the code generator for the dispatch table initialization after
the whitespace/coding style changes to glx/dispatch.h

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-06-21 19:35:10 +01:00
Jon TURNEY
cb638ed9c8 hw/xwin/glx: Blacklist 'GDI generic' GL renderer
If the native GL renderer is the GDI generic renderer (as can happen
if we are in safe mode, or the video driver is VGA, or we have hybrid
graphics which hasn't noticed that xwin requires 3d acceleration), don't
use it.  It's not accelerated and we will probably get better conformance
and perfomance from swrast.

Fix so we don't install screen function wrappers in glxWinScreenProbe
unless we are succesful.

Also, move fbConfig dumping to after GLX version has been determined
from extensions

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-06-21 18:59:04 +01:00
Jon TURNEY
8c24d20933 hw/xwin/glx: Fix glxLogExtensions to handle a null string without crashing
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-06-21 18:36:40 +01:00
Jon TURNEY
c08c7c8f65 hw/xwin/glx: Create a new dispatch table rather than modifying the existing one
Create a new dispatch table rather than modifying the existing one

struct _glapi_table is not a complete type after including glapi.h, so we use
glapi_get_dispatch_table_size() to determine it's size (alternatively, we could
include glapitable.h, to complete the type)

This could possibly be written to use _glapi_create_table_from_handle() instead, but
that requires making all the wrapper functions exports

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-06-21 18:36:17 +01:00
Keith Packard
3ef3ce069d Merge remote-tracking branch 'alanc/master' 2012-06-21 08:52:34 -07:00
Chase Douglas
704b847abf Add FormatUInt64{,Hex}() for formatting numbers in a signal safe manner
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-21 15:45:22 +10:00
Chase Douglas
bc85c81687 Save log file file descriptor for signal context logging
None of the FILE based functions are signal safe, including fileno(), so
we need to save the file descriptor for when we are in signal context.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-21 15:45:22 +10:00
Chase Douglas
d3725549f0 Add global variable inSignalContext
This will be used for checking for proper logging when in signal
context.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-21 15:45:22 +10:00