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

Make jemalloc bound returned pointers to their usable size #2147

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Commits on Jul 24, 2024

  1. Configuration menu
    Copy the full SHA
    5577e2a View commit details
    Browse the repository at this point in the history
  2. jemalloc: Avoid adding bounds unnecessarily

    The memory returned by je_allocm() and je_rallocm() is allocated using
    je_mallocx() and je_(x|r)allocx(), respectively, and those functions apply
    bounds to their return values by virtue of being implemented using
    imalloc().
    
    This makes it easier to make jemalloc bound pointers to the usable size
    instead of the allocation size.
    markjdb committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    04f0153 View commit details
    Browse the repository at this point in the history
  3. jemalloc: Clamp in malloc_usable_size() only if a tag is present

    This behaviour should be safe and is useful for testing whether the bounds
    applied by jemalloc match what malloc_usable_size() reports.  That is, one
    can validate bounds with a check like,
    
        assert(cheri_getlen(p) == malloc_usable_size(cheri_cleartag(p)));
    
    In particular, malloc_usable_size() will look up the usable size using
    allocator metadata, so it's handy to be able to compare that size with the
    capability bounds.
    markjdb committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    1d0c0cc View commit details
    Browse the repository at this point in the history
  4. jemalloc: Bound pointers to the usable size

    Previously jemalloc would return pointers bounded to the allocation size,
    which is stricter but makes realloc() loops slow since they force MRS to
    make a new allocation.  Instead, bound returned pointers to their usable
    size; MRS can now optionally further tighten bounds if so desired.
    markjdb committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    25a6bee View commit details
    Browse the repository at this point in the history