RE: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-03 Thread David Laight
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)

Re: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-03 Thread Cyrill Gorcunov
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

Re: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-02 Thread Yury Norov
чт, 2 мая 2019 г. в 13:52, Joel Savitz : > > When PR_GET_TASK_SIZE is passed to prctl, the kernel will attempt to > copy the value of TASK_SIZE to the userspace address in arg2. > > Suggested-by: Alexey Dobriyan > Signed-off-by: Joel Savitz > --- > include/uapi/linux/prctl.h | 3 +++ >

Re: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-02 Thread Joel Savitz
> 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?

Re: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-02 Thread Rafael Aquini
On Thu, May 02, 2019 at 04:52:21PM -0400, Joel Savitz wrote: > When PR_GET_TASK_SIZE is passed to prctl, the kernel will attempt to > copy the value of TASK_SIZE to the userspace address in arg2. > > Suggested-by: Alexey Dobriyan > Signed-off-by: Joel Savitz > --- > include/uapi/linux/prctl.h

Re: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-02 Thread Cyrill Gorcunov
On Thu, May 02, 2019 at 04:52:21PM -0400, Joel Savitz wrote: > > +static int prctl_get_tasksize(void __user * uaddr) > +{ > + unsigned long task_size = TASK_SIZE; > + return copy_to_user(uaddr, _size, sizeof(unsigned long)) > + ? -EFAULT : 0; > +} Won't be possible

[PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2)

2019-05-02 Thread Joel Savitz
When PR_GET_TASK_SIZE is passed to prctl, the kernel will attempt to copy the value of TASK_SIZE to the userspace address in arg2. Suggested-by: Alexey Dobriyan Signed-off-by: Joel Savitz --- include/uapi/linux/prctl.h | 3 +++ kernel/sys.c | 10 ++ 2 files changed, 13