SP: LargeAlloc return CBChunk & chase consequences

Even if we opt not to bound these pointers internally (if they aren't headed out
to the user program or we later derive bounded pointers), they should still be
annotated as something other than CBArena, ensuring that we do not attempt to
use them for general amplification.
This commit is contained in:
Nathaniel Filardo
2021-04-01 13:20:17 +01:00
committed by Nathaniel Wesley Filardo
parent 54fec3821f
commit f7821e11eb
10 changed files with 175 additions and 126 deletions

View File

@@ -113,7 +113,7 @@ namespace
*
* This method must be implemented for `LargeAlloc` to work.
*/
CapPtr<Largeslab, CBArena> pop_large_stack(size_t large_class)
CapPtr<Largeslab, CBChunk> pop_large_stack(size_t large_class)
{
return real_state->pop_large_stack(large_class);
};
@@ -124,7 +124,7 @@ namespace
*
* This method must be implemented for `LargeAlloc` to work.
*/
void push_large_stack(CapPtr<Largeslab, CBArena> slab, size_t large_class)
void push_large_stack(CapPtr<Largeslab, CBChunk> slab, size_t large_class)
{
real_state->push_large_stack(slab, large_class);
}
@@ -136,7 +136,7 @@ namespace
* This method must be implemented for `LargeAlloc` to work.
*/
template<bool committed>
CapPtr<Largeslab, CBArena> reserve(size_t large_class) noexcept
CapPtr<Largeslab, CBChunk> reserve(size_t large_class) noexcept
{
return real_state->template reserve<committed>(large_class);
}
@@ -207,7 +207,7 @@ namespace
top(pointer_offset(start, sb_size)),
shared_state(new (start) SharedState()),
state(
pointer_offset(CapPtr<void, CBArena>(start), sizeof(SharedState)),
pointer_offset(CapPtr<void, CBChunk>(start), sizeof(SharedState)),
sb_size - sizeof(SharedState)),
alloc(state, SNMALLOC_DEFAULT_CHUNKMAP(), &shared_state->queue)
{