How to map machine instctions in memory and execute them? (Aka, how to create a loader)

rempas rempas at tutanota.com
Mon Jun 6 16:35:20 UTC 2022


On Monday, 6 June 2022 at 16:08:28 UTC, Adam D Ruppe wrote:
>
> On a lot of systems, it can't be executable and writable at the 
> same time, it is a security measure.
>
> see https://en.wikipedia.org/wiki/W%5EX
>
>
> so you might have to mprotect it to remove the write permission 
> before trying to execute it.
>
> idk though

Thank you! This was very helpful and I can see why it is a clever 
idea to not allow it (and I love that OpenBSD was the first 
introducing it!!) and I love security stuff ;)

However, even with "mprotect" or If I just use "PROT_READ" and 
"PROT_EXEC", it still doesn't work so there should be something 
else I'm doing wrong...


More information about the Digitalmars-d-learn mailing list