aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2019-02-26 10:31:03 +0100
committerJoakim Bech <joakim.bech@linaro.org>2019-04-25 14:38:39 +0700
commitd93190aa46033a67f4ac4d88fe39fda3bde5c4f4 (patch)
tree0f1afaea2851ffc8825958b2c9b690438e84f82d
parente61fc00f9643fb55f2b19d1168d86b9b15d8d9c9 (diff)
core: user_ta: load_elf(): return meaningful error code
If any error is encountered when the TEE core attempts to load a TA from TA storage, the next storage is tried and so on until the TA is successfully loaded or there is no more storage to try. In this case, a generic error code (TEE_ERROR_ITEM_NOT_FOUND) is returned to the caller of load_elf() and ultimately to the client. This is not super useful, especially when debug traces are disabled, because the user has no way to differentiate a true "not found" situation (which might be a configuration or deployement issue) from an issue with the TA file itself or an out-of-memory condition etc. This commit changes the return code of load_elf() to better reflect the errors. When load_elf_from_store() returns TEE_ERROR_ITEM_NOT_FOUND or TEE_ERROR_STORAGE_NOT_AVAILABLE, the next storage is tried. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
-rw-r--r--core/arch/arm/kernel/user_ta.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/arch/arm/kernel/user_ta.c b/core/arch/arm/kernel/user_ta.c
index 02dcf61e..a9bdae07 100644
--- a/core/arch/arm/kernel/user_ta.c
+++ b/core/arch/arm/kernel/user_ta.c
@@ -869,7 +869,7 @@ out:
/* Loads a single ELF file (main executable or library) */
static TEE_Result load_elf(const TEE_UUID *uuid, struct user_ta_ctx *utc)
{
- TEE_Result res;
+ TEE_Result res = TEE_ERROR_ITEM_NOT_FOUND;
const struct user_ta_store_ops *op = NULL;
SCATTERED_ARRAY_FOREACH(op, ta_stores, struct user_ta_store_ops) {
@@ -877,13 +877,10 @@ static TEE_Result load_elf(const TEE_UUID *uuid, struct user_ta_ctx *utc)
op->description);
res = load_elf_from_store(uuid, op, utc);
- if (res == TEE_ERROR_ITEM_NOT_FOUND)
- continue;
- if (res) {
- DMSG("res=0x%x", res);
+ DMSG("res=0x%x", res);
+ if (res == TEE_ERROR_ITEM_NOT_FOUND ||
+ res == TEE_ERROR_STORAGE_NOT_AVAILABLE)
continue;
- }
-
return res;
}