From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: [BUG][PATCH] resend, /dev/zero vs hugetlb mappings.
Date: Fri, 09 Jul 2004 18:11:51 +0400 [thread overview]
Message-ID: <40EEA7A7.646A8BB6@tv-sign.ru> (raw)
Hello.
Hugetlbfs mmap with MAP_PRIVATE becomes MAP_SHARED
silently, but vma->vm_flags have no VM_SHARED bit.
Reading from /dev/zero into hugetlb area will do:
read_zero()
read_zero_pagealigned()
if (vma->vm_flags & VM_SHARED)
break; // fallback to clear_user()
zap_page_range();
zeromap_page_range();
It will hit BUG_ON() in unmap_hugepage_range() if
region is not huge page aligned, or silently convert
it into the private anonymous mapping.
Patch against mm7.
Oleg.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.7-mm7/drivers/char/mem.c.orig 2004-07-09 16:41:03.000000000 +0400
+++ 2.6.7-mm7/drivers/char/mem.c 2004-07-09 17:00:20.000000000 +0400
@@ -415,7 +415,7 @@ static inline size_t read_zero_pagealign
if (vma->vm_start > addr || (vma->vm_flags & VM_WRITE) == 0)
goto out_up;
- if (vma->vm_flags & VM_SHARED)
+ if (vma->vm_flags & (VM_SHARED | VM_HUGETLB))
break;
count = vma->vm_end - addr;
if (count > size)
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=40EEA7A7.646A8BB6@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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
all inboxes | Powered by JetHome®