Re: [AD] More "mprotect" troubles (4.2.1 showstopper?) |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
On 2006-03-18, Peter Wang <tjaden@xxxxxxxxxx> wrote: > On 2006-03-13, Hans de Goede <j.w.r.degoede@xxxxxxxxxx> wrote: > > That is what the current code did, but appereantly mprotect on malloces > > mem is a no no, mprotect is (officially, POSIX) only supported on mmap > > returned mem. So either we must create a mmap once the current > > scratchmem using code is done and then memcopy the code, or (as I have > > done) replace scratchmem by an mmap based scratchmem implementation > > (I've only replaced it for the use in code generation). This will > > actually be faster then the old way, since mremap should be much faster > > then realloc. > > > @@ -439,7 +441,7 @@ > > #ifdef ALLEGRO_WINDOWS > > /* Play nice with Windows executable memory protection */ > > VirtualProtect(_scratch_mem, _scratch_mem_size, PAGE_EXECUTE_READWRITE, &old_protect); > > - #elif defined(HAVE_MPROTECT) > > + #elif defined(HAVE_MPROTECT) && !defined(USE_MMAP_GEN_CODE_BUF) > > { > > char *p = (char *)((unsigned long)_scratch_mem & ~(PAGE_SIZE-1ul)); > > if (mprotect(p, _scratch_mem_size + ((char *)_scratch_mem - p), > > @@ -448,22 +450,29 @@ > > Hi, this part of the code is missing from Allegro. I recognised it from > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185214 but are > there any more changes required? A patch would be appreciated if you > have one ready. Never mind, I found it :) I have attached an updated patch but not really tested it yet. The following comment does not make much sense. Could you rephrase it? /* mremap is only available under Linux, so is selinux which is the reason for * USE_MMAP_GEN_CODE_BUF so that is no problem. */ Peter
Attachment:
allegro-4.2.0-no-execheap2.patch.gz
Description: application/gunzip
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |