mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Avoid creating linear mappings with the SHARED flag set
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5687f23b56
commit
28b66c1c8c
@ -216,7 +216,7 @@ fn handle_kernel_page_fault(f: &TrapFrame) {
|
|||||||
// Do the mapping
|
// Do the mapping
|
||||||
let page_table = KERNEL_PAGE_TABLE
|
let page_table = KERNEL_PAGE_TABLE
|
||||||
.get()
|
.get()
|
||||||
.expect("The kernel page table is not initialized when kernel page fault happens");
|
.expect("kernel page fault: the kernel page table is not initialized");
|
||||||
let vaddr = (page_fault_vaddr as usize).align_down(PAGE_SIZE);
|
let vaddr = (page_fault_vaddr as usize).align_down(PAGE_SIZE);
|
||||||
let paddr = vaddr - LINEAR_MAPPING_BASE_VADDR;
|
let paddr = vaddr - LINEAR_MAPPING_BASE_VADDR;
|
||||||
|
|
||||||
@ -225,7 +225,6 @@ fn handle_kernel_page_fault(f: &TrapFrame) {
|
|||||||
// mapping of physical memory.
|
// mapping of physical memory.
|
||||||
// 2. We map the address to the correct physical page with the correct flags, where the
|
// 2. We map the address to the correct physical page with the correct flags, where the
|
||||||
// correctness follows the semantics of the direct mapping of physical memory.
|
// correctness follows the semantics of the direct mapping of physical memory.
|
||||||
// Do the mapping
|
|
||||||
unsafe {
|
unsafe {
|
||||||
page_table
|
page_table
|
||||||
.map(
|
.map(
|
||||||
@ -234,10 +233,7 @@ fn handle_kernel_page_fault(f: &TrapFrame) {
|
|||||||
PageProperty {
|
PageProperty {
|
||||||
flags: PageFlags::RW,
|
flags: PageFlags::RW,
|
||||||
cache: CachePolicy::Uncacheable,
|
cache: CachePolicy::Uncacheable,
|
||||||
#[cfg(not(feature = "intel_tdx"))]
|
|
||||||
priv_flags: PrivFlags::GLOBAL,
|
priv_flags: PrivFlags::GLOBAL,
|
||||||
#[cfg(feature = "intel_tdx")]
|
|
||||||
priv_flags: PrivFlags::SHARED | PrivFlags::GLOBAL,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
Reference in New Issue
Block a user