linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* broken daemonize (COW credentials?)
@ 2009-01-07 23:08 Jiri Slaby
  2009-01-08 11:15 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2009-01-07 23:08 UTC (permalink / raw)
  To: David Howells; +Cc: Linux Kernel Mailing List, James Morris

Hi,

I'm observing daemonize crashes with this code:
static struct pid *pid;
static DECLARE_COMPLETION(comp);

static int bubak(void *data)
{
        daemonize("bubak");
        while (!signal_pending(current))
                msleep_interruptible(5000);
        complete_and_exit(&comp, 0);
        return 0;
}

static int init1(void) <-- module_init function
{
        int ret;

        ret = kernel_thread(bubak, NULL, 0);
        if (ret < 0)
                return ret;
        pid = find_get_pid(ret);
	return 0;
}
----------------------- cut here -------------------

This is due to:
daemonize
 -> exit_mm
   -> tsk->mm = NULL; (i.e. current->mm)
 -> reparent_to_kthreadd
   -> commit_creds
     -> set_dumpable(task->mm, suid_dumpable); (i.e. current->mm)

The culprit is probably COW credentials. David?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: broken daemonize (COW credentials?)
  2009-01-07 23:08 broken daemonize (COW credentials?) Jiri Slaby
@ 2009-01-08 11:15 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2009-01-08 11:15 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: dhowells, Linux Kernel Mailing List, James Morris

Jiri Slaby <jirislaby@gmail.com> wrote:

> I'm observing daemonize crashes with this code:

I'm not seeing daemonize() crash, but I can see how it might - depending on
the changes to the creds made by daemonize().  commit_creds() should only call
set_dumpable() if task->mm is not NULL.

David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-08 11:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 23:08 broken daemonize (COW credentials?) Jiri Slaby
2009-01-08 11:15 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).