this question is specific to Unix and Linux.  but it is programming and security, too.my program will get a clear password or decryption key by one of a few ways (decrypting a password file, asking an agent, etc) and i want to be sure it cannot be written to swap space before it can be expunged from memory after using it.  i think this means getting unswappable address space.  but that normally needs root permission and my program needs to run as non-root.  can this be done portably in Unix? is it hopeful in Linux?configuring the system to have no swap space is not an option as the user of the program probably does not have such authority and while this might make the system more secure not all systems can do this.i can do this part in C though a way to do it in Python3 would be nice, too.can my non-root process get a few non-swapped pages for security?can i prevent this process from being suspended?  better to quit than a clear password written to swap.
how to prevent a buffer from swap
security;password