From: Bryan Donlan <bdonlan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, Ulrich Drepper <drepper@redhat.com>,
linux-api@vger.kernel.org
Subject: Re: [resend][PATCH] Added PR_SET_PROCTITLE_AREA option for prctl()
Date: Fri, 9 Oct 2009 22:57:14 -0400 [thread overview]
Message-ID: <3e8340490910091957t21eb16e0r63eba2314ddb83a8@mail.gmail.com> (raw)
In-Reply-To: <20091009194250.eb76e338.akpm@linux-foundation.org>
On Fri, Oct 9, 2009 at 10:42 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
>> >> + __ __ __ __ __ __ __ __ __ __ __ __ __ __ res += access_process_vm(task, mm->env_start,
>
> Your email client is converting tabs to non-ascii crap. gmail. Sigh.
Weird ... I'll have to see if I can do something about that :/
> OK.
>
> But there's no way in which the reader of either the patch or the
> resulting code can discover this subtlety.
I didn't write the log message or the code - I just mentioned these
same issues back in the lkml thread :) But yes, this should be
mentioned somewhere.
>> The solution is to use the seqlock to detect this, and prevent the
>> secret information from ever making it back to process B's userspace.
>> Note that it's not enough to just recheck arg_start, as process A may
>> reassign the proctitle area back to its original position after having
>> it somewhere else for a while.
>
> Well seqlock is _a_ solution. Another is to use a mutex or an rwsem
> around the whole operation.
>
> With the code as you propose it, what happens if a process sits in a
> tight loop running setproctitle? Do other processes running `ps' get
> stuck in a livelock until the offending process gets scheduled out?
It does seem like a maximum spin count should be put in there - and
maybe a timeout as well (since with FUSE etc it's possible to engineer
page faults that take arbitrarily long).
Also, it occurs to me that:
> + do {
> + seq = read_seqbegin(&mm->arg_lock);
> +
> + len = mm->arg_end - mm->arg_start;
> + if (len > PAGE_SIZE)
> + len = PAGE_SIZE;
If arg_end or arg_start are modified after this, is it truly safe to
assume that len will remain <= PAGE_SIZE without a memory barrier
before the conditional?
next prev parent reply other threads:[~2009-10-10 2:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-09 4:50 KOSAKI Motohiro
2009-10-10 0:13 ` Andrew Morton
2009-10-10 2:22 ` Bryan Donlan
2009-10-10 2:42 ` Andrew Morton
2009-10-10 2:57 ` Bryan Donlan [this message]
2009-10-10 6:32 ` KOSAKI Motohiro
2009-10-10 6:39 ` Andrew Morton
2009-10-12 19:03 ` KOSAKI Motohiro
2009-10-12 19:22 ` Andrew Morton
2009-10-13 0:03 ` KOSAKI Motohiro
2009-10-10 7:11 ` Bryan Donlan
2009-10-12 19:03 ` KOSAKI Motohiro
2009-10-12 19:33 ` Bryan Donlan
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=3e8340490910091957t21eb16e0r63eba2314ddb83a8@mail.gmail.com \
--to=bdonlan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=drepper@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®