B2024: a call out of an enclave given an enclave object other than as in
Catalog status: active. Default severity: error. Stable name: enclave-call-out-argument. Family: Types and constraints.
A call out of a proof enclave may be given an object of the enclave's types only as an in parameter, where its invariant is proved at the call. Given one as in out or out, code outside the enclave could change the object while the enclave is in the middle of an operation on it. This is why enclaves offer cursor loops rather than iteration with a callback.
Example (Vada)
package Lists
with Annotate => (Verada, Enclave)
is
type List is limited private;
type Visitor is access procedure (L : in out List);
procedure Visit (L : in out List; V : not null Visitor);
...
package body Lists is
procedure Visit (L : in out List; V : not null Visitor) is
begin
V (L); -- client code given the list to change
end Visit;
end Lists;What to do (Vada)
Give the callee the object as in (access procedure (L : List)), or have the client loop over the list with a cursor and call its own code itself.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See types and constraints, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.