-
Notifications
You must be signed in to change notification settings - Fork 192
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
Storage cleanup #670
Storage cleanup #670
Conversation
Here is an example on QEMU.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
cea8329
to
62d44f6
Compare
host/xtest/xtest_main.c
Outdated
@@ -169,6 +171,8 @@ int main(int argc, char *argv[]) | |||
#endif | |||
else if (argc > 1 && !strcmp(argv[1], "--stats")) | |||
return stats_runner_cmd_parser(argc - 1, &argv[1]); | |||
else if (argc > 1 && !strcmp(argv[1], "--clear-storage")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argc == 2 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
3b68334
to
c21e578
Compare
if (enum_res == TEE_ERROR_ITEM_NOT_FOUND) | ||
break; | ||
if (enum_res) | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case relates to an unexpected error. I think it should be reported by the TA as its storage may not have been wiped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updated to set res = enum_res;
.
goto out; | ||
obj_id = TEE_Malloc(TEE_OBJECT_ID_MAX_LEN, 0); | ||
if (!obj_id) | ||
goto out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should set res = TEE_ERROR_OUT_OF_MEMORY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
488e095
to
033e5a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
ta/include/ta_storage.h uses uint32_t so it should include <stdint.h>. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
When unexpected errors occur in the secure storage tests (regression_6xxx) some persistent objects might be left over, causing errors in further tests which expect to start from a clean state. This situation cannot be addressed fully by error handling in xtest or in the storage TA, because there are unrecoverable conditions (data abort, kill -9...). Instead, implement a new --clear-storage option which invokes the storage TA to enumerate and delete any objects it may own. The TA is invoked twice (because the same code is exposed via two UUIDS), and each invocation iterates on the two possible filesystems (TEE_STORAGE_PRIVATE_REE, TEE_STORAGE_PRIVATE_RPMB). Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
033e5a4
to
330855f
Compare
Previously failed tests can leave some data in storage which fails the tests later on unless data is cleared. --clear-storage option is new to xtest: OP-TEE/optee_test#670 See also: https://gitlab.com/Linaro/trustedsubstrate/meta-ledge-secure/-/merge_requests/60 Ignore return values since the option may not exist in all xtest versions and it can also report failures. Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Previously failed tests can leave some data in storage which fails the tests later on unless data is cleared. --clear-storage option is new to xtest: OP-TEE/optee_test#670 See also: https://gitlab.com/Linaro/trustedsubstrate/meta-ledge-secure/-/merge_requests/60 Ignore return values since the option may not exist in all xtest versions and it can also report failures. Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Does this also fix the problem with regression 4007_ecc and 4011 leaving the generated keys behind? I'm asking as I didn't yet have chance to test. |
I don't think so. This change targets ta/storageX/ TAs, not ta/crypt/ (see |
@etienne-lms I believe @mwasilew is referring to #652 which is related to SE050. I agree that in theory those tests should not create anything persistent, but it seems with SE050 it is not what is happening. CC @ldts. |
yes it is a bit different with the secure element and I didnt have time to propose a fix for that yet. Controlling the persistent storage in NVM is done from its persistent storage mirror (ie, by importing the SE keys into the PKCS#11 TA database) or by using a tool like https://github.com/foundriesio/fio-se05x-cli.git. Adressing the issue reported by those xtests is just not too high on my priority list since real SE05x users always interface to the element using PKCS#11. |
One small fix plus a new option:
xtest --clear-storage
.