On Thu Mar 13 14:47:06 2025 +0000, Jacek Caban wrote:
We may just validate the handle again after reading.
Fwiw I'm not arguing against a shared handle table, it's not implemented in this version but it's possible to have without much changes. Having a shared handle table is orthogonal to how actual objects are identified/validated.
Let's consider this scenario:
1) Thread A reads entry for handle 123, get offset 456 2) Thread B updates handle 123 object which gets moved to offset 789 for whatever reason (needs growing, etc) 3) Thread A access object data at offset 456, reads invalid data 4) Thread B updates handle 123 object which gets moved back to offset 456 for some other reason
In both cases thread A needs to know that the data it has read is invalid. It's not possible with offset only, unless we enforce additional restriction on the objects.
In addition, even with additional restrictions, the validation needs to be done by reading the shared handle table again, checking that the handle is still valid and that the offset is still the same.
This is different from the existing object validation mechanism, and requires writing another piece of logic for user objects.
Instead, using the same underlying shared object infrastructure for user objects, we have a validation mechanism that works in every scenario, and is consistent with other objects. Reading id+offset from the shared handle table is enough to validate objects without having to check again the table.