Skip to content

How to use as_memref() safely? #273

@TheButlah

Description

@TheButlah

The docs say:

The caller must ensure that the raw pointer is valid and points to a properly initialized TEE_Param.

But how can we be sure the raw pointer is valid? An adversarial CA could be mutating the buffer concurrently to the TA reading it, and as such maybe this buffer should instead be considered as a volatile pointer. For that reason, constructing either a &[u8] or a &mut [u8] doesn't seem sound unless we can somehow assume the CA is playing nice, which a TA should never assume. I would think that the only safe mechanism here is to copy the buffer into the TA's stack or heap, so maybe the API should be reworked to expose a volatile pointer with a safe function to copy it into a slice?

Also, what is to stop the CA from providing a bogus pointer into the TA's own memory, thereby basically getting the TA to read from its own memory space (instead of from CA controlled memory)?

Please advise.

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