Skip to content

Secure Storage object getting lost when accessed by multiple applications simultaneously #2310

Description

@sahilnxp

Hi All,

We are working on a solution in which we are using the OPTEE as secure storage for our keys.
These keys will be accessed when a connection is made to the system and there can be a number of connections to this system at same time so these keys can be accessed simultaneously.

Connections are being handled in non-secure world and make a call to OPTEE only when this connection needs the key.

When we are trying to make more than 15 simultaneous connections TEEC_OpenSession() started getting failed with error 0xFFFF000C(TEEC_ERROR_OUT_OF_MEMORY).

Debugged this issue and found that the Private shared memory which we have allocated for OPTEE driver data structures is getting exhausted, Increased this size from 1 PAGE to 2 PAGE.
The number of connections increased a little bit.

But we got into another weird problem on running the simultaneous connections again and again, the Secure Object gets lost from the system.

So to narrow down the problem we made a simple host/ta application.
You can look at code here: https://github.com/sahilnxp/secure_storage_ta

This application is doing 2 things

  • Generating an Persistent RSA Key pair (command: ./secure_storage 1)
  • RSA Decrypt operation using this Key. (command: ./secure_storage 2)

Please Note: I have hardcoded the Object ID of persistent object to be 0, So please run (./secure_storage 1) command only once.

I made following script for running the application over night.

for (( i = 1; i <= 1000; i++ ))      ### Outer for loop ###
do
    for (( j = 1 ; j <= 10; j++ )) ### Inner for loop ###
    do
          ./secure_storage 2 &
    done
    echo "******* Sleeping for $i *******"
    sleep 10
done

This script ran successfully for around 37 time and after that the object gets lost.
Please look at the attached script for the test output.
test_log.txt

I am not able to understand what goes wrong.
Can anybody please help on this, why the object is getting deleted ?

Please Note: This test is done on NXP LS1046 Board.

Regards,
Sahil Malhotra

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