RE: [kernel-hardening] [PATCH] [RFC] Introduce mmap randomization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Rik van Riel [mailto:riel@xxxxxxxxxx]
> Sent: Tuesday, July 26, 2016 1:12 PM
> To: kernel-hardening@xxxxxxxxxxxxxxxxxx; jason@xxxxxxxxxxxxxx; linux- 
> mm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; akpm@linux- 
> foundation.org
> Cc: keescook@xxxxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; nnk@xxxxxxxxxx; 
> jeffv@xxxxxxxxxx; salyzyn@xxxxxxxxxxx; dcashman@xxxxxxxxxxx; Roberts, 
> William C <william.c.roberts@xxxxxxxxx>
> Subject: Re: [kernel-hardening] [PATCH] [RFC] Introduce mmap 
> randomization
> 
> On Tue, 2016-07-26 at 11:22 -0700, william.c.roberts@xxxxxxxxx wrote:
> > From: William Roberts <william.c.roberts@xxxxxxxxx>
> >
> > This patch introduces the ability randomize mmap locations where the 
> > address is not requested, for instance when ld is allocating pages 
> > for shared libraries. It chooses to randomize based on the current 
> > personality for ASLR.
> >
> > Currently, allocations are done sequentially within unmapped address 
> > space gaps. This may happen top down or bottom up depending on scheme.
> >
> > For instance these mmap calls produce contiguous mappings:
> > int size = getpagesize();
> > mmap(NULL, size, flags, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> > 0x40026000
> > mmap(NULL, size, flags, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> > 0x40027000
> >
> > Note no gap between.
> >
> > After patches:
> > int size = getpagesize();
> > mmap(NULL, size, flags, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> > 0x400b4000
> > mmap(NULL, size, flags, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> > 0x40055000
> >
> > Note gap between.
> 
> I suspect this randomization will be more useful for file mappings 
> than for anonymous mappings.
> 
> I don't know whether there are downsides to creating more anonymous 
> VMAs than we have to, with malloc libraries that may perform various 
> kinds of tricks with mmap for their own performance reasons.
> 
> Does anyone have convincing reasons why mmap randomization should do 
> both file and anon, or whether it should do just file mappings?

Throwing this out there, but If you're mmap'ing buffers at known offsets in the
program then folks know where to write/modify.

Jason Cooper mentioned using a KConfig around this (amongst other things) which perhaps
Controlling this at a better granularity would be beneficial.

> 
> --
> All rights reversed
��.n������g����a����&ޖ)���)��h���&������梷�����Ǟ�m������)������^�����������v���O��zf������




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]