summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch
diff options
context:
space:
mode:
authorGary Thomas <gary@mlbassoc.com>2012-05-18 17:18:18 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-18 15:25:12 +0100
commit6d40b658f42837f4270f1dd3c0f350eb84b369f0 (patch)
tree0a50b83ee07bcffd64497e4e8c71b0ac8e6852d4 /meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch
parent0312f864f7718b3ed006bfeaa3d1790b87cc6276 (diff)
downloadpoky-6d40b658f42837f4270f1dd3c0f350eb84b369f0.tar.gz
xserver-kdrive: Fix X server on PowerPC when built with GCC 4.7.x
Newer versions of GCC uncovered illegal code practice which can cause runtime failures in the Xext/xace.c code. This problem has been fixed upstream: http://cgit.freedesktop.org/xorg/xserver/patch/Xext/xace.c?id=6dae7f3792611aace1df0cca63bf50c50d93de43 Subject: xace: Invalid reference to out-of-scope data. Incorporate this patch into the recipe, with a PR bump. (From OE-Core rev: 7d1bb144404de650c6e83dfd095d16a796cbcf46) Signed-off-by: Gary Thomas <gary@mlbassoc.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch')
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch233
1 files changed, 233 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch b/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch
new file mode 100644
index 0000000000..b4e293facb
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.7.99.2/fix-bogus-stack-variables.patch
@@ -0,0 +1,233 @@
1From 6dae7f3792611aace1df0cca63bf50c50d93de43 Mon Sep 17 00:00:00 2001
2From: Chris Wilson <chris@chris-wilson.co.uk>
3Date: Tue, 10 Aug 2010 18:30:20 +0000
4Subject: xace: Invalid reference to out-of-scope data.
5
6The callback data passed by reference to the hook was allocated on stack
7within the scope of the case statement. The compiler is free to reuse
8any of that stack space whilst making the function call so we may end up
9passing garbage into the callback.
10
11References:
12
13 Bug 18451 - Xorg server 1.5.2 SEGV during XFixesGetCursorImage()
14 https://bugs.freedesktop.org/show_bug.cgi?id=18451
15
16v2: Drop the unrelated hunk that snuck in when ammending the commit
17message.
18
19Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
20Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
21Signed-off-by: Keith Packard <keithp@keithp.com>
22
23Upstream-Status: accepted
24---
25(limited to 'Xext/xace.c')
26
27diff --git a/Xext/xace.c b/Xext/xace.c
28index e10d837..c757cad 100644
29--- a/Xext/xace.c
30+++ b/Xext/xace.c
31@@ -87,7 +87,18 @@ void XaceHookAuditEnd(ClientPtr ptr, int result)
32 */
33 int XaceHook(int hook, ...)
34 {
35- pointer calldata; /* data passed to callback */
36+ union {
37+ XaceResourceAccessRec res;
38+ XaceDeviceAccessRec dev;
39+ XaceSendAccessRec send;
40+ XaceReceiveAccessRec recv;
41+ XaceClientAccessRec client;
42+ XaceExtAccessRec ext;
43+ XaceServerAccessRec server;
44+ XaceScreenAccessRec screen;
45+ XaceAuthAvailRec auth;
46+ XaceKeyAvailRec key;
47+ } u;
48 int *prv = NULL; /* points to return value from callback */
49 va_list ap; /* argument list */
50 va_start(ap, hook);
51@@ -99,117 +110,86 @@ int XaceHook(int hook, ...)
52 */
53 switch (hook)
54 {
55- case XACE_RESOURCE_ACCESS: {
56- XaceResourceAccessRec rec;
57- rec.client = va_arg(ap, ClientPtr);
58- rec.id = va_arg(ap, XID);
59- rec.rtype = va_arg(ap, RESTYPE);
60- rec.res = va_arg(ap, pointer);
61- rec.ptype = va_arg(ap, RESTYPE);
62- rec.parent = va_arg(ap, pointer);
63- rec.access_mode = va_arg(ap, Mask);
64- rec.status = Success; /* default allow */
65- calldata = &rec;
66- prv = &rec.status;
67+ case XACE_RESOURCE_ACCESS:
68+ u.res.client = va_arg(ap, ClientPtr);
69+ u.res.id = va_arg(ap, XID);
70+ u.res.rtype = va_arg(ap, RESTYPE);
71+ u.res.res = va_arg(ap, pointer);
72+ u.res.ptype = va_arg(ap, RESTYPE);
73+ u.res.parent = va_arg(ap, pointer);
74+ u.res.access_mode = va_arg(ap, Mask);
75+ u.res.status = Success; /* default allow */
76+ prv = &u.res.status;
77 break;
78- }
79- case XACE_DEVICE_ACCESS: {
80- XaceDeviceAccessRec rec;
81- rec.client = va_arg(ap, ClientPtr);
82- rec.dev = va_arg(ap, DeviceIntPtr);
83- rec.access_mode = va_arg(ap, Mask);
84- rec.status = Success; /* default allow */
85- calldata = &rec;
86- prv = &rec.status;
87+ case XACE_DEVICE_ACCESS:
88+ u.dev.client = va_arg(ap, ClientPtr);
89+ u.dev.dev = va_arg(ap, DeviceIntPtr);
90+ u.dev.access_mode = va_arg(ap, Mask);
91+ u.dev.status = Success; /* default allow */
92+ prv = &u.dev.status;
93 break;
94- }
95- case XACE_SEND_ACCESS: {
96- XaceSendAccessRec rec;
97- rec.client = va_arg(ap, ClientPtr);
98- rec.dev = va_arg(ap, DeviceIntPtr);
99- rec.pWin = va_arg(ap, WindowPtr);
100- rec.events = va_arg(ap, xEventPtr);
101- rec.count = va_arg(ap, int);
102- rec.status = Success; /* default allow */
103- calldata = &rec;
104- prv = &rec.status;
105+ case XACE_SEND_ACCESS:
106+ u.send.client = va_arg(ap, ClientPtr);
107+ u.send.dev = va_arg(ap, DeviceIntPtr);
108+ u.send.pWin = va_arg(ap, WindowPtr);
109+ u.send.events = va_arg(ap, xEventPtr);
110+ u.send.count = va_arg(ap, int);
111+ u.send.status = Success; /* default allow */
112+ prv = &u.send.status;
113 break;
114- }
115- case XACE_RECEIVE_ACCESS: {
116- XaceReceiveAccessRec rec;
117- rec.client = va_arg(ap, ClientPtr);
118- rec.pWin = va_arg(ap, WindowPtr);
119- rec.events = va_arg(ap, xEventPtr);
120- rec.count = va_arg(ap, int);
121- rec.status = Success; /* default allow */
122- calldata = &rec;
123- prv = &rec.status;
124+ case XACE_RECEIVE_ACCESS:
125+ u.recv.client = va_arg(ap, ClientPtr);
126+ u.recv.pWin = va_arg(ap, WindowPtr);
127+ u.recv.events = va_arg(ap, xEventPtr);
128+ u.recv.count = va_arg(ap, int);
129+ u.recv.status = Success; /* default allow */
130+ prv = &u.recv.status;
131 break;
132- }
133- case XACE_CLIENT_ACCESS: {
134- XaceClientAccessRec rec;
135- rec.client = va_arg(ap, ClientPtr);
136- rec.target = va_arg(ap, ClientPtr);
137- rec.access_mode = va_arg(ap, Mask);
138- rec.status = Success; /* default allow */
139- calldata = &rec;
140- prv = &rec.status;
141+ case XACE_CLIENT_ACCESS:
142+ u.client.client = va_arg(ap, ClientPtr);
143+ u.client.target = va_arg(ap, ClientPtr);
144+ u.client.access_mode = va_arg(ap, Mask);
145+ u.client.status = Success; /* default allow */
146+ prv = &u.client.status;
147 break;
148- }
149- case XACE_EXT_ACCESS: {
150- XaceExtAccessRec rec;
151- rec.client = va_arg(ap, ClientPtr);
152- rec.ext = va_arg(ap, ExtensionEntry*);
153- rec.access_mode = DixGetAttrAccess;
154- rec.status = Success; /* default allow */
155- calldata = &rec;
156- prv = &rec.status;
157+ case XACE_EXT_ACCESS:
158+ u.ext.client = va_arg(ap, ClientPtr);
159+ u.ext.ext = va_arg(ap, ExtensionEntry*);
160+ u.ext.access_mode = DixGetAttrAccess;
161+ u.ext.status = Success; /* default allow */
162+ prv = &u.ext.status;
163 break;
164- }
165- case XACE_SERVER_ACCESS: {
166- XaceServerAccessRec rec;
167- rec.client = va_arg(ap, ClientPtr);
168- rec.access_mode = va_arg(ap, Mask);
169- rec.status = Success; /* default allow */
170- calldata = &rec;
171- prv = &rec.status;
172+ case XACE_SERVER_ACCESS:
173+ u.server.client = va_arg(ap, ClientPtr);
174+ u.server.access_mode = va_arg(ap, Mask);
175+ u.server.status = Success; /* default allow */
176+ prv = &u.server.status;
177 break;
178- }
179 case XACE_SCREEN_ACCESS:
180- case XACE_SCREENSAVER_ACCESS: {
181- XaceScreenAccessRec rec;
182- rec.client = va_arg(ap, ClientPtr);
183- rec.screen = va_arg(ap, ScreenPtr);
184- rec.access_mode = va_arg(ap, Mask);
185- rec.status = Success; /* default allow */
186- calldata = &rec;
187- prv = &rec.status;
188+ case XACE_SCREENSAVER_ACCESS:
189+ u.screen.client = va_arg(ap, ClientPtr);
190+ u.screen.screen = va_arg(ap, ScreenPtr);
191+ u.screen.access_mode = va_arg(ap, Mask);
192+ u.screen.status = Success; /* default allow */
193+ prv = &u.screen.status;
194 break;
195- }
196- case XACE_AUTH_AVAIL: {
197- XaceAuthAvailRec rec;
198- rec.client = va_arg(ap, ClientPtr);
199- rec.authId = va_arg(ap, XID);
200- calldata = &rec;
201+ case XACE_AUTH_AVAIL:
202+ u.auth.client = va_arg(ap, ClientPtr);
203+ u.auth.authId = va_arg(ap, XID);
204 break;
205- }
206- case XACE_KEY_AVAIL: {
207- XaceKeyAvailRec rec;
208- rec.event = va_arg(ap, xEventPtr);
209- rec.keybd = va_arg(ap, DeviceIntPtr);
210- rec.count = va_arg(ap, int);
211- calldata = &rec;
212+ case XACE_KEY_AVAIL:
213+ u.key.event = va_arg(ap, xEventPtr);
214+ u.key.keybd = va_arg(ap, DeviceIntPtr);
215+ u.key.count = va_arg(ap, int);
216 break;
217- }
218- default: {
219+ default:
220 va_end(ap);
221 return 0; /* unimplemented hook number */
222- }
223 }
224 va_end(ap);
225
226 /* call callbacks and return result, if any. */
227- CallCallbacks(&XaceHooks[hook], calldata);
228+ CallCallbacks(&XaceHooks[hook], &u);
229 return prv ? *prv : Success;
230 }
231
232--
233cgit v0.9.0.2-2-gbebe