-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Secure Storage object getting lost when accessed by multiple applications simultaneously #2310
Comments
Thanks to the easy way of reproducing the problem I could easily spot the error. Fix in #2316 |
The way you're opening sessions consumes a lot of memory. By making the TA single instance ( You could also try to find a way of limiting the number of open sessions. A session is a precious resource in secure world, much more so than a file descriptor in normal world. |
Thanks for quick fix. 1 Out of context query: Where can I see the roadmap for the OPTEE releases ? |
Unfortunately that still hasn't been published which might sound a bit weird for an open source project. But the intention is to share it, either here on GitHub directly or at optee.org. But to give you a sneak-peek, here is the plan for the coming months. Note that some of them are sub-set of full implementations (for example PKCS#11 work) and some things are taken piece by piece (keymaster).
|
X.509 Certifiacate support will be added as part of PKCS#11 implementation ?? Thanks @jbech-linaro |
That one is a "pre-condition"/dependency for both |
After some study I understood If I enable TA_FLAG_SINGLE_INSTANCE and TA_FLAG_MULTIPLE_SESSION in TA, still will get the above error, since this memory is being managed in kernel. So if this is a good idea to make this OPTEE_SHM_NUM_PRIV_PAGES as kernel config option which can be changed while compiling the kernel to support these kind of use cases ?? Please correct me if my understanding is not correct. |
That will not help, it's the heap in secure world that is exhausted ( I'd recommend review the number of sessions you're opening. |
I got into some details on this.
This get_msg_arg() function is failing at following:
From this it looks like the PRIVATE memory area for driver structures are getting exhausted. Sorry for again and again pointing that error is coming from here, But I not able to understand how the heap in secure world is getting exhausted. Thanks |
Aha, it looks like it's indeed the private memory area that is too small. |
Yeah, so can we have a Kernel CONFIG option for setting the number of pages to be configured in PRIVATE Memory so that user need not to change the code ? |
Yes, sounds good. |
Thanks @jenswi-linaro :) So how patching for driver is done, Will it become available in next kernel release ? |
This seems like something straight forward so I you can post it on LKML with me in CC and we can review it there. If you'd like me or someone to take a look at it before you post it at LKML you can create a pull request at https://github.com/linaro-swg/linux/pulls Once the patch has been posted and reviewed on LKML I'll add it to my tree and send a pull request to arm-soc. Since we're at the end of the current kernel cycle we're likely miss the nearest upcoming merge window. |
Will raise the pull request on https://github.com/linaro-swg/linux/pulls first.. |
Raised a pull request for this on: linaro-swg/linux#62 |
Hi @jenswi-linaro |
4.19 |
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
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.
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
The text was updated successfully, but these errors were encountered: