[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150527222040.GH17625@uranus.sw.swsoft.com>
Date: Thu, 28 May 2015 01:20:40 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
jarod@...hat.com, jstancek@...hat.com
Subject: Re: [PATCH 1/2] prctl: more prctl(PR_SET_MM_*) checks
On Thu, May 28, 2015 at 01:12:14AM +0300, Alexey Dobriyan wrote:
> On Thu, May 28, 2015 at 01:02:29AM +0300, Cyrill Gorcunov wrote:
> > On Thu, May 28, 2015 at 12:47:57AM +0300, Alexey Dobriyan wrote:
> > > Individual prctl(PR_SET_MM_*) calls do some checking to maintain
> > > consistent view of mm->arg_start et al fields, but not enough.
> > > In particular PR_SET_MM_ARG_START/PR_SET_MM_ARG_END/PR_SET_MM_ENV_START/PR_SET_MM_ENV_END
> > > only check that address lies in existent VMA, but doesn't check that
> > > start address is lower that end address _at all_.
> > >
> > > Consolidate all consistency checks, so there will be no difference in
> > > the future between PR_SET_MM_MAP and individual PR_SET_MM_* calls.
> > >
> > > The program below makes both ARGV and ENVP areas reverted,
> > > makes /proc/$PID/cmdline show garbage (doesn't oops by luck).
> >
> > Why should it oops?
>
> Anything can happen if you constantly write code like this
>
> unsigned long len = mm->arg_end - mm->arg_start;
>
> and expect result to be positive.
It won't 'cause proc code will limit it (this where 'luck'
comes from :). Anyway, switching to validate() helper will
make code more robust, so thank you!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists