TZASC misconfiguration on i.mx8m
Hello!
FYI, in arch/arm/mach-imx/imx8m/soc.c enable_tzc380() U-Boot configures region0 to allow secure and non-secure world access.
This is known to be problematic and allows circumventing the TrustZone due to memory aliasing[0][1].
It causes also recent OP-TEE to panic at startup:
E/TC:0 0 Panic 'region0 is not secure configured, non-secure memory alias access possible!' at core/arch/arm/plat-imx/tzc380.c:217 <imx_configure_tzasc>
This is not a theoretical issue.
On my i.mx8mm evk Board I was able to exploit this and dump all OP-TEE memory from Linux.
Thanks,
//richard
[0] https://github.com/ARM-software/arm-trusted-firmware/commit/9bf148071aad597e7fe7d1080c00aeb35b67a3dd
[1] https://github.com/OP-TEE/optee_os/commit/443c5817de47f1bd19091b419806898070382a67
Signature · 2 lines
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr: ATU 66964118 | FN: 374287y
CC'ing Ye Li.
Quoted 7 lines · On Donnerstag, 4. Juni 2026 19:24 Richard Weinberger wrote:
Hello!
FYI, in
arch/arm/mach-imx/imx8m/soc.cenable_tzc380()U-Boot configures region0 to allow secure and non-secure world access.
This is known to be problematic and allows circumventing the TrustZone due to memory aliasing[0][1].
Quoted 5 lines
It causes also recent OP-TEE to panic at startup:
E/TC:0 0 Panic 'region0 is not secure configured, non-secure memory alias access possible!' atcore/arch/arm/plat-imx/tzc380.c:217<imx_configure_tzasc>This is not a theoretical issue.
On my i.mx8mm evk Board I was able to exploit this and dump all OP-TEE memory from Linux.
I suggest reverting commit b3cf0a8f03d162e030cde1131751d060853e16fc
Author: Ye Li <[email protected]> Date: Tue Aug 27 06:25:34 2019 +0000
imx8m: Configure trustzone region 0 for non-secure access
Set trustzone region 0 to allow both non-secure and secure access when trust zone is enabled. We found USB controller fails to access DDR if the default region 0 is secure access only.
Thanks,
//richard
Signature · 2 lines
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr: ATU 66964118 | FN: 374287y
Hi Richard,
Quoted 26 lines · Richard Weinberger
CC'ing Ye Li.
Quoted 7 lines · On Donnerstag, 4. Juni 2026 19:24 Richard Weinberger wrote:
Hello!
FYI, in
arch/arm/mach-imx/imx8m/soc.cenable_tzc380()U-Boot configures region0 to allow secure and non-secure world access.
This is known to be problematic and allows circumventing the TrustZone due to memory aliasing[0][1].Quoted 5 lines
It causes also recent OP-TEE to panic at startup:
E/TC:0 0 Panic 'region0 is not secure configured, non-secure memory alias access possible!' atcore/arch/arm/plat-imx/tzc380.c:217<imx_configure_tzasc>This is not a theoretical issue.
On my i.mx8mm evk Board I was able to exploit this and dump all OP-TEE memory from Linux.I suggest reverting commit
b3cf0a8f03d162e030cde1131751d060853e16fcAuthor: Ye Li <[email protected]> Date: Tue Aug 27 06:25:34 2019 +0000imx8m: Configure trustzone region 0 for non-secure access
Set trustzone region 0 to allow both non-secure and secure access when trust zone is enabled. We found USB controller fails to access DDR if the default region 0 is secure access only.
Quoted 5 lines
Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>Thanks,
//richard
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.
Best regards,
Ye Li
Quoted 1 line
Ye Li <[email protected]> schrieb am Mo., 8. Juni 2026, 03:43:
Quoted 38 lines
Hi Richard,
Quoted 8 lines · Richard Weinberger
CC'ing Ye Li.
Quoted 5 lines · On Donnerstag, 4. Juni 2026 19:24 Richard Weinberger wrote:
Hello!
FYI, in
arch/arm/mach-imx/imx8m/soc.cenable_tzc380()U-Boot configures region0 to allow secure and non-secure world access.
This is known to be problematic and allows circumventing the TrustZonedue to
Quoted 4 lines
Quoted 4 lines
memory aliasing[0][1].
It causes also recent OP-TEE to panic at startup:
E/TC:0 0 Panic 'region0 is not secure configured, non-secure memoryalias access possible!' at
core/arch/arm/plat-imx/tzc380.c:217<imx_configure_tzasc>Quoted 3 lines
Quoted 3 lines
This is not a theoretical issue.
On my i.mx8mm evk Board I was able to exploit this and dump all OP-TEEmemory from Linux.
Quoted 11 lines
I suggest reverting commit
b3cf0a8f03d162e030cde1131751d060853e16fcAuthor: Ye Li <[email protected]> Date: Tue Aug 27 06:25:34 2019 +0000imx8m: Configure trustzone region 0 for non-secure access
Set trustzone region 0 to allow both non-secure and secure access when trust zone is enabled. We found USB controller fails to access DDR if the default region 0 is secure access only.
Quoted 5 lines
Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>Thanks,
//richard
Quoted 9 lines
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.Best regards,
Ye Li
Can you please point to this discussion?
Thanks,
//richard
Quoted 1 line
Quoted 50 lines · Richard Weinberger
Ye Li <[email protected] <mailto:[email protected]>> schrieb am Mo., 8. Juni 2026, 03:43:
Hi Richard,
On 6/5/2026 10:52 PM, Richard Weinberger wrote:
> CC'ing Ye Li.
>
> On Donnerstag, 4. Juni 2026 19:24 Richard Weinberger wrote:
>> Hello!
>>
>> FYI, inarch/arm/mach-imx/imx8m/soc.cenable_tzc380()U-Boot
configures
>> region0 to allow secure and non-secure world access. >> This is known to be problematic and allows circumventing the
TrustZone due to
>> memory aliasing[0][1].
>>
>> It causes also recent OP-TEE to panic at startup:
>> E/TC:0 0 Panic 'region0 is not secure configured, non-secure
memory alias access possible!' at core/arch/arm/plat-imx/ tzc380.c:217 <imx_configure_tzasc>
>>
>> This is not a theoretical issue.
>> On my i.mx8mm evk Board I was able to exploit this and dump all
OP-TEE memory from Linux.
>
> I suggest reverting commitb3cf0a8f03d162e030cde1131751d060853e16fc> Author: Ye Li <[email protected] <mailto:[email protected]>>
> Date: Tue Aug 27 06:25:34 2019 +0000
>
> imx8m: Configure trustzone region 0 for non-secure access >
> Set trustzone region 0 to allow both non-secure and secure
access
> when trust zone is enabled. We found USB controller fails to
access
> DDR if the default region 0 is secure access only. >
> Signed-off-by: Ye Li <[email protected] <mailto:[email protected]>> > Signed-off-by: Peng Fan <[email protected]
<mailto:[email protected]>>
>
> Thanks,
> //richard
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.
Quoted 5 lines
Best regards,
Ye LiCan you please point to this discussion?
It is our internal discussion not on community thread. I add Sahil to comment for optee. And please notice, trustzone should be enabled before DDR initialization. So it should be in SPL not optee. Optee can reconfigure trustzone setting.
Best regards,
Ye Li
Quoted 4 lines
Thanks,
//richard
Richard Weinberger
Reviewed-by Sahil MalhotraYe Li,
Quoted 10 lines · On Dienstag, 9. Juni 2026 03:44 Ye Li wrote:
Quoted 10 lines
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.Best regards,
Ye Li
Quoted 6 lines
Quoted 1 line
Can you please point to this discussion?
It is our internal discussion not on community thread. I add Sahil to comment for optee. And please notice, trustzone should be enabled before DDR initialization. So it should be in SPL not optee. Optee can reconfigure trustzone setting.
But U-Boot right now harms the TZASC settings.
This is exactly why upstream OP-TEE has the following guard:
commit 443c5817de47f1bd19091b419806898070382a67
Author: Marco Felsch <[email protected]> Date: Tue Jun 17 13:27:53 2025 +0200
drivers: imx: tzc380: add support to verify region0
There are platforms where memory aliasing can't be prevented, e.g. the i.MX8M. If the previous running firmware configured region0, which covers the whole AXI address space, to be accessible from secure and non-secure world the OP-TEE core memory would be accessible via memory aliasing.
To prevent such attacks we need to ensure that region0 is accessible from the secure world only.
Upstream A-TF also used to misconfigure region0, this got fixed by:
https://github.com/ARM-software/arm-trusted-firmware/commit/9bf148071aad597e7fe7d1080c00aeb35b67a3dd
So, why is U-Boot working *against* upstream?
Instead of using the sledgehammer and enable normal world access to the whole region0, apply a more precise fix to make these USB masters work.
I know, with downstream IMX OP-TEE it's less of a problem, because you carry this change:
commit c09d6e9da171f8c5ee42b42ff144b320761a5f16
Author: Sahil Malhotra <[email protected]> Date: Mon Aug 4 20:08:59 2025 +0200
LFOPTEE-468 core: plat-imx: tzc380: update TZASC configuration
In order to prevent Memory aliasing, need to ensure that region0 is accessible from secure world only.
Thanks,
//richard
Signature · 2 lines
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr: ATU 66964118 | FN: 374287y
Quoted 53 lines · Richard Weinberger
Ye Li,
Quoted 10 lines · On Dienstag, 9. Juni 2026 03:44 Ye Li wrote:
Quoted 10 lines
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.Best regards,
Ye LiQuoted 6 lines
Quoted 1 line
Can you please point to this discussion?
It is our internal discussion not on community thread. I add Sahil to comment for optee. And please notice, trustzone should be enabled before DDR initialization. So it should be in SPL not optee. Optee can reconfigure trustzone setting.
But U-Boot right now harms the TZASC settings.
This is exactly why upstream OP-TEE has the following guard:
commit443c5817de47f1bd19091b419806898070382a67Author: Marco Felsch <[email protected]> Date: Tue Jun 17 13:27:53 2025 +0200drivers: imx: tzc380: add support to verify region0
There are platforms where memory aliasing can't be prevented, e.g. the i.MX8M. If the previous running firmware configured region0, which covers the whole AXI address space, to be accessible from secure and non-secure world the OP-TEE core memory would be accessible via memory aliasing.
To prevent such attacks we need to ensure that region0 is accessible from the secure world only.
Reviewed-by Sahil Malhotra <[email protected]>Signed-off-by Marco Felsch <[email protected]>Upstream A-TF also used to misconfigure region0, this got fixed by:
https://github.com/ARM-software/arm-trusted-firmware/commit/9bf148071aad597e7fe7d1080c00aeb35b67a3ddSo, why is U-Boot working *against* upstream?
Instead of using the sledgehammer and enable normal world access to the whole region0, apply a more precise fix to make these USB masters work.
I know, with downstream IMX OP-TEE it's less of a problem, because you carry this change:commit
c09d6e9da171f8c5ee42b42ff144b320761a5f16Author: Sahil Malhotra <[email protected]> Date: Mon Aug 4 20:08:59 2025 +0200
Quoted 7 lines
LFOPTEE-468 core: plat-imx: tzc380: update TZASC configuration
In order to prevent Memory aliasing, need to ensure that region0 is accessible from secure world only.
Signed-off-by Sahil Malhotra <[email protected]>
Why can't this optee patch apply to optee upstream? It is optee using secure memory, then it should be optee's responsibility to configure trustzone correctly. Optee can't depends on default value of trustzone, since trustzone is not enabled by optee.
Best regards,
Ye Li
Quoted 2 lines
Thanks,
//richard
Quoted 4 lines · On Dienstag, 9. Juni 2026 11:56 Ye Li wrote:
Why can't this optee patch apply to optee upstream? It is optee using secure memory, then it should be optee's responsibility to configure trustzone correctly. Optee can't depends on default value of trustzone, since trustzone is not enabled by optee.
Sorry for the harsh words, but that's *your* job at NXP to sort out. You seem to ignore upstream.
Thanks,
//richard
Signature · 2 lines
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr: ATU 66964118 | FN: 374287y
Quoted 9 lines · Richard Weinberger
Quoted 4 lines · On Dienstag, 9. Juni 2026 11:56 Ye Li wrote:
Why can't this optee patch apply to optee upstream? It is optee using secure memory, then it should be optee's responsibility to configure trustzone correctly. Optee can't depends on default value of trustzone, since trustzone is not enabled by optee.
Sorry for the harsh words, but that's *your* job at NXP to sort out. You seem to ignore upstream.
I'm not working in optee. As I mentioned early, NXP has decided to fix it in optee. That's what you find the patch in NXP downstream tree. I think Sahil will try to upstream it later.
Best regards,
Ye Li
Quoted 3 lines
Thanks,
//richard
Quoted 11 lines · On Dienstag, 9. Juni 2026 12:12 Ye Li wrote:
Quoted 8 lines
Quoted 4 lines
Why can't this optee patch apply to optee upstream? It is optee using secure memory, then it should be optee's responsibility to configure trustzone correctly. Optee can't depends on default value of trustzone, since trustzone is not enabled by optee.
Sorry for the harsh words, but that's *your* job at NXP to sort out. You seem to ignore upstream.
I'm not working in optee. As I mentioned early, NXP has decided to fix it in optee. That's what you find the patch in NXP downstream tree. I think Sahil will try to upstream it later.
Ok! :)
Maybe Sahil can shed light on the issue.
I find it kinda odd that NXP is only focusing on their tree despite the upstream solution.
Thanks,
//richard
Signature · 2 lines
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr: ATU 66964118 | FN: 374287y
HI Richard,
A Pull request for marking region0 as secure in OP-TEE is raised here: https://github.com/OP-TEE/optee_os/pull/7838
Regards,
Sahil Malhotra
Quoted 40 lines
-----Original Message-----
From: Richard Weinberger <[email protected]>
Sent: 09 June 2026 15:46
To: Sahil Malhotra <[email protected]>; Ye Li (OSS) <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Alice Guo <[email protected]>; Peng Fan <[email protected]>; [email protected]; Ye Li <[email protected]>
Subject: [EXT] Re: TZASC misconfiguration on i.mx8mCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Quoted 11 lines · On Dienstag, 9. Juni 2026 12:12 Ye Li wrote:
Quoted 8 lines
Quoted 4 lines
Why can't this optee patch apply to optee upstream? It is optee using secure memory, then it should be optee's responsibility to configure trustzone correctly. Optee can't depends on default value of trustzone, since trustzone is not enabled by optee.
Sorry for the harsh words, but that's *your* job at NXP to sort out. You seem to ignore upstream.
I'm not working in optee. As I mentioned early, NXP has decided to fix it in optee. That's what you find the patch in NXP downstream tree. I think Sahil will try to upstream it later.
Ok! :)
Maybe Sahil can shed light on the issue.
I find it kinda odd that NXP is only focusing on their tree despite the upstream solution.Thanks,
//richard--
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr:
ATU 66964118 | FN: 374287y
Hi Ye Li,
Quoted 5 lines · Ye Li
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.
Does NXP plan to fix this?
Thanks
Hi Fabio,
Quoted 10 lines · Fabio Estevam
Hi Ye Li,
Quoted 5 lines · Ye Li
We have discussed this with iMX optee owner. The fix should be done in OPTEE not u-boot.
1. OPTEE uses secure memory, so it needs to re-confiure trustzone to meet secure requirement not depending on SPL setting.
2. SPL also supports Non-optee case.
Quoted 3 lines
Does NXP plan to fix this?
Thanks
Sahil has sent patch to optee community. We are still discussing it. In any case, this SPL patch can't be simply reverted, it will cause regression to SW running in normal world.
Best regards,
Ye Li