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 <manish.pandey2@arm.com>
Change-Id: Ied3b2d389aa3d9a96ace9078581d5e691f0b38a7
This commit is contained in:
Manish Pandey 2022-06-23 13:11:48 +01:00 committed by Manish V Badarkhe
parent d1747e1b8e
commit b1392f429c

View file

@ -26,6 +26,7 @@
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <plat/common/platform.h>
#include <services/drtm_svc.h>
#include <services/sdei.h>
#include <platform_def.h>
/* 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);
/*