Recursive page table mapping and permissions
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Recursive page table mapping and permissions
After realizing the benefits of doing a "recursive mapping" of page tables, I've been rewriting my kernel's memory manager. By recursive mapping, I mean putting the page directory as the last page table, thereby mapping all of the page tables from 0xFFC00000 through 0xFFFFE000 (and the page directory itself at 0xFFFFF000). My issue is that if I want to allow user processes to use memory mapped by a table, the user flag must be set on that table. But if the user flag is set on the table, the recursive mapping of that table is then user accessible - a *very* bad thing for security. I know others use this technique; how do you solve this problem?
Re: Recursive page table mapping and permissions
Mark the page directory entry as supervisor, the one that you point back to the page directory, that way the page table permissions won't matter.
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: Recursive page table mapping and permissions
I see now. That's probably one of the reasons why there's a permission system for the page tables in the first place. Thanks for the fast response.