Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override add malloc_conceal api proposal #434

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

devnexen
Copy link
Contributor

No description provided.

@devnexen devnexen force-pushed the malloc_conceal branch 3 times, most recently from a797b2a to e0937f6 Compare November 30, 2021 23:19
@davidchisnall
Copy link
Collaborator

Hi, I've thought about adding this API. I think the correct way of doing it is:

  • Extend the PALs to support no-core memory as a class-template parameter.
  • Create a separate allocator instance that allocates slabs using the no-core Pal.
  • Have these APIs use the second allocator instance.

They can share the pagemap with other allocators and they should be returned to the pools.

Libsodium's secure allocator also supports rounding up allocations to page size, allocating them at the end of the page and putting guard pages on either side. Once the PAL can provide no-core pages, this should also be possible through the large-object paths in the allocator. The allocator rounds up to the page size so that you can mprotect the memory read-only or no-access later.

@mjp41
Copy link
Member

mjp41 commented Dec 1, 2021

This is a really interesting idea. I am not sure what the granularity of NODUMP should be.

       The Linux implementation requires that the address addr be page-
       aligned, and allows length to be zero.

If this is at a Page granularity, then we probably need to allocate whole slabs with NODUMP set. This is doable, but would involve adding a completely different set of sizeclasses for concealed allocations.

Adding NODUMP to the PAL is something I have been meaning to do, to address #371.

@devnexen
Copy link
Contributor Author

devnexen commented Dec 1, 2021

This is a really interesting idea. I am not sure what the granularity of NODUMP should be.

       The Linux implementation requires that the address addr be page-
       aligned, and allows length to be zero.

If this is at a Page granularity, then we probably need to allocate whole slabs with NODUMP set. This is doable, but would involve adding a completely different set of sizeclasses for concealed allocations.

you re perfectly right it has to, I was just assessing if the overall idea would hit home before going deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants