lkml.org 
[lkml]   [2018]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH] Randomization of address chosen by mmap.
From
Date

> On 4 Mar 2018, at 23:56, Matthew Wilcox <willy@infradead.org> wrote:
> Thinking about this more ...
>
> - When you call munmap, if you pass in the same (addr, length) that were
> used for mmap, then it should unmap the guard pages as well (that
> wasn't part of the patch, so it would have to be added)
> - If 'addr' is higher than the mapped address, and length at least
> reaches the end of the mapping, then I would expect the guard pages to
> "move down" and be after the end of the newly-shortened mapping.
> - If 'addr' is higher than the mapped address, and the length doesn't
> reach the end of the old mapping, we split the old mapping into two.
> I would expect the guard pages to apply to both mappings, insofar as
> they'll fit. For an example, suppose we have a five-page mapping with
> two guard pages (MMMMMGG), and then we unmap the fourth page. Now we
> have a three-page mapping with one guard page followed immediately
> by a one-page mapping with two guard pages (MMMGMGG).

I’m analysing that approach and see much more problems:
- each time you call mmap like this, you still increase count of vmas as my
patch did
- now feature vma_merge shouldn’t work at all, until MAP_FIXED is set or
PROT_GUARD(0)
- the entropy you provide is like 16 bit, that is really not so hard to brute
- in your patch you don’t use vm_guard at address searching, I see many roots
of bugs here
- if you unmap/remap one page inside region, field vma_guard will show head
or tail pages for vma, not both; kernel don’t know how to handle it
- user mode now choose entropy with PROT_GUARD macro, where did he gets it?
User mode shouldn’t be responsible for entropy at all

I can’t understand what direction this conversation is going to. I was talking
about weak implementation in Linux kernel but got many comments about ASLR
should be implemented in user mode what is really weird to me.

I think it is possible to add GUARD pages into my implementations, but initially
problem was about entropy of address choosing. I would like to resolve it step by
step.

Thanks,
Ilya
\
 
 \ /
  Last update: 2018-03-05 14:10    [W:0.148 / U:1.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site