For a while now we've been using the direct map without execute
permissions, and we have the ability to dynamically create executable
mappings in the kernel map. To help ensure that the direct map is never
used for code execution, mark the direct map PML4Es as NX as well. No
functional change intended.
Details
Details
- Reviewers
alc kib - Commits
- rS352624: Set NX on some non-leaf direct map page table entries.
Diff Detail
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 26634 Build 25010: arc lint + arc unit
Event Timeline
sys/amd64/amd64/pmap.c | ||
---|---|---|
1545–1559 | Doesn't setting pg_nx on the direct map's PML4 entries conflict with what this block is trying to do? |
sys/amd64/amd64/pmap.c | ||
---|---|---|
1545–1559 | I think the omission of pg_nx in the PDPEs is an oversight, and doesn't have any effect since it is set in the PDEs (which also do not set PG_RW). The intent of this block is to ensure that the kernel text is not writeable via the direct map, not to permit execution. So I believe the answer to your question is no. |
sys/amd64/amd64/pmap.c | ||
---|---|---|
1545–1559 | I would argue that the phrase "appropriate permissions" in the above comment is simply too vague. I shouldn't have to infer what "appropriate" means. :-) |