]> git.pld-linux.org Git - packages/XFree86.git/blob - XFree86-libGL-exec-shield-fixes-v2.patch
- and again
[packages/XFree86.git] / XFree86-libGL-exec-shield-fixes-v2.patch
1 --- xc/lib/GL/glx/Imakefile.redhat-libGL-exec-shield-fixes      2003-09-25 14:43:55.000000000 -0400
2 +++ xc/lib/GL/glx/Imakefile     2003-09-25 14:43:55.000000000 -0400
3 @@ -43,6 +43,7 @@
4  #ifdef SparcArchitecture
5  LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/SPARC)
6  #endif
7 +LinkSourceFile(mem.c, $(MESASRCDIR)/src)
8  
9  
10  # Maybe some of these could come from
11 @@ -70,7 +72,8 @@
12                 single2.c \
13                 singlepix.c \
14                 vertarr.c \
15 -               xfont.c
16 +               xfont.c \
17 +               mem.c
18  
19       GLX_OBJS = \
20                 clientattrib.o \
21 @@ -94,7 +97,8 @@
22                 single2.o \
23                 singlepix.o \
24                 vertarr.o \
25 -               xfont.o
26 +               xfont.o \
27 +               mem.o
28  
29       GLX_DEFS = GlxDefines
30  
31 diff -urN xc.org/extras/Mesa/src/glapi.c xc/extras/Mesa/src/glapi.c
32 --- xc.org/extras/Mesa/src/glapi.c      2004-06-07 22:45:05.571381120 +0200
33 +++ xc/extras/Mesa/src/glapi.c  2004-06-07 23:11:34.201872576 +0200
34 @@ -546,7 +547,7 @@
35        0xe8, 0x00, 0x00, 0x00, 0x00,
36        0xff, 0xa0, 0x00, 0x00, 0x00, 0x00
37     };
38 -   unsigned char *code = (unsigned char *) malloc(sizeof(insn_template));
39 +   unsigned char *code = EXEC_MALLOC(sizeof(insn_template), 16);
40     unsigned int next_insn;
41     if (code) {
42        memcpy(code, insn_template, sizeof(insn_template));
43 @@ -587,7 +588,7 @@
44            0x01000000   /*  nop                                           */
45     };
46  #endif
47 -   unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
48 +   unsigned int *code = EXEC_MALLOC(sizeof(insn_template), 16);
49     unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
50     if (code) {
51        memcpy(code, insn_template, sizeof(insn_template));
52 --- xc/extras/Mesa/src/mem.c.org        1970-01-01 01:00:00.000000000 +0100
53 +++ xc/extras/Mesa/src/mem.c    2004-06-09 02:02:29.152086688 +0200
54 @@ -0,0 +1,325 @@
55 +#include <unistd.h>
56 +#include <sys/mman.h>
57 +#include "glheader.h"
58 +#include "config.h"
59 +#include "macros.h"
60 +
61 +/* Define a struct for our private data. This is preferred over pointer
62 + * arithmetic to access individual pieces of our private data because the
63 + * compiler will help us get alignment correct in a portable way and it
64 + * makes it much easier to add or remove items from our private data */
65 +
66 +typedef struct align_malloc_header {
67 +  void  *alloc_ptr;           /* actual allocation ptr */
68 +  size_t alloc_size;          /* actual allocation size */
69 +  void  *user_ptr;            /* ptr returned to caller */
70 +  size_t user_size;           /* size caller requested */
71 +} align_malloc_header;
72 +
73 +static unsigned long RoundUpPowerOf2(unsigned long val);
74 +
75 +/*
76 + * Execute permission implementation notes:
77 + * John Dennis - jdennis@redhat.com - Red Hat Inc.
78 + *
79 + * Overview:
80 + *
81 + * Various parts of Mesa generate machine code during run time and
82 + * then executes that code. We will use the term code gen to refer to
83 + * this process. Some operating systems in an attempt to achieve
84 + * better security enforce restrictions on which memory areas may
85 + * contain executable code. In general execute permission is granted
86 + * to .text sections and removed on stack or heap memory. It's the
87 + * heap (and possibly the stack) where code is run time
88 + * generated. This means on systems that enforce execute memory
89 + * security you will get either a SEGV or SIGBUS exception when run
90 + * time generated code executes and the process will be terminated.
91 + *
92 + * Implementation:
93 + *
94 + * The solution is to provide unique malloc/free functions which
95 + * return memory with execute permission and to make sure these
96 + * allocation functions are called for code gen.
97 + *
98 + * There are 3 possible implementation solutions.
99 + *
100 + * Solution A: use mprotect on malloc block.
101 + * 
102 + *   In this scenario after a block is allocated via malloc we call
103 + *   mprotect on the pages containing the block and add execute
104 + *   permission. In theory a free of the block removes the execute
105 + *   permission. 
106 + *
107 + *   Pros: Simple to implement
108 + *
109 + *   Cons: Because execute permission is granted memory pages when
110 + *         mprotect is called on the page containing the malloc block
111 + *         every other malloc block in that page also receives execute
112 + *         permission, this is insecure.
113 + * 
114 + *         When a malloc block is freed that had been allocated for
115 + *         execute permission we should remove the execute permission
116 + *         from that block so that when the heap manager resuses that
117 + *         memory it will not be executable. But Because exectue
118 + *         permission is granted to memory pages and a page may have
119 + *         more than one malloc block with execute permission we
120 + *         cannot remove execute permission because that would remove
121 + *         execute permission on any executable malloc blocks still in
122 + *         that page. By not removing the execution permission on free
123 + *         we will tend to "leak" executable memory as more and more
124 + *         heap pages accumulate execute permission, possible without
125 + *         needing it.
126 + *
127 + * Solution B: use mmap to allocate block
128 + *
129 + *   In this scenario every call to alloc an executable block is
130 + *   performed with anonymous mmap. Mmap always allocates pages of
131 + *   memory. When free is called we unmap the pages.
132 + *
133 + *   Pros: This is much more secure. The kernel places the allocation
134 + *         in special pages that have additional protection. These
135 + *         pages are not near any other pages.
136 + *
137 + *         The pages used do not contain any heap allocation that is
138 + *         not susposed to be executable, therefore we are not
139 + *         inadvertantly granting execute permission to a malloc block
140 + *         that happens to live in the same page as a execute malloc
141 + *         block.
142 + *
143 + *         The allocation can be freed without affecting anyother
144 + *         allocation and it will be reused by the kernel.
145 + *
146 + *         Its simple to implement. As simple as solution A.
147 + *
148 + *   Cons: Mmap only allocates in units of pages. Thus even a small
149 + *         allocation will use an entire page. However note, only a
150 + *         small number exec malloc's are done so the wasted memory
151 + *         is not likely to be an issue.
152 + *
153 + *         Because every code generated function will live alone in
154 + *         its own page this will probably introduce more cache misses
155 + *         and page faults than if the all the code coalesced together
156 + *         into one or more pages as would be the case with regular
157 + *         .text sections.
158 + *         
159 + * Solution C: use separate malloc implementation using mmap'ed heap arena
160 + * 
161 + *   In this scenario a new heap manager is introduced which manages a
162 + *   heap arena usning anonymous mmap with execute permission. All
163 + *   executable allocations are provided using only this heap arena.
164 + *
165 + *   Pros: This is the ideal solution. As in Solution B executable and
166 + *         non-executable allocations are never mixed. Executable
167 + *         allocations are provided using the most secure pages the
168 + *         kernel manages.
169 + *
170 + *         Pages will likely contain multiple allocations as opposed
171 + *         to Solution B where pages will be sparsely used. This
172 + *         improves cache and page fault behavior.
173 + *
174 + *   Cons: This is the most involved implementation and requires the
175 + *         introduction of a heap manger implementation that has been
176 + *         modified to work with anonymous mmap. However, note that
177 + *         the GNU malloc implementation has been modified to work
178 + *         with anonymous mmap.
179 + */
180 +
181 +#if 1
182 +#define EXEC_ALLOC_USE_MMAP
183 +#else
184 +#define EXEC_ALLOC_USE_MALLOC
185 +#endif
186 +
187 +/* If input is power of 2 return that, else round up to next power of 2 */
188 +static unsigned long RoundUpPowerOf2(unsigned long val)
189 +{
190 +  int i, setBits;
191 +
192 +  if (val == 0) return(1UL);
193 +  if (val > (1UL << (sizeof(unsigned long) * 8 - 1))) {
194 +    /* out of range, should be fatal error?, for now return max power of 2 */
195 +    return (1UL << (sizeof(unsigned long) * 8 - 1));
196 +  }
197 +
198 +  for (i = setBits = 0; val && i < sizeof(unsigned long) * 8; i++, val >>= 1) {
199 +    if (val & 1UL) setBits++;
200 +  }
201 +  if (setBits > 1) 
202 +    return (1UL << i);         /* input was not power of 2 */
203 +  else
204 +    return (1UL << (i-1));     /* input was power of 2 */
205 +}
206 +
207 +/*
208 + * Allocate N-byte aligned memory in executable region (uninitialized)
209 + */
210 +
211 +#ifdef EXEC_ALLOC_USE_MALLOC
212 +void *
213 +_mesa_exec_malloc(size_t user_size, unsigned long user_align)
214 +{
215 +   unsigned long alloc_ptr, user_ptr, alloc_size, alloc_align;
216 +   align_malloc_header *pHeader;
217 +
218 +   ASSERT( user_align > 0 );
219 +
220 +   /* We store the pointer to the acutal address and size in a private
221 +    * header before the address the client sees. We need the actual 
222 +    * pointer to free with and we need the size to remove execute permission
223 +    * on the block */
224 +
225 +   if (user_align < sizeof(align_malloc_header))
226 +     alloc_align = RoundUpPowerOf2(sizeof(align_malloc_header));
227 +   else
228 +     alloc_align = user_align;
229 +   alloc_size = user_size + alloc_align;
230 +
231 +   alloc_ptr = (unsigned long) MALLOC(alloc_size);
232 +
233 +   if (!alloc_ptr) return(NULL);
234 +
235 +   user_ptr            = (alloc_ptr + alloc_align) & ~(unsigned long)(alloc_align - 1);
236 +   pHeader             = (align_malloc_header *) (user_ptr - sizeof(align_malloc_header));
237 +   pHeader->alloc_ptr  = (void *) alloc_ptr;
238 +   pHeader->alloc_size = alloc_size;
239 +   pHeader->user_ptr   = (void *) user_ptr;
240 +   pHeader->user_size  = user_size;
241 +
242 +   {
243 +     unsigned page_size, round;
244 +
245 +     page_size = getpagesize();
246 +     round = user_ptr & (page_size-1);
247 +     mprotect((void *)(user_ptr - round), (user_size + round + page_size-1) & ~(page_size-1),
248 +             PROT_READ | PROT_WRITE | PROT_EXEC);
249 +   }
250 +
251 +#ifdef DEBUG
252 +   {
253 +     unsigned char *p    = (unsigned char *) alloc_ptr;
254 +     unsigned char *stop = (unsigned char *) pHeader;
255 +
256 +     /* mark the non-aligned area */
257 +     for(; p < stop; p++) {
258 +       *p = 0xcd;
259 +     }
260 +   }
261 +#endif
262 +
263 +   return (void *)user_ptr;
264 +}
265 +
266 +/*
267 + * Free N-byte executable aligned memory
268 + */
269 +void
270 +_mesa_exec_free(void *user_ptr)
271 +{
272 +   /* The header giving the real address and size is just prior to the address the client sees. */
273 +   align_malloc_header *pHeader;
274 +   void *alloc_ptr;
275 +   size_t user_size;
276 +
277 +   pHeader = (align_malloc_header *)((char *)user_ptr - sizeof(align_malloc_header));
278 +   alloc_ptr = pHeader->alloc_ptr;
279 +   user_size = pHeader->user_size;
280 +
281 +#if 0
282 +   /*
283 +    * Unfortunately we cannot remove the execute permission on this
284 +    * malloc block because execute permission is granted on a page
285 +    * basis. If the page containing this malloc block also contained
286 +    * another malloc block with execute permission that was still in
287 +    * effect then we will remove execute permission on a malloc block
288 +    * that should still be enforce. This does mean we will tend to
289 +    * "leak" execute permission in the heap. See above block comment
290 +    * on implementation issues.
291 +    *
292 +    * Note, we could keep a ref count on each page and when the ref count
293 +    * fell to zero we could remove the execute permission.
294 +    *
295 +    * If we did remove the execute permission this is how it would be done.
296 +    */
297 +   {
298 +     unsigned page_size, round;
299 +
300 +     page_size = getpagesize();
301 +     round = (unsigned long)user_ptr & (page_size-1);
302 +     mprotect((char *)user_ptr - round, (user_size + round + page_size-1) & ~(page_size-1),
303 +             PROT_READ | PROT_WRITE);
304 +   }
305 +#endif
306 +   FREE(alloc_ptr);
307 +}
308 +
309 +#elif defined(EXEC_ALLOC_USE_MMAP)
310 +
311 +void *
312 +_mesa_exec_malloc(size_t user_size, unsigned long user_align)
313 +{
314 +   unsigned long alloc_ptr, user_ptr, alloc_size, alloc_align;
315 +   align_malloc_header *pHeader;
316 +
317 +   ASSERT( user_align > 0 );
318 +
319 +   /* We store the pointer to the acutal address and size in a private
320 +    * header before the address the client sees. We need the actual 
321 +    * pointer to free with and we need the size to unmap the region */
322 +
323 +   if (user_align < sizeof(align_malloc_header))
324 +     alloc_align = RoundUpPowerOf2(sizeof(align_malloc_header));
325 +   else
326 +     alloc_align = user_align;
327 +   alloc_size = user_size + alloc_align;
328 +
329 +   /* Note, I'm not sure how portable MAP_ANONYMOUS with fd=0 is, on some POSIX
330 +    * systems you may need to remove the MAP_ANONYMOUS flag and pass the 
331 +    * result of posix_typed_mem_open with POSIX_TYPED_MEM_ALLOCATE as the fd. */
332 +
333 +   alloc_ptr = (unsigned long) mmap(0, alloc_size,
334 +                                   PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
335 +   if ((void *)alloc_ptr == MAP_FAILED) {
336 +     return(NULL);
337 +   }
338 +
339 +   user_ptr            = (alloc_ptr + alloc_align) & ~(unsigned long)(alloc_align - 1);
340 +   pHeader             = (align_malloc_header *) (user_ptr - sizeof(align_malloc_header));
341 +   pHeader->alloc_ptr  = (void *) alloc_ptr;
342 +   pHeader->alloc_size = alloc_size;
343 +   pHeader->user_ptr   = (void *) user_ptr;
344 +   pHeader->user_size  = user_size;
345 +
346 +#ifdef DEBUG
347 +   {
348 +     unsigned char *p    = (unsigned char *) alloc_ptr;
349 +     unsigned char *stop = (unsigned char *) pHeader;
350 +
351 +     /* mark the non-aligned area */
352 +     for(; p < stop; p++) {
353 +       *p = 0xcd;
354 +     }
355 +   }
356 +#endif
357 +
358 +   return (void *)user_ptr;
359 +}
360 +
361 +/*
362 + * Free N-byte executable aligned memory
363 + */
364 +void
365 +_mesa_exec_free(void *user_ptr)
366 +{
367 +   /* The header giving the real address and size is just prior to the address the client sees. */
368 +   align_malloc_header *pHeader;
369 +   void *alloc_ptr;
370 +   size_t alloc_size;
371 +
372 +   pHeader    = (align_malloc_header *)((char *)user_ptr - sizeof(align_malloc_header));
373 +   alloc_ptr  = pHeader->alloc_ptr;
374 +   alloc_size = pHeader->alloc_size;
375 +
376 +   munmap(alloc_ptr, alloc_size);
377 +}
378 +#endif
379 +
380 diff -urN xc.org/extras/Mesa/src/imports.h xc/extras/Mesa/src/imports.h
381 --- xc.org/extras/Mesa/src/imports.h    2004-06-07 22:45:05.944324424 +0200
382 +++ xc/extras/Mesa/src/imports.h        2004-06-07 23:04:42.561451432 +0200
383 @@ -50,6 +50,9 @@
384  #define ALIGN_MALLOC_STRUCT(T, N)  (struct T *) _mesa_align_malloc(sizeof(struct T), N)
385  #define ALIGN_CALLOC_STRUCT(T, N)  (struct T *) _mesa_align_calloc(sizeof(struct T), N)
386  #define ALIGN_FREE(PTR)            _mesa_align_free(PTR)
387 +/* These allocate aligned memory in a area with execute permission, used for code generation. */
388 +#define EXEC_MALLOC(BYTES, N)     (void *) _mesa_exec_malloc(BYTES, N)
389 +#define EXEC_FREE(PTR)            _mesa_exec_free(PTR)
390  
391  #define MEMCPY( DST, SRC, BYTES)   _mesa_memcpy(DST, SRC, BYTES)
392  #define MEMSET( DST, VAL, N )      _mesa_memset(DST, VAL, N)
393 @@ -120,6 +123,11 @@
394  _mesa_align_free( void *ptr );
395  
396  extern void *
397 +_mesa_exec_malloc(size_t bytes, unsigned long alignment);
398 +extern void 
399 +_mesa_exec_free(void *ptr);
400 +
401 +extern void *
402  _mesa_memcpy( void *dest, const void *src, size_t n );
403  
404  extern void
405 diff -urN xc.org/extras/Mesa/src/tnl/t_vtx_exec.c xc/extras/Mesa/src/tnl/t_vtx_exec.c
406 --- xc.org/extras/Mesa/src/tnl/t_vtx_exec.c     2004-06-07 22:45:06.597225168 +0200
407 +++ xc/extras/Mesa/src/tnl/t_vtx_exec.c 2004-06-07 23:17:12.494444288 +0200
408 @@ -593,7 +593,7 @@
409     struct dynfn *f, *tmp;
410     foreach_s (f, tmp, l) {
411        remove_from_list( f );
412 -      ALIGN_FREE( f->code );
413 +      EXEC_FREE( f->code );
414        FREE( f );
415     }
416  }
417 diff -urN xc.org/extras/Mesa/src/tnl/t_vtx_x86.c xc/extras/Mesa/src/tnl/t_vtx_x86.c
418 --- xc.org/extras/Mesa/src/tnl/t_vtx_x86.c      2004-06-07 22:45:06.608223496 +0200
419 +++ xc/extras/Mesa/src/tnl/t_vtx_x86.c  2004-06-07 23:16:32.268559552 +0200
420 @@ -75,7 +75,7 @@
421          0xff, 0x25, 0, 0, 0, 0         /* jmp    NOTIFY */
422        };
423  
424 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
425 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
426        memcpy (dfn->code, temp, sizeof(temp));
427        FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[2]);
428        FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr);
429 @@ -126,7 +126,7 @@
430          0xff, 0x25, 0,0,0,0            /* jmp    *NOTIFY */
431        };
432  
433 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
434 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
435        memcpy (dfn->code, temp, sizeof(temp));
436        FIXUP(dfn->code, 2, 0x0, (int)&tnl->dmaptr);
437        FIXUP(dfn->code, 25, 0x0, (int)&tnl->vertex[3]);
438 @@ -163,7 +163,7 @@
439          0xff, 0x25, 0,0,0,0,           /* jmp    *NOTIFY */
440        };
441  
442 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
443 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
444        memcpy (dfn->code, temp, sizeof(temp));
445        FIXUP(dfn->code, 3, 0x0, (int)&tnl->dmaptr);
446        FIXUP(dfn->code, 28, 0x0, (int)&tnl->vertex[3]);
447 @@ -205,7 +205,7 @@
448          0xff, 0x25, 0, 0, 0, 0         /* jmp    NOTIFY */
449        };
450  
451 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
452 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
453        memcpy (dfn->code, temp, sizeof(temp));
454        FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[3]);
455        FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr);
456 @@ -259,7 +259,7 @@
457          0xff, 0x25, 0x08, 0, 0, 0,     /* jmp    *0x8 */
458        };
459  
460 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
461 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
462        memcpy (dfn->code, temp, sizeof(temp));
463        FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr);
464        FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]);
465 @@ -303,7 +303,7 @@
466          0xff, 0x25, 0x08, 0, 0, 0,     /* jmp    *0x8 */
467        };
468  
469 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
470 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
471        memcpy (dfn->code, temp, sizeof(temp));
472        FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr);
473        FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]);
474 @@ -351,7 +351,7 @@
475          0xff, 0x25, 0, 0, 0, 0         /* jmp    NOTIFY */
476        };
477  
478 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
479 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
480        memcpy (dfn->code, temp, sizeof(temp));
481        FIXUP(dfn->code, 8, 0x01010101, (int)&tnl->dmaptr);
482        FIXUP(dfn->code, 32, 0x00000006, tnl->vertex_size-3);
483 @@ -393,7 +393,7 @@
484  
485     insert_at_head( &tnl->dfn_cache.Normal3fv, dfn );
486     dfn->key = key;
487 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
488 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
489     memcpy (dfn->code, temp, sizeof(temp));
490     FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); 
491     return dfn;
492 @@ -421,7 +421,7 @@
493  
494     insert_at_head( &tnl->dfn_cache.Normal3f, dfn );
495     dfn->key = key;
496 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
497 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
498     memcpy (dfn->code, temp, sizeof(temp));
499     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); 
500     return dfn;
501 @@ -449,7 +449,7 @@
502  
503     insert_at_head( &tnl->dfn_cache.Normal3fv, dfn );
504     dfn->key = key;
505 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
506 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
507     memcpy (dfn->code, temp, sizeof(temp));
508     FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); 
509     return dfn;
510 @@ -475,7 +475,7 @@
511  
512     insert_at_head( &tnl->dfn_cache.Normal3f, dfn );
513     dfn->key = key;
514 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
515 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
516     memcpy (dfn->code, temp, sizeof(temp));
517     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); 
518     return dfn;
519 @@ -499,7 +499,7 @@
520          0xc3,                          /*  ret     */
521        };
522  
523 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
524 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
525        memcpy (dfn->code, temp, sizeof(temp));
526        FIXUP(dfn->code, 5, 0x12345678, (int)tnl->ubytecolorptr); 
527        return dfn;
528 @@ -531,7 +531,7 @@
529          0xc3,                                  /* ret     */
530        };
531  
532 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
533 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
534        memcpy (dfn->code, temp, sizeof(temp));
535        FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); 
536        FIXUP(dfn->code, 27, 0xdeadbeaf, (int)tnl->floatcolorptr); 
537 @@ -567,7 +567,7 @@
538        insert_at_head( &tnl->dfn_cache.Color4ub, dfn );
539        dfn->key = key;
540  
541 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
542 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
543        memcpy (dfn->code, temp, sizeof(temp));
544        FIXUP(dfn->code, 18, 0x0, (int)tnl->ubytecolorptr); 
545        FIXUP(dfn->code, 24, 0x0, (int)tnl->ubytecolorptr+1); 
546 @@ -600,7 +600,7 @@
547  
548     insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn );
549     dfn->key = key;
550 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
551 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
552     memcpy (dfn->code, temp, sizeof(temp));
553     FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); 
554     return dfn;
555 @@ -624,7 +624,7 @@
556  
557     insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn );
558     dfn->key = key;
559 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
560 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
561     memcpy (dfn->code, temp, sizeof(temp));
562     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); 
563     return dfn;
564 @@ -648,7 +648,7 @@
565  
566     insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn );
567     dfn->key = key;
568 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
569 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
570     memcpy (dfn->code, temp, sizeof(temp));
571     FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); 
572     return dfn;
573 @@ -670,7 +670,7 @@
574  
575     insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn );
576     dfn->key = key;
577 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
578 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
579     memcpy (dfn->code, temp, sizeof(temp));
580     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); 
581     return dfn;
582 diff -urN xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
583 --- xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c       2004-06-07 22:44:55.376930912 +0200
584 +++ xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c   2004-06-07 22:48:38.196057256 +0200
585 @@ -1074,7 +1074,7 @@
586     struct dynfn *f, *tmp;
587     foreach_s (f, tmp, l) {
588        remove_from_list( f );
589 -      ALIGN_FREE( f->code );
590 +      EXEC_FREE( f->code );
591        FREE( f );
592     }
593  }
594 diff -urN xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
595 --- xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h       2004-06-07 22:44:55.377930760 +0200
596 +++ xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h   2004-06-07 22:48:38.192057864 +0200
597 @@ -60,7 +60,7 @@
598     insert_at_head( &CACHE, dfn );                      \
599     dfn->key[0] = key[0];                                       \
600     dfn->key[1] = key[1];                                       \
601 -   dfn->code = ALIGN_MALLOC( end - start, 16 );                \
602 +   dfn->code = EXEC_MALLOC( end - start, 16 );         \
603     memcpy (dfn->code, start, end - start);             \
604  }                                                      \
605  while ( 0 )
606 diff -urN xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
607 --- xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c   2004-06-07 22:44:55.473916168 +0200
608 +++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c       2004-06-07 22:48:38.218053912 +0200
609 @@ -1042,7 +1042,7 @@
610     struct dynfn *f, *tmp;
611     foreach_s (f, tmp, l) {
612        remove_from_list( f );
613 -      ALIGN_FREE( f->code );
614 +      EXEC_FREE( f->code );
615        FREE( f );
616     }
617  }
618 diff -urN xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h
619 --- xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h   2004-06-07 22:44:55.473916168 +0200
620 +++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h       2004-06-07 22:48:38.214054520 +0200
621 @@ -58,7 +58,7 @@
622     char *end = (char *)&FUNC##_end;                    \
623     insert_at_head( &CACHE, dfn );                      \
624     dfn->key = key;                                     \
625 -   dfn->code = ALIGN_MALLOC( end - start, 16 );                \
626 +   dfn->code = EXEC_MALLOC( end - start, 16 );         \
627     memcpy (dfn->code, start, end - start);             \
628  }                                                      \
629  while ( 0 )
630
This page took 0.077045 seconds and 4 git commands to generate.