-
Notifications
You must be signed in to change notification settings - Fork 57
Description
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.