From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Bryan Donlan <bdonlan@gmail.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Timo Sirainen <tss@iki.fi>, Ulrich Drepper <drepper@redhat.com>,
WANG Cong <xiyou.wangcong@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: + prctl-add-pr_set_proctitle_area-option.patch added to -mm tree
Date: Tue, 10 Nov 2009 18:04:53 +0100 [thread overview]
Message-ID: <20091110170453.GA11771@redhat.com> (raw)
@@ -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?
Oleg.
next reply other threads:[~2009-11-10 17:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 17:04 Oleg Nesterov [this message]
2009-11-10 17:23 ` + prctl-add-pr_set_proctitle_area-option.patch added to -mm tree Alan Cox
2009-11-10 17:48 ` KOSAKI Motohiro
2009-11-10 18:00 ` Timo Sirainen
2009-11-11 0:43 ` KOSAKI Motohiro
-- strict thread matches above, loose matches on Subject: below --
2009-11-10 0:50 akpm
2009-11-10 0:50 akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
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=20091110170453.GA11771@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bdonlan@gmail.com \
--cc=drepper@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.