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
4 #ifdef SparcArchitecture
5 LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/SPARC)
7 +LinkSourceFile(mem.c, $(MESASRCDIR)/src)
10 # Maybe some of these could come from
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
35 0xe8, 0x00, 0x00, 0x00, 0x00,
36 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00
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;
42 memcpy(code, insn_template, sizeof(insn_template));
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;
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
56 +#include <sys/mman.h>
57 +#include "glheader.h"
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 */
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;
73 +static unsigned long RoundUpPowerOf2(unsigned long val);
76 + * Execute permission implementation notes:
77 + * John Dennis - jdennis@redhat.com - Red Hat Inc.
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.
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.
98 + * There are 3 possible implementation solutions.
100 + * Solution A: use mprotect on malloc block.
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
107 + * Pros: Simple to implement
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.
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
127 + * Solution B: use mmap to allocate block
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.
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.
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
143 + * The allocation can be freed without affecting anyother
144 + * allocation and it will be reused by the kernel.
146 + * Its simple to implement. As simple as solution A.
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.
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
159 + * Solution C: use separate malloc implementation using mmap'ed heap arena
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.
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
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.
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.
182 +#define EXEC_ALLOC_USE_MMAP
184 +#define EXEC_ALLOC_USE_MALLOC
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)
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));
198 + for (i = setBits = 0; val && i < sizeof(unsigned long) * 8; i++, val >>= 1) {
199 + if (val & 1UL) setBits++;
202 + return (1UL << i); /* input was not power of 2 */
204 + return (1UL << (i-1)); /* input was power of 2 */
208 + * Allocate N-byte aligned memory in executable region (uninitialized)
211 +#ifdef EXEC_ALLOC_USE_MALLOC
213 +_mesa_exec_malloc(size_t user_size, unsigned long user_align)
215 + unsigned long alloc_ptr, user_ptr, alloc_size, alloc_align;
216 + align_malloc_header *pHeader;
218 + ASSERT( user_align > 0 );
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
225 + if (user_align < sizeof(align_malloc_header))
226 + alloc_align = RoundUpPowerOf2(sizeof(align_malloc_header));
228 + alloc_align = user_align;
229 + alloc_size = user_size + alloc_align;
231 + alloc_ptr = (unsigned long) MALLOC(alloc_size);
233 + if (!alloc_ptr) return(NULL);
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;
243 + unsigned page_size, round;
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);
253 + unsigned char *p = (unsigned char *) alloc_ptr;
254 + unsigned char *stop = (unsigned char *) pHeader;
256 + /* mark the non-aligned area */
257 + for(; p < stop; p++) {
263 + return (void *)user_ptr;
267 + * Free N-byte executable aligned memory
270 +_mesa_exec_free(void *user_ptr)
272 + /* The header giving the real address and size is just prior to the address the client sees. */
273 + align_malloc_header *pHeader;
277 + pHeader = (align_malloc_header *)((char *)user_ptr - sizeof(align_malloc_header));
278 + alloc_ptr = pHeader->alloc_ptr;
279 + user_size = pHeader->user_size;
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.
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.
295 + * If we did remove the execute permission this is how it would be done.
298 + unsigned page_size, round;
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);
309 +#elif defined(EXEC_ALLOC_USE_MMAP)
312 +_mesa_exec_malloc(size_t user_size, unsigned long user_align)
314 + unsigned long alloc_ptr, user_ptr, alloc_size, alloc_align;
315 + align_malloc_header *pHeader;
317 + ASSERT( user_align > 0 );
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 */
323 + if (user_align < sizeof(align_malloc_header))
324 + alloc_align = RoundUpPowerOf2(sizeof(align_malloc_header));
326 + alloc_align = user_align;
327 + alloc_size = user_size + alloc_align;
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. */
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) {
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;
348 + unsigned char *p = (unsigned char *) alloc_ptr;
349 + unsigned char *stop = (unsigned char *) pHeader;
351 + /* mark the non-aligned area */
352 + for(; p < stop; p++) {
358 + return (void *)user_ptr;
362 + * Free N-byte executable aligned memory
365 +_mesa_exec_free(void *user_ptr)
367 + /* The header giving the real address and size is just prior to the address the client sees. */
368 + align_malloc_header *pHeader;
372 + pHeader = (align_malloc_header *)((char *)user_ptr - sizeof(align_malloc_header));
373 + alloc_ptr = pHeader->alloc_ptr;
374 + alloc_size = pHeader->alloc_size;
376 + munmap(alloc_ptr, alloc_size);
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
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)
391 #define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES)
392 #define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N)
394 _mesa_align_free( void *ptr );
397 +_mesa_exec_malloc(size_t bytes, unsigned long alignment);
399 +_mesa_exec_free(void *ptr);
402 _mesa_memcpy( void *dest, const void *src, size_t n );
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
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 );
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
421 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */
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);
430 0xff, 0x25, 0,0,0,0 /* jmp *NOTIFY */
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]);
439 0xff, 0x25, 0,0,0,0, /* jmp *NOTIFY */
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]);
448 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */
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);
457 0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */
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]);
466 0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */
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]);
475 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */
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);
485 insert_at_head( &tnl->dfn_cache.Normal3fv, dfn );
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);
494 insert_at_head( &tnl->dfn_cache.Normal3f, dfn );
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);
503 insert_at_head( &tnl->dfn_cache.Normal3fv, dfn );
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);
512 insert_at_head( &tnl->dfn_cache.Normal3f, dfn );
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);
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);
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);
538 insert_at_head( &tnl->dfn_cache.Color4ub, dfn );
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);
548 insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn );
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]);
557 insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn );
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]);
566 insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn );
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]);
575 insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn );
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]);
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 );
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
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); \
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 );
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
622 char *end = (char *)&FUNC##_end; \
623 insert_at_head( &CACHE, dfn ); \
625 - dfn->code = ALIGN_MALLOC( end - start, 16 ); \
626 + dfn->code = EXEC_MALLOC( end - start, 16 ); \
627 memcpy (dfn->code, start, end - start); \