From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>,
William Lee Irwin III <wli@holomorphy.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [BUG][PATCH] hugetlbfs vm_pgoff bugs.
Date: Fri, 09 Jul 2004 18:12:02 +0400 [thread overview]
Message-ID: <40EEA7B2.92FC5F46@tv-sign.ru> (raw)
Hello.
1. hugetlbfs_file_mmap() must check that vm_pgoff is hugepage aligned.
2. hugetlb_vmtruncate_list() confuses << with >> while converting
vm_pgoff to huge page offset, and zaps wrong area.
Patch against mm7.
Oleg.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.7-mm7/fs/hugetlbfs/inode.c.orig 2004-07-09 16:41:15.000000000 +0400
+++ 2.6.7-mm7/fs/hugetlbfs/inode.c 2004-07-09 16:56:02.000000000 +0400
@@ -52,6 +52,9 @@ static int hugetlbfs_file_mmap(struct fi
loff_t len, vma_len;
int ret;
+ if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1))
+ return -EINVAL;
+
if (vma->vm_start & ~HPAGE_MASK)
return -EINVAL;
@@ -280,16 +283,16 @@ hugetlb_vmtruncate_list(struct prio_tree
unsigned long v_length;
unsigned long v_offset;
- h_vm_pgoff = vma->vm_pgoff << (HPAGE_SHIFT - PAGE_SHIFT);
- v_length = vma->vm_end - vma->vm_start;
+ h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
-
/*
* Is this VMA fully outside the truncation point?
*/
if (h_vm_pgoff >= h_pgoff)
v_offset = 0;
+ v_length = vma->vm_end - vma->vm_start;
+
zap_hugepage_range(vma,
vma->vm_start + v_offset,
v_length - v_offset);
reply other threads:[~2004-07-09 14:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40EEA7B2.92FC5F46@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=david@gibson.dropbear.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome