Hi Julien,
Julien Grall writes:
if ( shm_rpc->guest_page ) put_page(shm_rpc->guest_page);
Spurious change.
Good catch. Thank you.
/*
* TODO: With current implementation, OP-TEE will not issue
* RPC to free this buffer. Guest and OP-TEE will be out of
* sync: guest believes that it provided buffer to OP-TEE,
* while OP-TEE thinks of opposite. Ideally, we need to
* emulate RPC with OPTEE_MSG_RPC_CMD_SHM_FREE command.
*/
Can this condition happen if Xen runs out of memory?
Yes, this is one of reasons why translate_noncontig() might fail. It uses both xenheap to allocate data structure and domheap to allocate pagelists buffers. Any of those can fail, resulting in inconsistency.
You gave me idea to put gdprintk() with big fat warning there.