r/ProgrammingLanguages • • 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

11 comments sorted by

View all comments

Show parent comment

2

u/Athas Futhark Oct 15 '26

Why?

I am not a security expert, so a specific analysis is beyond my ken. However, the basic problem is that the Unix security model is not intended to protect processes from other processes running as the same user. This means that if you take a sufficiently broad view of "memory safety" (broader than any other language), then performing IO (or in particular launching other processes) becomes a problem. I think the right solution is to not use such a broad definition of memory safety.

What a privileged process can do is something different.

In some sense it is more important that root processes are safe, because they can compromise the entire system. This matters only on servers of course; on personal machines the normal user account has access to all data that matters. Also, various common container techniques (like Docker) often run processes as the root user, and it would be strange if a language security guarantee depends on what user ID it runs under.

Yes. This is something that the operating system needs to fix, since this memory safety loophole is provided by it.

They will not fix it, since your definition of memory safety is not shared by other languages, and the security properties you expect are intentionally not part of the security model guaranteed by operating systems. I'm not a Windows expert, but since you can inject threads into processes with the same user, I'm sure you can easily break memory safety that way if you keep this extremely strict definition of memory safety.

1

u/ThomasMertes Oct 16 '26

I just added the chapter "A loophole introduced by operating systems" to the "Achieving memory safety" article.

What do you think about that?