Commit Graph

56 Commits

Author SHA1 Message Date
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
Yaakov Selkowitz
d631dbe9b6 Xext: fix shadow warnings
Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-05 13:25:08 -06:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Adam Jackson
11977fab54 xace: ricer tuning for XaceHook
gcc doesn't want to hoist the check for XaceHooks[hook] != NULL above the
varargs code for some reason, so do it ourselves.

Before:
40000000 trep @   0.0010 msec (1050420.2/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (1921147.6/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06 13:29:53 -05:00
Chris Wilson
6dae7f3792 xace: Invalid reference to out-of-scope data.
The callback data passed by reference to the hook was allocated on stack
within the scope of the case statement. The compiler is free to reuse
any of that stack space whilst making the function call so we may end up
passing garbage into the callback.

References:

  Bug 18451 - Xorg server 1.5.2 SEGV during XFixesGetCursorImage()
  https://bugs.freedesktop.org/show_bug.cgi?id=18451

v2: Drop the unrelated hunk that snuck in when ammending the commit
message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-08-10 16:04:16 -07:00
Mikhail Gusarov
0a4d8cbdcd Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@

-if(E) { free(E); }
+free(E);

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-06 20:27:18 +07:00
Mikhail Gusarov
5a0fc0ad21 Replace deprecated bzero with memset
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Marcin BaczyƄski <marbacz@gmail.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-06 15:07:27 +07:00
Jamey Sharp
a0fe6987b5 Clean up after removal of screen parameters from region macros.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-06-05 22:07:21 -07:00
Keith Packard
2dc138922b Rename region macros to eliminate screen argument
This is a combination of a huge mechanical patch and a few small
fixups required to finish the job. They were reviewed separately, but
because the server does not build without both pieces, I've merged
them together at this time.

The mechanical changes were performed by running the included
'fix-region' script over the whole tree:

$ git ls-files | grep -v '^fix-' | xargs ./fix-region

And then, the white space errors in the resulting patch were fixed
using the provided fix-patch-whitespace script.

$ sh ./fix-patch-whitespace

Thanks to Jamey Sharp for the mighty fine sed-generating sed script.

The hand-done changes involve removing functions from dix/region.c
that duplicate inline functions in include/regionstr.h, along with
their declarations in regionstr.h, mi.h and mispans.h.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05 18:59:00 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Eamon Walsh
a470e8426e Correct outdated e-mail address in "Author" statements.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-09-02 17:56:52 -04:00
Michael Lorenz
36dc66ae79 The way XaceHook() mixes struct initializers and va_arg() is not portable and
gives bogus data on sparc and probably others leading to a crash.

Fix:
Don't use initializers, instead set each member directly to enforce order.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-07-07 20:21:39 -04:00
Adam Jackson
132b464d73 Remove a bunch of useless casts.
We've had void * for twenty years now people let's try to act like we
know how it works.
2009-01-22 02:11:16 -05:00
Julien Cristau
292311b421 Xext: ANSI cleanups 2009-01-11 08:54:10 +01:00
Eamon Walsh
f87e66486c xace: Export wrappers around two Xtrans functions used by modules.
Don't know a better way to do this, since Xtrans isn't a library that
can be linked into modules.
2008-12-18 13:58:35 -05:00
Eamon Walsh
777408914d Add xace headers to the SDK when enabled and export the XaceHooks symbol
to modules.
2008-12-18 12:39:08 -05:00
Paulo Cesar Pereira de Andrade
49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Paulo Cesar Pereira de Andrade
180bad8477 Add visibility flags to XSERVER_CFLAGS.
This is done to actually change DIX_CFLAGS, as not all "modules" use
XORG_CFLAGS.
  Also export the symbols that are required by other modules after
the change.
2008-12-02 02:50:45 -02:00
Eamon Walsh
cc76ea6e3a XACE: Add generic support for property and selection polyinstantiation. 2008-02-29 18:01:37 -05:00
Eamon Walsh
0d492b2166 XACE: Move the selection access hook to its own function. 2008-02-12 19:59:10 -05:00
Eamon Walsh
5c30327275 XACE: Push the dix "structure" includes down to the security modules. 2008-02-05 21:06:05 -05:00
Eamon Walsh
bb1a577a68 XACE: Move the property access hook to its own function. 2008-02-05 20:07:08 -05:00
Eamon Walsh
f6a78ee143 XACE: Remove the extension code entirely, XACE is completely static now. 2008-01-25 18:04:10 -05:00
Eamon Walsh
7724c30a75 XACE: Stop using fake requestVectors in favor of a simple hook call. 2008-01-25 17:28:17 -05:00
Eamon Walsh
f82329b081 XACE: Don't need to actually register a protocol extension. 2008-01-25 16:20:46 -05:00
Eamon Walsh
39cb782f28 XACE: DeleteCallbackList zeroes out its argument so don't do it twice. 2008-01-03 23:17:06 -05:00
Eamon Walsh
cd0603c2dc Bug #13765: Heap corruption in XC-SECURITY extension code. 2008-01-03 21:41:02 -05:00
Eamon Walsh
1603130236 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/xace.c
	Xext/xace.h
2007-11-14 13:35:50 -05:00
Eamon Walsh
d7c5e8bfc1 Modified performance patches from Arjan van de Ven <arjan@infradead.org>
Subject: [PATCH] fix some performance gaps in Xace

The XaceHook function is used in several hotpaths.
The problem with it (performance wise) is twofold:
 * The XaceHook function has a big switch() statement for the hook number in it
 * The XaceHook function uses varargs to reassemble the final dispatch arguments again

Both are expensive operations... for something that is known at compile time

This patch turns the hotpath XaceHook call into a direct call to avoid
the switch and varargs; this gives me over 10% performance gain
on the x11perf benchmark.
2007-11-06 16:26:09 -05:00
Eamon Walsh
a52c9b2a59 Merge branch 'master' into XACE-SELINUX
Conflicts:

	dix/dispatch.c
	dix/property.c
	hw/xfree86/common/xf86VidMode.c
	include/xkbsrv.h
	render/glyph.c
	xkb/xkbActions.c
2007-11-05 19:08:36 -05:00
Daniel Stone
934281126f Xext: Remove usage of alloca
Replace with heap allocations.
2007-11-05 14:34:46 +00:00
Eamon Walsh
825f09dffd xace: Still more changes to selection code. Removed the SelectionPtr from
the hook - the hook only needs the Atom to control access to the selection
object.  Upgraded the SelectionCallback to take a client argument and
additional type codes so that it can be used for redirection.
2007-10-23 17:12:57 -04:00
Eamon Walsh
db66e66dbf xace: Add an access_mode field to the extension structure.
This allows the same callback to be used for both extension hooks.
2007-10-17 13:51:11 -04:00
Eamon Walsh
50551ec693 xace: remove obsoleted DRAWABLE_ACCESS hook. 2007-09-28 15:04:33 -04:00
Eamon Walsh
0003ccfcdf xace: add new fields to resource access hook to allow parent resource objects
to be passed in at create time.  Also added a missing devPrivates initializer.
2007-09-05 11:18:36 -04:00
Eamon Walsh
cda92bbf12 xace: add hooks + new access codes: XFixes extension.
Required a new name argument to the selection access hook to handle
XFixesSelectSelectionInput.
2007-08-30 11:48:45 -04:00
Eamon Walsh
e39694789e xace: drop map-window checking hook, add new hooks for controlling the
delivery of events to windows and clients.

This is tentative.  It's likely that an additional last-resort hook will
be necessary for code that calls TryClientEvents or WriteEventsToClient
directly.  It's also possible that new xace machinery will be necessary
to classify events and pull useful resource ID's out of them.

The failure case also needs some thinking through.  Should event delivery
"succeed" or should it report undeliverable?

Finally, XKB appears to call WriteToClient to pass events.  Sigh.
2007-08-29 14:16:46 -04:00
Eamon Walsh
41355a53c2 xace: add hooks + new access codes: core protocol input requests 2007-08-28 15:10:20 -04:00
Eamon Walsh
5bee8db003 xace: drop background-none checking hook, add new hook for controlling
access to other clients.
2007-08-16 10:44:51 -04:00
Eamon Walsh
3c9553ac2c xace: rename hostlist security hook to "server" as this hook will be used
for other types of server access besides just the host list.
2007-08-15 14:14:25 -04:00
Eamon Walsh
102df4f9ba xace: drop site-policy and declare-extension-security hooks, add 2 new hooks
for controlling access to screens and screen savers.
2007-08-06 09:16:30 -04:00
Eamon Walsh
9cee4ec5e6 xace: change the semantics of the return value of XACE hooks to allow
arbitrary X status codes instead of just TRUE/FALSE.

The dix layer in most cases still does not propagate the return value of
XACE hooks back to the client, however.  There is more error propagation
work to do.
2007-04-17 16:01:56 -04:00
Eamon Walsh
0331c6a8fc Merge branch 'master' into XACE-SELINUX 2007-03-26 10:28:05 -04:00
Adam Jackson
04b87d6dfa Static and dead code cleaup for Xext/ 2007-03-25 17:57:22 -04:00
Eamon Walsh
e1cc68add0 xace: drop the name argument from the property callback. 2007-03-22 17:33:16 -04:00
Eamon Walsh
1b58304ac8 xace: add new argument to property hook for property structure itself. 2007-03-22 14:07:01 -04:00
Eamon Walsh
a3296d111d xace: add access_mode argument to selection hook. 2007-03-21 17:01:26 -04:00
Eamon Walsh
9c144f8ac5 xace: add XACE_SELECTION_ACCESS hook for selection redirection/access. 2007-03-21 14:39:00 -04:00
Eamon Walsh
2945deba1d xace: drop XACE_WINDOW_INIT hook, it has been superseded by ResourceStateCallback. 2007-03-19 17:09:10 -04:00
Eamon Walsh
ac90ce58ba Naming change: Security*Operation -> Xace*Operation 2006-12-01 21:15:41 -05:00