r/ProgrammingLanguages • u/ThomasMertes • Oct 14 '26
Improved article about memory safety
Thank you to everyone who gave feedback on my article about memory safety.
I used the input to vastly improve the article (see "Achieving memory safety").
Please take a look and share your thoughts again and consider starring the Seed7 project on GitHub.
13
Upvotes
View all comments
Show parent comment
1
u/ThomasMertes Oct 15 '26 edited Oct 15 '26
Why?
As far as I know a process that uses
prctl(PR_SET_DUMPABLE, 0);cannot read its own memory via the/procfilesystem. And thePR_SET_DUMPABLEflag is inherited to child processes so they can't access the memory of their parent either. So launching another process or a shell script will not help.What a privileged process can do is something different. Keep in mind that memory safety weaknesses are usually exploited to get superuser rights. If you are already superuser you have all power to do dangerous things.
Yes. This is something that the operating system needs to fix, since this memory safety loophole is provided by it.
prctl(PR_SET_DUMPABLE, 0);comes quite near to a fix, but it prevents debugging and maybe other useful things. What is needed from the operating system is something that prevents any access to the own process memory and also prevents any child process to do so (this is whatprctl(PR_SET_DUMPABLE, 0);does) and additionally allows debuggers to read the memory (since the debugger started the process).Hopefully Linux will do its homework. :-)
I will think over such a refinement of my definition of memory safety. Loopholes provided by the OS are definitely a thing.