Allocate executable memory

How can I allocate executable memory in CUDA (or assembly)? I am thinking of something equivalent to mprotect with PROT_EXEC as input. Or is all memory executable?

Do you want to manually copy SASS instructions there and call code in this memory region? I do not think there is an official API for it.
But the Linux driver for Nvidia is open source.

Thanks for your input. Correct, I want to write SASS instructions directly to memory segments that at a later point will be executable.

I will open an issue on the repository for the Linux drivers then, thanks!