Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbeca7e7

Browse files
fix(vm): fix unmap silently not fully unmapping
Bug description:offset.unmap_range() bailed out if unmap() internally returned an error.The original intention was that the caller may choose to ignore the pagenot mapped errors as of demand paging. This obviously due to bad APIdesign decision bailed out early instead of unmapping the rest of theaddress range aswell. Causing all sorts of bugs. Now its fixed, yay!(xfe also works now)Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com>
1 parenta35528b commitbeca7e7

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

‎src/aero_kernel/src/mem/paging/mapper.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,15 +1128,6 @@ impl<'a> Translate for OffsetPageTable<'a> {
11281128
}
11291129

11301130
impl<'a>OffsetPageTable<'a>{
1131-
pubfnunmap_range(&mutself,range:Range<VirtAddr>,step:u64) ->Result<(),UnmapError>{
1132-
for addrin range.step_by(stepasusize){
1133-
let page:Page =Page::containing_address(addr);
1134-
self.inner.unmap(page)?.1.flush();
1135-
}
1136-
1137-
Ok(())
1138-
}
1139-
11401131
pubfncopy_page_range(&mutself,src:&mutOffsetPageTable,range:RangeInclusive<VirtAddr>){
11411132
letmut map_to = |src:&mutOffsetPageTable, addr, frame, flags|match frame{
11421133
MappedFrame::Size4KiB(frame) =>{

‎src/aero_kernel/src/userland/vm.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// along with Aero. If not, see <https://www.gnu.org/licenses/>.
1717

1818
use core::fmt::Write;
19+
use core::ops::Range;
1920

2021
use aero_syscall::{MMapFlags,MMapProt};
2122

@@ -733,16 +734,17 @@ impl Mapping {
733734
start:VirtAddr,
734735
end:VirtAddr,
735736
) ->Result<UnmapResult,UnmapError>{
736-
letmut unmap_range_inner = |range| ->Result<(),UnmapError>{
737-
match offset_table.unmap_range(range,Size4KiB::SIZE){
738-
Ok(_) =>Ok(()),
739-
740-
// its fine since technically we are not actually allocating the range
741-
// and they are just allocated on faults. So there might be a chance where we
742-
// try to unmap a region that is mapped but not actually allocated.
743-
Err(UnmapError::PageNotMapped) =>Ok(()),
744-
Err(err) =>Err(err),
737+
letmut unmap_range_inner = |range:Range<VirtAddr>| ->Result<(),UnmapError>{
738+
for addrin range.step_by(Size4KiB::SIZEasusize){
739+
let page:Page =Page::containing_address(addr);
740+
match offset_table.unmap(page){
741+
Ok((_, flusher)) => flusher.flush(),
742+
Err(UnmapError::PageNotMapped) =>{}
743+
Err(e) =>returnErr(e),
744+
}
745745
}
746+
747+
Ok(())
746748
};
747749

748750
if end <=self.start_addr || start >=self.end_addr{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp