mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Bryan Donlan <bdonlan@gmail.com>, Timo Sirainen <tss@iki.fi>,
	Ulrich Drepper <drepper@redhat.com>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: + prctl-add-pr_set_proctitle_area-option.patch added to -mm tree
Date: Wed, 11 Nov 2009 02:48:49 +0900	[thread overview]
Message-ID: <2f11576a0911100948o79970e44t197cd2978428de1a@mail.gmail.com> (raw)
In-Reply-To: <20091110170453.GA11771@redhat.com>

2009/11/11 Oleg Nesterov <oleg@redhat.com>:
> @@ -1424,6 +1424,28 @@ static void k_getrusage(struct task_stru
>                        } while (t != p);
>                        break;
>
> +               case PR_SET_PROCTITLE_AREA: {
> +                       struct mm_struct *mm = current->mm;
> +                       unsigned long addr = arg2;
> +                       unsigned long len = arg3;
> +                       unsigned long end = arg2 + arg3;
> +
> +                       if (len > PAGE_SIZE)
> +                               return -EINVAL;
> +
> +                       if (addr >= end)
> +                               return -EINVAL;
> +
> +                       if (!access_ok(VERIFY_READ, addr, len))
> +                               return -EFAULT;
> +
> +                       mutex_lock(&mm->arg_lock);
> +                       mm->arg_start = addr;
> +                       mm->arg_end = end;
> +                       mutex_unlock(&mm->arg_lock);
>
> This looks like the merging error, I guess this code should go into
> sys_prct(), not k_getrusage().
>
>
> The patch adds mm_struct->arg_lock mutex. Can't we reuse mm->mmap_sem?
> A bit ugly to have mm->arg_lock just to synchronize sys_prctl() and
> proc_pid_cmdline(), imho.
>
> Yes, we can't do access_process_vm() under ->mmap_sem, but we can add
> the new helper, say, access_process_vm_locked(tsk, mm, ...) which does
> the actual work. Then proc_pid_cmdline() can take mmap_sem for reading,
> read arg_start/arg_end and call access_process_vm_locked().
>
> No?

There is unwritten reason. I hope to add /proc/[pid]/cmdline cache. It
help to avoid
ps getting stuck by mmap_sem.
But, I can accept your proposal on 2.6.32 timeframe. so, I'll make
this patch again.

Andrew, can you please drop this patch at once?

  parent reply	other threads:[~2009-11-10 17:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 17:04 Oleg Nesterov
2009-11-10 17:23 ` Alan Cox
2009-11-10 17:48 ` KOSAKI Motohiro [this message]
2009-11-10 18:00   ` Timo Sirainen
2009-11-11  0:43     ` KOSAKI Motohiro

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=2f11576a0911100948o79970e44t197cd2978428de1a@mail.gmail.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=bdonlan@gmail.com \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=tss@iki.fi \
    --cc=xiyou.wangcong@gmail.com \
    /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®