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

1

u/koflerdavid Oct 15 '26

Does Seed7 restrict IO operations in any way? On many operating systems, if you can do IO, you can read arbitrary memory through various mechanisms (on Linux, via the /proc filesystem). This is the case for most memory-safe languages and is usually not considered a major problem, but it means you need to be very precise about what exactly Seed7 guarantees. There are languages in which functions absolutely cannot do this, but they tend to be languages that require you to be explicit about IO in the type system. From browsing the Seed7 documentation, it seems conventional in its handling of IO.

The claim about not being able to access any secrets stored somewhere else in memory is definitely tacky. On the other hand, memory safety is something distinct from sandboxing and thus this hole should be disregarded. In-process sandboxing is extremely hard to achieve since the POSIX security model draws security boundaries at user level; everything below is assumed to play nice to each other.

2

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?

2

u/koflerdavid Oct 16 '26

I'm unfortunately not knowledgeable enough to judge whether there are other holes that have to be closed, or whether it is indeed possible to close all avenues that a process can use to break its own memory safety. There is a reason why Android assigns separate users to each app to segregates them.