Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mps2: put the .gnu.sgstubs section in a hard coded address #209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EgorGrek
Copy link

Description

if the address of .gnu.sgtubs is not defined, it's not possible to provide correct SAU permission for non-secure callable code
I faced the problem that .gnu.sgtubs was placed at 0x00001XXXX addresses (probably the .text section is larger than 4kb), but the non-secure callable code permission was provided for 0x10000000 - 0x1000FFFF addresses, so I got a Hard Fault each time the non-secure world calls a secure function.
Also, I added the check for the size of .gnu.sgtubs section, It will notify a developer about a problem if the section is too big, because in this case it will not be covered by the SAU permission for non-secure callable code

Fixes # SAU non-secure callable permission does not cover .gnu.sgtubs section

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code cleanup/refactoring
  • CI system update
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The non-secure world crashed(got Hard Fault) at the start before the fix, after the fix it's working.

Test Configuration:

  • Firmware version: -
  • Hardware: QEMU v9.2.0/mps2-an505-qemu
  • Toolchain: gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 / GNU Make 4.3
  • SDK: -

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

  - if the address of the .gnu.sgtubs is not defined, it's not possible to provide a correct SAU permissions for non secure calleble code
Copy link

@tdrozdovsky
One business day has passed since the review started. Give priority to reviews as much as possible. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant