public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, nhorman@tuxdriver.com,
	abelay@mit.edu, benh@kernel.crashing.org,
	drbd-dev@lists.linbit.com, gregkh@suse.de, jmoskovc@redhat.com,
	menage@google.com, mfasheh@suse.com, mingo@redhat.com,
	neilb@suse.de, shemminger@linux-foundation.org, spock@gentoo.org,
	t.sailer@alumni.ethz.ch, takedakn@nttdata.co.jp,
	viro@zeniv.linux.org.uk
Subject: Re: + exec-allow-core_pipe-recursion-check-to-look-for-a-value-of-1-rather -than-0.patch added to -mm tree
Date: Wed, 27 Jan 2010 18:47:06 +0100	[thread overview]
Message-ID: <20100127174706.GA6333@redhat.com> (raw)
In-Reply-To: <201001262354.o0QNsBiM029772@imap1.linux-foundation.org>

On 01/26, Andrew Morton wrote:
>
> From: Neil Horman <nhorman@tuxdriver.com>
>
> What I've done is modify the
> call_usermodehelper() api such that an extra parameter is added, a
> function pointer which will be called by the user helper task, after it
> forks, but before it execs the required process.

Personally I agree, I think this fptr can be useful, not only for coredump.

> This will give the
> caller the opportunity to get a callback in the process's context,
> allowing it to do whatever it needs to to the process in the kernel

in this case it probably needs "void *data" argument, otherwise the
usage is very limited.

Currently only d_coredump() needs this new feature, but please note
that ____call_usermodehelper() was already "uglified" for the coredumping
over the pipe.

If we add sub_info->finit(), then probably we should move the code
under "if (sub_info->stdin)" from ____call_usermodehelper() to
core_pipe_setup() ?

> +/*
> + * This is used as a helper to set up the task that execs
> + * our user space core collector application
> + * Its called in the context of the task thats going to
> + * exec itself to be the helper, so we can modify current here
> + */

very minor nit, perhaps the comment should explain what is the meaning
of the magical rlim_cur = 1 value? It is not immediately obvious we
check cprm.limit == 1 below.

> +void core_pipe_setup(void)
> +{
> +	task_lock(current->group_leader);
> +	current->signal->rlim[RLIMIT_CORE].rlim_cur = 1;
> +	task_unlock(current->group_leader);
> +}

Well, this thread must be the kernel thread and thus it should be
->group_leader and I don't think we really need task_lock() her,
but this is minor and perhaps ->group_leader + task_lock() look
better even if not needed.

Oleg.


       reply	other threads:[~2010-01-27 17:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201001262354.o0QNsBiM029772@imap1.linux-foundation.org>
2010-01-27 17:47 ` Oleg Nesterov [this message]
2010-01-27 17:58   ` + exec-allow-core_pipe-recursion-check-to-look-for-a-value-of-1-rather -than-0.patch added to -mm tree Oleg Nesterov
2010-01-27 21:22     ` Neil Horman
2010-01-27 21:34       ` Andrew Morton
2010-01-27 23:08         ` nhorman
2010-01-27 21:25   ` Neil Horman

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=20100127174706.GA6333@redhat.com \
    --to=oleg@redhat.com \
    --cc=abelay@mit.edu \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=drbd-dev@lists.linbit.com \
    --cc=gregkh@suse.de \
    --cc=jmoskovc@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=mfasheh@suse.com \
    --cc=mingo@redhat.com \
    --cc=neilb@suse.de \
    --cc=nhorman@tuxdriver.com \
    --cc=shemminger@linux-foundation.org \
    --cc=spock@gentoo.org \
    --cc=t.sailer@alumni.ethz.ch \
    --cc=takedakn@nttdata.co.jp \
    --cc=viro@zeniv.linux.org.uk \
    /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