ESP32-S3 : Permission Control (PSM)

ThomasESP32
Posts: 229
Joined: Thu Jul 14, 2022 5:15 am

ESP32-S3 : Permission Control (PSM)

Postby ThomasESP32 » Wed Sep 07, 2022 9:51 am

Good morning,

I am just reading the ESP32-S3 reference manual and more precisely the chapter 14 (Permission Control (PSM)).
It seems that this unit is designed for flexible access management to internal memory, external memory and all perhiperals.

However, my question is : "What happen if the developer does not change the configuration of this unit ?"
Is there any restriction, read/write/execute access if the developer does not change the configuration ?
Or can we say that in this case, all the internal memory/ external memory/peripheral regions can me accessed without any restrictions ?

Thank you for you answer.
Best regards.

Thomas TRUILHE

ThomasESP32
Posts: 229
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32-S3 : Permission Control (PSM)

Postby ThomasESP32 » Wed Sep 07, 2022 10:07 am

Good morning,
Moreover, I can see the following lines :

Any attempt to access ESP32-S3’s slave device without configured permission is considered an unauthorized
access and will be handled as described below:
• This attempt will only be responded with default values, in particular,
– All instruction execution or read attempts will be responded with 0 (for internal memory) or 0xdeadbeaf
(for external memory)
– All write attempts will fail
• An interrupt will be triggered (when enabled). See details below.
Note that:
• All permission control related interrupts described in this section can be independently configured for CPU0
and CPU1.
• Only the information of the first interrupt is logged. Therefore, it’s advised to handle interrupt signals and
clear interrupts in-time, so the information of next interrupt can be logged correctly.

In my application, I would like to have the possibility to access the internal memory, the external memory and the peripherals without any particular restrictions (For CPU0 and CPU1). Is there a easy way to disable the Permission Control (PMS° Unit ?


Best regards

Thomas TRUILHE

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP32-S3 : Permission Control (PSM)

Postby ESP_igrr » Wed Sep 07, 2022 12:52 pm

Hi Thomas,

By default, startup code in esp-idf configures the permission controller to prohibit unreasonable memory access, such as:
- overwriting instruction RAM
- execution of code from data RAM

The only programs which need such kind of access are programs implementing some kind of dynamic code loading, or self-modifying code. This is relatively uncommon for applications built with esp-idf, and prohibiting such operations makes certain types of software vulnerabilities harder to exploit.

Other types of access, such as access to peripheral registers, are allowed.

Although not recommend, you can disable this protection via CONFIG_ESP_SYSTEM_MEMPROT_FEATURE sdkconfig option.

ThomasESP32
Posts: 229
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32-S3 : Permission Control (PSM)

Postby ThomasESP32 » Wed Sep 07, 2022 1:52 pm

Hi,

thank you for your answer.

So, as I understand, the memory accesses you mention are the only memory accesses that are prohibited.
Is it correct ?

The other standard accesses like :
- Read/Write accesses in external RAM
- Read/execute accesses in external FLASH
- Read/Write accesses in internal RAM
- Read/Write accesses to the peripherals

are allowed. It means that "standard" developpers do not need to worry about the Permission control unit.
Is it correct ?


Best regards,

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP32-S3 : Permission Control (PSM)

Postby ESP_igrr » Wed Sep 07, 2022 4:11 pm

Yes, that's correct. "Normal" memory access is not affected.

Who is online

Users browsing this forum: No registered users and 110 guests