Skip to content

Commit

Permalink
arm64_addrenv_pgmap.c: Revoke user execution access to kernel mmap'd …
Browse files Browse the repository at this point in the history
…pages

Otherwise, user can run code from there
  • Loading branch information
pussuw authored and xiaoxiang781216 committed Sep 10, 2024
1 parent eebff25 commit 0ca1a07
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm64/src/common/arm64_addrenv_pgmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ int up_addrenv_kmap_pages(void **pages, unsigned int npages, uintptr_t vaddr,

mask &= ~PTE_BLOCK_DESC_NG;

/* Also, revoke user execute access */

mask |= PTE_BLOCK_DESC_UXN;

/* Let arm64_map_pages do the work */

return arm64_map_pages(addrenv, (uintptr_t *)pages, npages, vaddr, mask);
Expand Down

0 comments on commit 0ca1a07

Please sign in to comment.