Hacker News new | past | comments | ask | show | jobs | submit login

That's really not the application for this, it's tags, which are endlessly useful or characterizing the pointer. For instance you can use the MSBs to establish the type of whats pointed to, or for reference counting. I use the LSB to indicate if the value is a pointer or an unsigned integer, whereby you can store both an (integer) key to a record in a database, or a pointer to the record data in memory. You could use another bit in the pointer to indicate that the record is dirty.

Using unused bits in pointers can make you code more efficient and simpler.




Can unused bits be used for signed pointers or CRCs?


I would argue that we shouldn’t bother to build CRC checking of memory into programs and that ECC RAM should just become the norm eventually.

99.9999% of memory operations aren’t CRC-d so trying to fight against flaky hardware is a bit of an uphill battle.


Pointer authentication: https://llvm.org/docs/PointerAuth.html :

> Pointer Authentication is a mechanism by which certain pointers are signed. When a pointer gets signed, a cryptographic hash of its value and other values (pepper and salt) is stored in unused bits of that pointer.

> Before the pointer is used, it needs to be authenticated, i.e., have its signature checked. This prevents pointer values of unknown origin from being used to replace the signed pointer value.

ECC can't solve for that because it would only have one key for all processes.

Given a presumption of side channel writes, pointer auth is another layer of defense that may or may not be worth the loss in performance.

https://news.ycombinator.com/item?id=21791269#21800181




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: