Question: is mprotect a system call?
Answer: On Linux it is always legal to call mprotect() on any address in a process' address space (except for the kernel vsyscall area). In particular it can be used to change existing code mappings to be writable. Whether PROT_EXEC has any effect different from PROT_READ is architecture and kernel version dependent.