Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1548783 > unrolled thread

Re: [RFC 4/4] x86/arch_prctl: add ARCH_{GET,SET}_TASK_SIZE

Started byAndy Lutomirski <luto@amacapital.net>
First post2016-12-31 03:10 +0100
Last post2016-12-31 12:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC 4/4] x86/arch_prctl: add ARCH_{GET,SET}_TASK_SIZE Andy Lutomirski <luto@amacapital.net> - 2016-12-31 03:10 +0100
    Re: [RFC 4/4] x86/arch_prctl: add ARCH_{GET,SET}_TASK_SIZE Dmitry Safonov <0x7f454c46@gmail.com> - 2016-12-31 12:20 +0100

#1548783 — Re: [RFC 4/4] x86/arch_prctl: add ARCH_{GET,SET}_TASK_SIZE

FromAndy Lutomirski <luto@amacapital.net>
Date2016-12-31 03:10 +0100
SubjectRe: [RFC 4/4] x86/arch_prctl: add ARCH_{GET,SET}_TASK_SIZE
Message-ID<sUhho-57Y-1@gated-at.bofh.it>
On Fri, Dec 30, 2016 at 7:56 AM, Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> Add arch_prctl getters/setters for size of virtual address space of task.
> This adds ability to change task's virtual address space limit.
> I need this for correctly restore virtual address space limits in CRIU.
> Currently, on x86 there are three task sizes: 3GB for some old 32 bit java
> apps, 4Gb for ordinary 32-bit compatible apps and 47-bits for native
> x86_64 processes.
> 32-bit applications are restored by CRIU with the help of 64-bit clone()-d
> child, and on restore we need to place correct address space limitations
> back - otherwise 32-bit restored application may mmap() address over
> 4Gb space and as this address will not fit into 4-byte pointer, it
> will silently reuse/corrupt the pointer that has the same lower 4-bytes.
>

I agree we need something like this, but this particular justification
is a bit bogus.  If 32-bit mmap() returns an address above 2^32, then
I think it's a straight-up bug.  The address space limit shouldn't
have anything to do with  it -- the kernel *knows* that it's a
"compat" syscall.

[toc] | [next] | [standalone]


#1548802

FromDmitry Safonov <0x7f454c46@gmail.com>
Date2016-12-31 12:20 +0100
Message-ID<sUpRE-2d9-9@gated-at.bofh.it>
In reply to#1548783
Hi Andy,
thanks for reviewing!

2016-12-31 5:02 GMT+03:00 Andy Lutomirski <luto@amacapital.net>:
> On Fri, Dec 30, 2016 at 7:56 AM, Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>> Add arch_prctl getters/setters for size of virtual address space of task.
>> This adds ability to change task's virtual address space limit.
>> I need this for correctly restore virtual address space limits in CRIU.
>> Currently, on x86 there are three task sizes: 3GB for some old 32 bit java
>> apps, 4Gb for ordinary 32-bit compatible apps and 47-bits for native
>> x86_64 processes.
>> 32-bit applications are restored by CRIU with the help of 64-bit clone()-d
>> child, and on restore we need to place correct address space limitations
>> back - otherwise 32-bit restored application may mmap() address over
>> 4Gb space and as this address will not fit into 4-byte pointer, it
>> will silently reuse/corrupt the pointer that has the same lower 4-bytes.
>>
>
> I agree we need something like this, but this particular justification
> is a bit bogus.  If 32-bit mmap() returns an address above 2^32, then
> I think it's a straight-up bug.  The address space limit shouldn't
> have anything to do with  it -- the kernel *knows* that it's a
> "compat" syscall.

Yep, I guess, I didn't realize that the real wrong thing is that
compat syscall returns address above 4Gb and not the address
space limits here. Thanks, will look into that.

-- 
             Dmitry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web