At first I thought this may be some security feature on my device that was preventing that. However, I was able to execute the code in the link below that also calls mprotect without issue:
I was very far from running low on memory with my device, so I do not think this was due to low resources. I suspect that as I’m using x86_64, maybe some of the offsets and code in polycrypt.c were to be used with i386?
That’s just a guess, but I’m interested on anyone’s thoughts on this.
Looks like the error you are actually getting is ENOMEM (check the mprotect man page for details). This normally means that the address you are passing as a parameter is wrong. So my best guess is that you have generated a PIE binary.
To play with program compile it as a normal binary (-no-pie flag?). Otherwise you can try to fix polycrypt to work with PIE binaries, which is, I think, an interesting exercise.
Let me know if that is the case (a PIE binary). Otherwise I may need more details to figure out what is wrong as the program works fine in all my boxes.
Well, I would make a pull request, but it seems github just flagged my account. Guess they don’t like privacy settings. I contacted them, but not sure how long it will take for them to review it. I’ll try to do that when/if they let me back on. lol