From b1392f429cdd368ea2b8e183a1ac0fb31deaf694 Mon Sep 17 00:00:00 2001 From: Manish Pandey Date: Thu, 23 Jun 2022 13:11:48 +0100 Subject: [PATCH] feat(drtm): ensure that no SDEI event registered during dynamic launch Ensured no SDEI event are registered during dynamic launch. Signed-off-by: Manish Pandey Change-Id: Ied3b2d389aa3d9a96ace9078581d5e691f0b38a7 --- services/std_svc/drtm/drtm_main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/services/std_svc/drtm/drtm_main.c b/services/std_svc/drtm/drtm_main.c index 9237d82a5..bec4b72f1 100644 --- a/services/std_svc/drtm/drtm_main.c +++ b/services/std_svc/drtm/drtm_main.c @@ -26,6 +26,7 @@ #include #include #include +#include #include /* Structure to store DRTM features specific to the platform. */ @@ -569,6 +570,13 @@ static uint64_t drtm_dynamic_launch(uint64_t x1, void *handle) SMC_RET1(handle, ret); } + /* Ensure that there are no SDEI event registered */ +#if SDEI_SUPPORT + if (sdei_get_registered_event_count() != 0) { + SMC_RET1(handle, DENIED); + } +#endif /* SDEI_SUPPORT */ + /* * Engage the DMA protections. The launch cannot proceed without the DMA * protections due to potential TOC/TOU vulnerabilities w.r.t. the DLME @@ -611,13 +619,6 @@ static uint64_t drtm_dynamic_launch(uint64_t x1, void *handle) drtm_dl_reset_dlme_el_state(dlme_el); drtm_dl_reset_dlme_context(dlme_el); - /* - * TODO: Reset all SDEI event handlers, since they are untrusted. Both - * private and shared events for all cores must be unregistered. - * Note that simply calling SDEI ABIs would not be adequate for this, since - * there is currently no SDEI operation that clears private data for all PEs. - */ - drtm_dl_prepare_eret_to_dlme(&args, dlme_el); /* -- 2.39.5