[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-api
Subject:    Re: [PATCH v5] Added PR_SET_PROCTITLE_AREA option for prctl()
From:       KOSAKI Motohiro <kosaki.motohiro () jp ! fujitsu ! com>
Date:       2009-11-10 11:06:31
Message-ID: 2f11576a0911100306k7e2a64b9r35e13454be858140 () mail ! gmail ! com
[Download RAW message or body]

2009/11/10 Bryan Donlan <bdonlan@gmail.com>:
> On Mon, Nov 9, 2009 at 5:47 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
>
>> What happens if userspace unmaps the memory after telling the kernel to
>> use it?
>>
>> Will processes which try to read the command line get an error reading
>> /proc?  If so, do all the commandline-reading programs in the world
>> handle this in an appropriate fashion?
>
> This case can already occur in the current code; the userspace process
> would have to munmap() the top of its stack, but it certainly can do
> so if it tries. In any case, access_process_vm() then returns 0
> because of the fault, and thus /proc/pid/cmdline is seen to have zero
> length. Since a zero-length /proc/pid/cmdline occurs with kernel
> threads as well, we know this isn't a problem.

Plus, ps can read under exiting process. In this case, task->mm is NULL and
proc_pid_cmdline return 0.

procps tools are already NUL safe since long time ago.
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic