[kernel][arm64][mmu] Fix bug where privileged executable pages are executable from EL0

Previously, was always setting UXN and PXN bits on pages explicitly
mapped as non executable, not taking into account that user (EL0) code
could access a privileged page because UXN wasn't set.

Change the logic to appropriately set PXN and UXN bits on user and
privleged executable pages, appropriately:

user/privileged non-executable page: UXN=1, PXN=1
user executable page: UXN=0, PXN=1
privileged executable page: UXN=1, PXN=0

EL2 mappings for the kernel interpret these bits slightly differently,
so simply map the non executable code as XN=1 (bit 54).

Add kernel unit test to validate that pages mapped this way at least
appear to be in sync with the aspace.Query() api.

Bug: 88451
Change-Id: Icea7a3c5b5effa8b8fe828b3ed6d8e27433caaf0
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/614141
Reviewed-by: Marco Vanotti <mvanotti@google.com>
Commit-Queue: Travis Geiselbrecht <travisg@google.com>
5 files changed
tree: 22482985c7dac6dfd52e418d423880cad15437d9
  1. boards/
  2. build/
  3. bundles/
  4. docs/
  5. examples/
  6. garnet/
  7. products/
  8. scripts/
  9. sdk/
  10. src/
  11. third_party/
  12. tools/
  13. zircon/
  14. .clang-format
  15. .clang-tidy
  16. .git-blame-ignore-revs
  17. .gitattributes
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. analysis_options.yaml
  23. BUILD.gn
  27. OWNERS
  29. pyrightconfig.json
  30. README.md
  31. rustfmt.toml


What is Fuchsia?

Fuchsia an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.

We expect everyone interacting with our project to respect our code of conduct.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.