[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+rthh-aQeT8jaQ1xKWjG8JTQwYx3scpfVK3hu4uDr-8BgV+zQ@mail.gmail.com>
Date: Fri, 29 Apr 2016 07:59:00 +0200
From: Mathias Krause <minipli@...glemail.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Emese Revfy <re.emese@...il.com>,
Pax Team <pageexec@...email.hu>,
Al Viro <viro@...iv.linux.org.uk>,
Mateusz Guzik <mguzik@...hat.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Jarod Wilson <jarod@...hat.com>
Subject: Re: [PATCH] proc: prevent accessing /proc/<PID>/environ until it's ready
On 28 April 2016 at 23:26, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Thu, 28 Apr 2016 21:04:18 +0200 Mathias Krause <minipli@...glemail.com> wrote:
>
>> If /proc/<PID>/environ gets read before the envp[] array is fully set
>> up in create_{aout,elf,elf_fdpic,flat}_tables(), we might end up trying
>> to read more bytes than are actually written, as env_start will already
>> be set but env_end will still be zero, making the range calculation
>> underflow, allowing to read beyond the end of what has been written.
>>
>> Fix this as it is done for /proc/<PID>/cmdline by testing env_end for
>> zero. It is, apparently, intentionally set last in create_*_tables().
>>
>> This bug was found by the PaX size_overflow plugin that detected the
>> arithmetic underflow of 'this_len = env_end - (env_start + src)' when
>> env_end is still zero.
>
> So what are the implications of this? From my reading, a craftily
> constructed application could occasionally read arbitrarily large
> amounts of kernel memory?
I don't think access_remote_vm() is capable of that. So, the only
consequence is, userland trying to access /proc/<PID>/environ of a not
yet fully set up process may get inconsistent data as we're in the
middle of copying in the environment variables.
Regards,
Mathias
Powered by blists - more mailing lists