summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Forissier <jerome@forissier.org>2021-01-13 11:38:33 +0100
committerJérôme Forissier <jerome@forissier.org>2021-01-13 16:30:19 +0100
commit17c32c05f0b2565309b8817b3e3cca8777c32a20 (patch)
tree9e15744510b58631d00dcc3bd1911fe2bddb1f28
parent2a7b42199ea2e3b5f9e91a927c987894dd07ed58 (diff)
ta: fix processing of DT_FINI_ARRAY
The code that is supposed to invoke the finalization functions in the DT_FINI_ARRAY of a TA is broken. It mixes DT_INIT_ARRAY with DT_FINI_ARRAYSZ. As a result, the finalization functions are never called and the TA may even crash on exit. Fix the issue by replacing the erroneous DT_INIT_ARRAY with DT_FINI_ARRAY. Fixes: dd655cb9906c ("ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAY") Reported-by: JY Ho <JY.Ho@mediatek.com> Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r--lib/libutee/arch/arm/user_ta_entry.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libutee/arch/arm/user_ta_entry.c b/lib/libutee/arch/arm/user_ta_entry.c
index c470ceec..657d1b62 100644
--- a/lib/libutee/arch/arm/user_ta_entry.c
+++ b/lib/libutee/arch/arm/user_ta_entry.c
@@ -137,7 +137,7 @@ static int _fini_iterate_phdr_cb(struct dl_phdr_info *info,
size_t num_fn = 0;
size_t i = 0;
- _get_fn_array(info, DT_INIT_ARRAY, DT_FINI_ARRAYSZ, &fn, &num_fn);
+ _get_fn_array(info, DT_FINI_ARRAY, DT_FINI_ARRAYSZ, &fn, &num_fn);
for (i = 1; i <= num_fn; i++)
fn[num_fn - i]();