Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <la_putin> is musl's malloc() compatible with mprotect
- <la_putin> as mprotect is giving me invalid argument when i try to use it with a implimentation of malloc() http://rextester.com/JTJGO67005
- <feepbot> mprotect, C (gcc) - rextester
- <la_putin> so if i used musl's malloc instead would i still get invalid argument?
- <la_putin> or would mprotect need to be implimented aswell like realloc and free does as it is not compatible with the malloc implimentation
- <ammar2> is there a reason you're using mprotect with malloc instead of mmap
- <Maxpm> la_putin: mprotect needs a page-aligned address. Could that be it?
- <la_putin> to figure out the start of the heap
- <la_putin> and im not sure as as far as ik, it is just this [ unsigned long * heap_end = sbrk(0); mprotect (heap_end, 0, PROT_READ|PROT_WRITE); ]
- <la_putin> im not sure why it requires a malloc(0x1000) for it to work tho
- <la_putin> although the malloc should not apply as the length is 0 so it is mprotect'ing 0 bytes
- <Maxpm> Unless I'm missing something, heap_end is not page-aligned?
- <la_putin> it works if i use the libc malloc()
- <Maxpm> By chance, maybe.
- <la_putin> actually it works even without malloc
- <la_putin> although then it cannot determine the heap start
- <la_putin> this is the full function http://coliru.stacked-crooked.com/a/bc6fb347ce183a3f and this is what it is supposed to do http://coliru.stacked-crooked.com/a/841cec3ccd3948b0
- <feepbot> Coliru Viewer
- <la_putin> the 1st is with the malloc implimentation and the 2nd is without it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement