From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: Re: [PATCH 1/1] don't call pre_restore_task twice
Date: Thu, 8 Oct 2009 09:12:58 -0500 [thread overview]
Message-ID: <20091008141258.GA21486@us.ibm.com> (raw)
In-Reply-To: <20091008030919.GH18101-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
Quoting Matt Helsley (matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> On Wed, Oct 07, 2009 at 06:47:50PM -0500, Serge E. Hallyn wrote:
> > Pre_restore_task is being called both before and inside
> > restore_task, causing a memory leak at
> > current->checkpoint_data.
> >
> > Only call it once, outside restore_task.
> >
> > This fixes a memory leak spotted by Dan Smith, and the
> > actual bug was deduced by Matt Helsley.
> >
> > Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > Reported-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > Cc: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > Cc: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> >
> > Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> Reviewed-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> However, I think I spotted another problem:
>
> int pre_restore_task()
> {
> sigset_t sigset;
>
> /* task-specific restart data: freed from post_restore_task() */
> current->checkpoint_data = kzalloc(sizeof(struct ckpt_data),
> GFP_KERNEL);
> if (!current->checkpoint_data)
> return -ENOMEM;
> ...
> }
>
> void post_restore_task()
> {
> sigprocmask(SIG_SETMASK, ¤t->checkpoint_data->blocked, NULL);
> ...
> }
>
> then in do_restore_coord():
>
> if (ctx->uflags & RESTART_TASKSELF) {
> ret = pre_restore_task();
> ckpt_debug("pre restore task: %d\n", ret);
> if (ret < 0)
> goto out;
> ...
> out:
> if (ctx->uflags & RESTART_TASKSELF)
> post_restore_task();
>
> But if we got -ENOMEM from pre_restore_task() then I think there will be a
> NULL dereference.
But the very first thing post_restore_task() does is
/* can happen if restart failed early */
if (!current->checkpoint_data)
return;
-serge
next prev parent reply other threads:[~2009-10-08 14:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-07 23:47 [PATCH 1/1] don't call pre_restore_task twice Serge E. Hallyn
[not found] ` <20091007234750.GA6881-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-08 3:09 ` Matt Helsley
[not found] ` <20091008030919.GH18101-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-10-08 14:12 ` Serge E. Hallyn [this message]
[not found] ` <20091008141258.GA21486-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-08 18:49 ` Matt Helsley
2009-10-08 18:03 ` Dan Smith
[not found] ` <871vldg3uz.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-10-08 18:19 ` Serge E. Hallyn
2009-10-14 22:24 ` Oren Laadan
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=20091008141258.GA21486@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.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