Skip to content

Clarify (and possibly better enforce) the semantics of de-allocation #598

@hlef

Description

@hlef

We do not clearly define the semantics of the allocator with regards to de-allocation.

For example, is free() supposed to be allowed with an entirely de-permissioned capability? Currently, the allocator will happily free an object if passed a capability to that object and a matching allocator capability, even if the capability pointing to the object has no permissions. Is that what we want? Or should the allocator only accept to free with a fully-privileged capability as returned by heap_alloc?

One scenario that justifies the current behavior is the following: A compartment allocates an object and initializes it. At that stage the object is only used in a read-only manner, so the compartment drops its permissions to read-only to enforce least-privilege. Later, the compartment wants to free the object, but it does not have a fully-privileged capability to that object anymore. So the allocator should accept the read-only capability.

I am not sure we want to change the current behavior but I think it is worth a small discussion.

This question was raised as part of an ongoing verification effort of the memory allocator at the UBC.

We should:

  • Make a decision on the problem above;
  • And clearly document the semantics of the allocator in a design document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions