From: Hugh Dickins <hugh@veritas.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, nickpiggin@yahoo.com.au,
pavel@suse.cz
Subject: Re: [PATCH -mm] swsusp: support creating bigger images
Date: Tue, 9 May 2006 13:30:48 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0605091301140.21281@blonde.wat.veritas.com> (raw)
In-Reply-To: <200605091219.17386.rjw@sisk.pl>
On Tue, 9 May 2006, Rafael J. Wysocki wrote:
> On Tuesday 09 May 2006 09:33, Andrew Morton wrote:
> > "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> >
> > I have a host of minor problems with this patch.
> >
> > > --- linux-2.6.17-rc3-mm1.orig/mm/rmap.c
> > > +++ linux-2.6.17-rc3-mm1/mm/rmap.c
> > >
> > > +#ifdef CONFIG_SOFTWARE_SUSPEND
> > > +static int page_mapped_by_task(struct page *page, struct task_struct *task)
> > > +{
> > > + struct vm_area_struct *vma;
> > > + int ret = 0;
> > > +
> > > + spin_lock(&task->mm->page_table_lock);
> > > +
> > > + for (vma = task->mm->mmap; vma; vma = vma->vm_next)
> > > + if (page_address_in_vma(page, vma) != -EFAULT) {
> > > + ret = 1;
> > > + break;
> > > + }
> > > +
> > > + spin_unlock(&task->mm->page_table_lock);
> > > +
> > > + return ret;
> > > +}
> >
> > task_struct.mm can sometimes be NULL. This function assumes that it will
> > never be NULL. That makes it a somewhat risky interface. Are we sure it
> > can never be NULL?
>
> Well, now it's only called for task == current, but I can add a check.
Better fold it into the (renamed and recommented) page_to_copy,
applying only to current.
The "use" of page_table_lock there is totally bogus. Normally you
need down_read(¤t->mm->mmap_sem) to walk that vma chain; but
I'm guessing you have everything sufficiently frozen here that you
don't need that.
But if it is sufficiently frozen, I'm puzzled as to why pages mapped
into the current process are (potentially) unsafe, while those mapped
into others are safe. If the current process can get back to messing
with its mapped pages, what if it maps a page you earlier judged safe?
Hugh
next prev parent reply other threads:[~2006-05-10 1:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-02 10:00 Rafael J. Wysocki
2006-05-09 7:33 ` Andrew Morton
2006-05-09 10:19 ` Rafael J. Wysocki
2006-05-09 11:22 ` Pavel Machek
2006-05-09 12:18 ` Rafael J. Wysocki
2006-05-09 12:30 ` Hugh Dickins [this message]
2006-05-10 3:50 ` Nick Piggin
2006-05-10 22:26 ` Rafael J. Wysocki
2006-05-11 15:01 ` Hugh Dickins
2006-05-11 21:19 ` Rafael J. Wysocki
2006-05-09 22:15 ` [PATCH -mm] swsusp: support creating bigger images (rev. 2) Rafael J. Wysocki
2006-05-09 22:27 ` Andrew Morton
2006-05-10 22:58 ` Rafael J. Wysocki
2006-05-10 23:38 ` Andrew Morton
2006-05-11 0:11 ` Nigel Cunningham
2006-05-11 13:20 ` Rafael J. Wysocki
2006-05-11 23:45 ` Nigel Cunningham
2006-05-12 0:17 ` Nathan Scott
2006-05-12 10:09 ` Pavel Machek
2006-05-13 22:32 ` Rafael J. Wysocki
2006-05-11 13:15 ` Rafael J. Wysocki
2006-05-11 11:35 ` Pavel Machek
2006-05-11 12:10 ` Rafael J. Wysocki
2006-05-11 23:49 ` Nigel Cunningham
2006-05-12 10:30 ` Pavel Machek
2006-05-13 22:33 ` Rafael J. Wysocki
2006-05-15 9:48 ` Con Kolivas
2006-05-15 19:52 ` Rafael J. Wysocki
2006-05-15 23:50 ` Con Kolivas
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.0605091301140.21281@blonde.wat.veritas.com \
--to=hugh@veritas.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=pavel@suse.cz \
--cc=rjw@sisk.pl \
/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®