Linux Container Development
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [C/R]: mktree.c: cr_set_creator() question
Date: Wed, 8 Apr 2009 21:43:48 -0700	[thread overview]
Message-ID: <20090409044348.GA19748@us.ibm.com> (raw)

Oren:

I was trying to run the ptree test I had posted earlier with v14-rc3
and get a SIGSEGV in mktree (when restarting a simple process tree).

The SIGSEGV is due to 'creator' being NULL @ mktree.c:585.

I debugged it a bit and was not clear on the following 'task-ppid == 1'
check. It seems to check for orphaned processes using 'ppid == 1',
but 'ppid == 1' could be 1 if the 'task' was an actual child of the
container-init right ?

Also, 'phantom' does not seem to be set anywhere and so 'creator'
ends up being NULL.

Since in my case, 'task' refers to an actual child of container-init,
I reversed the order of the following two checks as a quick hack, and
it seems to fix the SIGSEGV. 

[v14-rc3] mktree.c: cr_set_creator() (lines 543-553)

        } else if (task->ppid == 1) {
                /* (non-session-leader) orphan: creator is dummy */
                cr_dbg("pid %d: orphan session %d\n", task->pid, task->sid);
                if (!session->phantom)
                        if (cr_placeholder_task(ctx, task) < 0)
                                return -1;
                creator = session->phantom;
        } else if (task->sid == parent->sid) {
                /* (non-session-leader) inherit: creator is parent */
                cr_dbg("pid %d: inherit sid %d\n", task->pid, task->sid);
                creator = parent;


Sukadev

             reply	other threads:[~2009-04-09  4:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09  4:43 Sukadev Bhattiprolu [this message]
     [not found] ` <20090409044348.GA19748-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-12  3:14   ` [C/R]: mktree.c: cr_set_creator() question 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=20090409044348.GA19748@us.ibm.com \
    --to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@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