←back to thread

597 points pizlonator | 6 comments | | HN request time: 0.001s | source | bottom
Show context
AndyKelley ◴[] No.45135042[source]
Super cool project. Sorry if you explained this already, I don't know what "Dijkstra accurate" means. How does it know if an object is truly available to be reclaimed, given that pointers can be converted to integers?
replies(2): >>45135053 #>>45138263 #
pizlonator ◴[] No.45135053[source]
> given that pointers can be converted to integers?

Because if they get converted to integers and then stored to the heap then they lose their capability. So accesses to them will trap and the GC doesn’t need to care about them.

Also it’s not “Dijkstra accurate”. It’s a Dijkstra collector in the sense that it uses a Dijkstra barrier. And it’s an accurate collector. But these are orthogonal things

replies(2): >>45135178 #>>45135450 #
1. charleslmunger ◴[] No.45135178[source]
Out of curiosity, does this idiom work in fil-c?

https://github.com/protocolbuffers/protobuf/blob/cb873c8987d...

      // This somewhat silly looking add-and-subtract behavior provides provenance
      // from the original input buffer's pointer. After optimization it produces
      // the same assembly as just casting `(uintptr_t)ptr+input_delta`
      // https://godbolt.org/z/zosG88oPn
      size_t position =
      (uintptr_t)ptr + e->input_delta - (uintptr_t)e->buffer_start;
      return e->buffer_start + position;
It does use the implementation defined behavior that a char pointer + 1 casted to uintptr is the same as casting to uintptr then adding 1.
replies(1): >>45135233 #
2. pizlonator ◴[] No.45135233[source]
Yeah that should just work

Code that strives to preserve provenance works in Fil-C

replies(1): >>45135448 #
3. charleslmunger ◴[] No.45135448[source]
Very cool. Hardware asan did not catch the pointer provenance bug in the previous implementation of that code because it relies on tag bits, and the produced pointer was bit-identical to the intended one. It sounds like fil-c would have caught it because the pointer capabilities are stored elsewhere.
replies(1): >>45135838 #
4. kragen ◴[] No.45135838{3}[source]
What hardware do you need for hardware Asan? I'm so out of the loop that I haven't heard of it before.
replies(1): >>45136889 #
5. saagarjha ◴[] No.45136889{4}[source]
TBI: https://clang.llvm.org/docs/HardwareAssistedAddressSanitizer...
replies(1): >>45136958 #
6. kragen ◴[] No.45136958{5}[source]
Thanks!