linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Tim LaBerge <tim.laberge@quantum.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	Wang Chen <wangchen@cn.fujitsu.com>
Subject: Re: Corruption with O_DIRECT and unaligned user buffers
Date: Fri, 19 Dec 2008 12:58:03 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0812191229550.26625@blonde.anvils> (raw)
In-Reply-To: <494B8AD5.3090901@cn.fujitsu.com>

On Fri, 19 Dec 2008, Li Zefan wrote:
> > diff -ur rhel-5.2/kernel/fork.c x/kernel/fork.c
> > --- rhel-5.2/kernel/fork.c	2008-07-10 17:26:43.000000000 +0200
> > +++ x/kernel/fork.c	2008-12-18 15:57:31.000000000 +0100
> > @@ -368,7 +368,7 @@
> >  		rb_parent = &tmp->vm_rb;
> >  
> >  		mm->map_count++;
> > -		retval = copy_page_range(mm, oldmm, mpnt);
> > +		retval = copy_page_range(mm, oldmm, tmp);
> >  
> 
> Could you explain a bit why this change is needed?
> 
> Seems this is a revert of the following commit:
> 
> commit 0b0db14c536debd92328819fe6c51a49717e8440
> Author: Hugh Dickins <hugh@veritas.com>
> Date:   Mon Nov 21 21:32:20 2005 -0800
> 
>     [PATCH] unpaged: copy_page_range vma
> 
>     For copy_one_pte's print_bad_pte to show the task correctly (instead of
>     "???"), dup_mmap must pass down parent vma rather than child vma.
> 
>     Signed-off-by: Hugh Dickins <hugh@veritas.com>
>     Signed-off-by: Andrew Morton <akpm@osdl.org>
>     Signed-off-by: Linus Torvalds <torvalds@osdl.org>
> 
> diff --git a/kernel/fork.c b/kernel/fork.c
> index e0d0b77..1c1cf8d 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -263,7 +263,7 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
>                 rb_parent = &tmp->vm_rb;
> 
>                 mm->map_count++;
> -               retval = copy_page_range(mm, oldmm, tmp);
> +               retval = copy_page_range(mm, oldmm, mpnt);
> 
>                 if (tmp->vm_ops && tmp->vm_ops->open)
>                         tmp->vm_ops->open(tmp);
> 
> 
> >  		if (tmp->vm_ops && tmp->vm_ops->open)
> >  			tmp->vm_ops->open(tmp);


[I'm not finding much time to think about anything at the moment, so
reluctant even to stick my head above the parapet; but this is easy,
and though there might be lots of things I'd dislike about Andrea's
patch if I had time to study it ;-), this certainly isn't one of them.]

This should be a non-issue: although the patch that this reverts was
valid in itself, it arose from my misunderstanding (of the likely
relevance of current->comm in exit_mmap - much more likely to be
relevant than I was thinking at the time) that I forced upon Nick
in print_bad_pte().

And now I've a rewrite of print_bad_pte() queued up in -mm, which
admits that misunderstanding and removes the "???" case: so in 2.6.29
it shouldn't matter if we pass parent or child vma to copy_page_range.
Oh, and it doesn't even matter in 2.6.26 onwards either: they don't
have any calls to print_bad_pte() below copy_page_range().

Though I've not checked whether we might have added some other
dependence on it being parent vma in the meanwhile - that's possible.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2008-12-19 12:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14 17:04 Tim LaBerge
2008-11-19  4:25 ` Nick Piggin
2008-11-19  6:52   ` Nick Piggin
2008-11-19 16:58   ` Andrea Arcangeli
2008-12-18 15:29     ` Andrea Arcangeli
2008-12-19  2:21       ` KAMEZAWA Hiroyuki
2008-12-19  5:06         ` KAMEZAWA Hiroyuki
2008-12-19  6:34       ` KOSAKI Motohiro
2008-12-20 16:02         ` Andrea Arcangeli
2008-12-19  7:19       ` KAMEZAWA Hiroyuki
2008-12-19  7:44         ` Li Zefan
2008-12-19  8:45           ` Li Zefan
2008-12-19 20:27           ` Andrea Arcangeli
2008-12-20 15:55         ` Andrea Arcangeli
2008-12-19 11:51       ` Li Zefan
2008-12-19 12:14         ` KOSAKI Motohiro
2008-12-19 12:58         ` Hugh Dickins [this message]
2008-12-19 20:34         ` Andrea Arcangeli
2014-06-27  2:08 Xiaoguang Wang
2014-07-01  4:18 ` Hugh Dickins
2014-07-02 11:39   ` Xiaoguang Wang

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=Pine.LNX.4.64.0812191229550.26625@blonde.anvils \
    --to=hugh@veritas.com \
    --cc=aarcange@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=nickpiggin@yahoo.com.au \
    --cc=tim.laberge@quantum.com \
    --cc=wangchen@cn.fujitsu.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