Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

as someone who's pretty much only written high level languages and doesn't really know what they're talking about, doesn't memory safety generally refer to referencing data you shouldn't (things like buffer overruns?)

please correct me if i'm wrong :)



sort by: page size:

That's not memory-unsafety. Memory-safety means avoiding bugs like buffer overflow, ROP, etc.

Memory safety is not about what a language has. It's about all the things a language doesn't have, doesn't allow.

> what is "safe" code without a guarantee of memory safety?

Memory safety is the absolute minimum for safety critical code.

It seems to be surprise for most people that you can write memory safe code in C and check for that statically and that includes static stack and heap exhaustion checks.


Isn't memory safety a subset (and I would argue a necessary requisite) of correctness?

Isn't memory safety needed in all cases?

Alright, I missed that nuance. I don't think I've ever worked with a language that provided memory safety without garbage collection.

I think the parent is talking about architecture around memory, not the entire program design.

> if you believe the language will keep you safe

safer != safe.


Isn't this confusing memory safety with safety?

Most definitions of memory safety include not crashing.

Memory safety?

Uh, most? Memory safety is about data races and concurrent access violations. De-referencing a nil pointer isn't a memory safety violation, for example. But I guess if you re-define memory safety to mean anything that can produce a segfault then sure.

> A JIT is not, by itself, unsafe. The problem is that maintaining the complex set of constraints and invariants necessary to generate both safe and performant code is extremely difficult, and one slip-up can mean generating code that breaks some invariant and escapes a safety boundary.

I mean… isn't that what unsafe means? A "memory-unsafe" language means a language it's possible to make a mistake in, not one where memory errors happen all the time.


I'm pretty sure that in this context "memory safe" means more than that, like difficult to impossible to have a buffer overflow.

Memory safety is not the only type of safety though. There are race conditions for example.

> I read the paper's description, and still don't quite understand exactly what they mean by "memory safety". This is not referring to safer programming practices like using the STL with iterators, correct?

I would assume it's referring to some kind of actual guarantee, which STL doesn't provide even in idiomatic use, due to things like iterator invalidation or subtly broken use of references.


I don't think you understand what memory safety means. Please look it up.

It's independent of how you write or design your program. It's a property of the language + runtime combination.

(Folks out there downvoting me: you could do with some education too... Parent is a completely ignorant (in the best possible sense - easily fixed) comment.)


"Safe" here means memory and type safety.

What is this language's approach to memory safety?

> Memory unsafety is just one class of safety bugs, and a relatively unimportant one.

Wrong. Memory unsafety, in its various forms, is the primary source of exploits in software written in C.

> I'd be much more worried about concurrency bugs

Another thing which is hard to do in C, and so much easier in some more modern programming languages (particularly in Rust).

next

Legal | privacy