[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6cf43408000149d98cc1683943c436cb@AcuMS.aculab.com>
Date: Fri, 3 May 2019 11:31:40 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Cyrill Gorcunov' <gorcunov@...il.com>,
Joel Savitz <jsavitz@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
"Masami Hiramatsu" <mhiramat@...nel.org>,
Waiman Long <longman@...hat.com>,
"Mauro Carvalho Chehab" <mchehab+samsung@...nel.org>,
Kristina Martsenko <kristina.martsenko@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
YueHaibing <yuehaibing@...wei.com>,
Micah Morton <mortonm@...omium.org>,
Yang Shi <yang.shi@...ux.alibaba.com>,
Jann Horn <jannh@...gle.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Rafael Aquini <aquini@...hat.com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Yury Norov <norov.maillist@...il.com>
Subject: RE: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to
prctl(2)
From: Cyrill Gorcunov
> Sent: 03 May 2019 09:32
> On Thu, May 02, 2019 at 05:46:08PM -0400, Joel Savitz wrote:
> > > Won't be possible to use put_user here? Something like
> > >
> > > static int prctl_get_tasksize(unsigned long __user *uaddr)
> > > {
> > > return put_user(TASK_SIZE, uaddr) ? -EFAULT : 0;
> > > }
> >
> > What would be the benefit of using put_user() over copy_to_user() in
> > this context?
>
> It is a common pattern to use put_user with native types, where
> copy_to_user more biased for composed types transfer.
It also removes all the crappy code that checks whether the
kernel buffer is valid.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists