NFC: Introduce pointer domestication backend support
`capptr_domesticate<Backend>(Backend::LocalState*, CapPtr<T, B>)` is the intended affordance for conversion to covert from a `CapPtr<T, B>` with `B::wildness` `Wild` to a `CapPtr<>` with `B::with_wildness<Tame>` and thence plumbed into the rest of the machinery. David added the SFINAE wrapper so that `Backend`-s now don't need to implement a domestication callback; instead, if the `Backend` does not provide a `capptr_domesticate` function, a default, which just does an explicit type cast, will be used instead. This is not yet hooked into the rest of the tree. Co-authored-by: David Chisnall <David.Chisnall@microsoft.com>
This commit is contained in:
committed by
Nathaniel Wesley Filardo
parent
7e53a2e82a
commit
1a608e6066
@@ -569,6 +569,11 @@ namespace snmalloc
|
||||
#ifdef SNMALLOC_PASS_THROUGH
|
||||
return external_alloc::malloc_usable_size(const_cast<void*>(p_raw));
|
||||
#else
|
||||
// TODO What's the domestication policy here? At the moment we just probe
|
||||
// the pagemap with the raw address, without checks. There could be
|
||||
// implicit domestication through the `SharedStateHandle::Pagemap` or we
|
||||
// could just leave well enough alone.
|
||||
|
||||
// Note that this should return 0 for nullptr.
|
||||
// Other than nullptr, we know the system will be initialised as it must
|
||||
// be called with something we have already allocated.
|
||||
@@ -600,6 +605,11 @@ namespace snmalloc
|
||||
void* external_pointer(void* p_raw)
|
||||
{
|
||||
#ifndef SNMALLOC_PASS_THROUGH
|
||||
// TODO What's the domestication policy here? At the moment we just probe
|
||||
// the pagemap with the raw address, without checks. There could be
|
||||
// implicit domestication through the `SharedStateHandle::Pagemap` or we
|
||||
// could just leave well enough alone.
|
||||
|
||||
// TODO bring back the CHERI bits. Wes to review if required.
|
||||
MetaEntry entry =
|
||||
SharedStateHandle::Pagemap::template get_metaentry<true>(
|
||||
|
||||
Reference in New Issue
Block a user