RemoteAllocator: dequeue as destructive iterator

This avoids repeated double-tapping domestication of the same pointer in
!QueueHeadsAreTame builds, by keeping the current "front" pointer to the queue
in trusted locations (stack, register) rather than storing it back to possibly
client-accessible memory.
This commit is contained in:
Nathaniel Wesley Filardo
2021-10-13 12:52:01 +01:00
committed by Nathaniel Wesley Filardo
parent 2316a5c574
commit ed10717dde
3 changed files with 67 additions and 52 deletions

View File

@@ -150,9 +150,6 @@ int main()
*
* - RemoteAllocator::dequeue domesticating the stub's next pointer (p)
*
* - On !QueueHeadsAreTame builds only, RemoteAllocator::dequeue
* domesticating the front pointer (to p, this time)
*
* - RemoteAllocator::dequeue domesticating nullptr (p is the last message)
*
* - Metaslab::alloc_free_list, domesticating the successor object in the
@@ -160,7 +157,7 @@ int main()
* after q).
*/
static constexpr size_t expected_count =
snmalloc::CustomGlobals::Options.QueueHeadsAreTame ? 3 : 5;
snmalloc::CustomGlobals::Options.QueueHeadsAreTame ? 3 : 4;
SNMALLOC_CHECK(snmalloc::CustomGlobals::domesticate_count == expected_count);
// Prevent the allocators from going out of scope during the above test