From 0ddb8ea799e6c1321f94163ad822b1470cf0ad7b Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Sun, 23 Nov 2008 23:24:03 +0200 Subject: [PATCH] Fix to do_mmap(): file_offset was byte offset, it is now a pfn. Uncovered a mmap() bug that came along this far. file_offset parameter of do_mmap() was assigned to the mapped vma as is, i.e. as a byte offset. This caused problems since most page fault and other internal code assumed this was a page frame number. This is now fixed. This came along unnoticed since all mmaps until now started at file offset 0. --- tasks/mm0/src/mmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/mm0/src/mmap.c b/tasks/mm0/src/mmap.c index 9da82d0..792a7c3 100644 --- a/tasks/mm0/src/mmap.c +++ b/tasks/mm0/src/mmap.c @@ -192,7 +192,8 @@ void *do_mmap(struct vm_file *mapfile, unsigned long file_offset, return PTR_ERR(err); /* For valid regions that aren't allocated by us, create the vma. */ - if (!(new = vma_new(__pfn(map_address), npages, flags, file_offset))) + if (!(new = vma_new(__pfn(map_address), npages, flags, + __pfn(file_offset)))) return PTR_ERR(-ENOMEM); /* Attach the file as the first vm object of this vma */