Re: [RFC PATCH v2 0/2] Randomization of address chosen by mmap.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Rich Felker <dalias@xxxxxxxx>
- Subject: Re: [RFC PATCH v2 0/2] Randomization of address chosen by mmap.
- From: Matthew Wilcox <willy@xxxxxxxxxxxxx>
- Date: Fri, 23 Mar 2018 12:29:52 -0700
- Cc: Ilya Smith <blackzert@xxxxxxxxx>, rth@xxxxxxxxxxx, ink@xxxxxxxxxxxxxxxxxxxx, mattst88@xxxxxxxxx, vgupta@xxxxxxxxxxxx, linux@xxxxxxxxxxxxxxx, tony.luck@xxxxxxxxx, fenghua.yu@xxxxxxxxx, jhogan@xxxxxxxxxx, ralf@xxxxxxxxxxxxxx, jejb@xxxxxxxxxxxxxxxx, deller@xxxxxx, benh@xxxxxxxxxxxxxxxxxxx, paulus@xxxxxxxxx, mpe@xxxxxxxxxxxxxx, schwidefsky@xxxxxxxxxx, heiko.carstens@xxxxxxxxxx, ysato@xxxxxxxxxxxxxxxxxxxx, davem@xxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, hpa@xxxxxxxxx, x86@xxxxxxxxxx, nyc@xxxxxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, arnd@xxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, deepa.kernel@xxxxxxxxx, mhocko@xxxxxxxx, hughd@xxxxxxxxxx, kstewart@xxxxxxxxxxxxxxxxxxx, pombredanne@xxxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx, steve.capper@xxxxxxx, punit.agrawal@xxxxxxx, paul.burton@xxxxxxxx, aneesh.kumar@xxxxxxxxxxxxxxxxxx, npiggin@xxxxxxxxx, keescook@xxxxxxxxxxxx, bhsharma@xxxxxxxxxx, riel@xxxxxxxxxx, nitin.m.gupta@xxxxxxxxxx, kirill.shutemov@xxxxxxxxxxxxxxx, dan.j.williams@xxxxxxxxx, jack@xxxxxxx, ross.zwisler@xxxxxxxxxxxxxxx, jglisse@xxxxxxxxxx, aarcange@xxxxxxxxxx, oleg@xxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-metag@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
- In-reply-to: <20180323191621.GC1436@brightrain.aerifal.cx>
- References: <1521736598-12812-1-git-send-email-blackzert@gmail.com> <20180323124806.GA5624@bombadil.infradead.org> <20180323180024.GB1436@brightrain.aerifal.cx> <20180323190618.GA23763@bombadil.infradead.org> <20180323191621.GC1436@brightrain.aerifal.cx>
- User-agent: Mutt/1.9.2 (2017-12-15)
On Fri, Mar 23, 2018 at 03:16:21PM -0400, Rich Felker wrote:
> > Huh, I thought libc was aware of this. Also, I'd expect a libc-based
> > implementation to restrict itself to, eg, only loading libraries in
> > the bottom 1GB to avoid applications who want to map huge things from
> > running out of unfragmented address space.
>
> That seems like a rather arbitrary expectation and I'm not sure why
> you'd expect it to result in less fragmentation rather than more. For
> example if it started from 1GB and worked down, you'd immediately
> reduce the contiguous free space from ~3GB to ~2GB, and if it started
> from the bottom and worked up, brk would immediately become
> unavailable, increasing mmap pressure elsewhere.
By *not* limiting yourself to the bottom 1GB, you'll almost immediately
fragment the address space even worse. Just looking at 'ls' as a
hopefully-good example of a typical app, it maps:
linux-vdso.so.1 (0x00007ffef5eef000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fb3657f5000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb36543b000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fb3651c9000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb364fc5000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb365c3f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb364da7000)
The VDSO wouldn't move, but look at the distribution of mapping 6 things
into a 3GB address space in random locations. What are the odds you have
a contiguous 1GB chunk of address space? If you restrict yourself to the
bottom 1GB before running out of room and falling back to a sequential
allocation, you'll prevent a lot of fragmentation.
--
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]