Readit News logoReadit News
yosefk · 2 years ago
One thing this explains is why ASan has false negatives. It's a great tool, but the typical comment that it fully mitigates memory safety issues is just not true (even assuming your tests actually trigger the memory safety bugs, which unlike eg code coverage there's no knowing if you achieved or not)
searealist · 2 years ago
I've never seen anyone claim that.
nneonneo · 2 years ago
Some examples from 1 minute with Algolia:

https://news.ycombinator.com/item?id=37479651

“All decent C compilers have compilation options so that at run-time any undefined actions, including integer overflow and out-of-bounds accesses, will be trapped.”

“Despite the hype, by default Rust is not safer than C compiled with the right options, because the default for Rust releases is also to omit many run-time checks.”

https://news.ycombinator.com/item?id=25922430

Upthread someone asks for a “-safe” flag which makes C a safe language. The reply is “It's called AddressSanitizer. You enable it with the compiler flag -fsanitize=address.” Several replies ensue pointing out how wrong this is.

yosefk · 2 years ago
It comes up a lot in HN C++-related comment threads, for starters
xtqctz · 2 years ago
This is great! I found these videos helpful, too: https://youtu.be/Tl1uZ7FBwFQ

Does anyone know of a good explanation of HWAddress Sanitizer internals?

barco · 2 years ago
There are multiple versions of HWAsan.

One for ARMv8 with Top-Byte-Ignore: you can use the top byte of memory addresses to store a tag.

When you allocate memory you return the "tagged" pointer and internally store "this region has this tag".

When you dereference a pointer, you check that the tag matches what you expect in your internal data structure.

With memory tagging extensions you can do something similar but the checks are performed by the processor.

kccqzy · 2 years ago
Who sanitizes the sanitizer? One of the most hilarious bugs I've previously seen is when someone found a memory out-of-bound access inside the run time support library of Asan.
shric · 2 years ago
"For this article, you’ll need the following knowledge:

Basic C understanding (Memory, Stack, Heap, Syscall)."

Obviously, since C doesn't prescribe any kind of heap, stack or syscall behavior (or if they even exist), I assume the author meant something like "Basic understanding of how C is often implemented on certain operating systems and hardware".

mike_hock · 2 years ago
Yes, because asan only makes sense in the context of specific (kinds of) implementations.
ThouYS · 2 years ago
sanitizers are a constant source of pain
kimixa · 2 years ago
And just like pain, they show you where the (likely) problem is.

If you didn't have pain you'd still get the same damage to the body, you just wouldn't be aware.