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

2019-05-03 Thread Alexey Dobriyan
On Fri, May 03, 2019 at 02:10:20PM -0400, Joel Savitz wrote: > +/* Get the process virtual memory size (i.e. the highest usable VM address) > */ > +#define PR_GET_TASK_SIZE 55 TASK_SIZE is in fact the lowest _un_usable address. :^)

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

2019-05-03 Thread Jann Horn
On Fri, May 3, 2019 at 2:12 PM 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. A commit message shouldn't just describe what you're doing, but also why you're doing it. Is this intended for p

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

2019-05-03 Thread Rafael Aquini
On Fri, May 03, 2019 at 02:08:31PM -0700, Yury Norov wrote: > On Fri, May 03, 2019 at 02:10:20PM -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. > > > > It is important that we acco

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

2019-05-03 Thread Rafael Aquini
On Fri, May 03, 2019 at 02:08:31PM -0700, Yury Norov wrote: > On Fri, May 03, 2019 at 02:10:20PM -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. > > > > It is important that we acco

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

2019-05-03 Thread Yury Norov
On Fri, May 03, 2019 at 02:10:20PM -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. > > It is important that we account for the case of the userspace task > running in 32-bit compat mode

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

2019-05-03 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. It is important that we account for the case of the userspace task running in 32-bit compat mode on a 64-bit kernel. As such, we must be careful to copy the correct nu