Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Jann Horn
On Thu, Oct 8, 2020 at 8:10 PM Topi Miettinen wrote: > On 8.10.2020 20.13, Jann Horn wrote: > > On Thu, Oct 8, 2020 at 6:54 PM Topi Miettinen wrote: > >> Writing a new value of 3 to /proc/sys/kernel/randomize_va_space > >> enables full randomization of memory mappings created with mmap(NULL, > >>

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Topi Miettinen
On 8.10.2020 20.07, Matthew Wilcox wrote: On Thu, Oct 08, 2020 at 07:54:08PM +0300, Topi Miettinen wrote: +3 Additionally enable full randomization of memory mappings created +with mmap(NULL, ...). With 2, the base of the VMA used for such +mappings is random, but the mappings are crea

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Topi Miettinen
On 8.10.2020 20.13, Jann Horn wrote: On Thu, Oct 8, 2020 at 6:54 PM Topi Miettinen wrote: Writing a new value of 3 to /proc/sys/kernel/randomize_va_space enables full randomization of memory mappings created with mmap(NULL, ...). With 2, the base of the VMA used for such mappings is random, but

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Matthew Wilcox
On Thu, Oct 08, 2020 at 07:26:31PM +0200, Jann Horn wrote: > On Thu, Oct 8, 2020 at 7:23 PM Matthew Wilcox wrote: > > On Thu, Oct 08, 2020 at 07:13:51PM +0200, Jann Horn wrote: > > > And for expanding stacks, it might be a good idea for other > > > reasons as well (locking consistency) to refactor

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Jann Horn
On Thu, Oct 8, 2020 at 7:23 PM Matthew Wilcox wrote: > On Thu, Oct 08, 2020 at 07:13:51PM +0200, Jann Horn wrote: > > And for expanding stacks, it might be a good idea for other > > reasons as well (locking consistency) to refactor them such that the > > size in the VMA tree corresponds to the max

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Matthew Wilcox
On Thu, Oct 08, 2020 at 07:13:51PM +0200, Jann Horn wrote: > You may want to consider whether it would be better to store > information about free memory per subtree in the VMA tree, together > with the maximum gap size that is already stored in each node, and > then walk down the tree randomly, wi

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Jann Horn
On Thu, Oct 8, 2020 at 6:54 PM Topi Miettinen wrote: > Writing a new value of 3 to /proc/sys/kernel/randomize_va_space > enables full randomization of memory mappings created with mmap(NULL, > ...). With 2, the base of the VMA used for such mappings is random, > but the mappings are created in pre

Re: [PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Matthew Wilcox
On Thu, Oct 08, 2020 at 07:54:08PM +0300, Topi Miettinen wrote: > +3 Additionally enable full randomization of memory mappings created > +with mmap(NULL, ...). With 2, the base of the VMA used for such > +mappings is random, but the mappings are created in predictable > +places within

[PATCH RESEND v2] mm: Optional full ASLR for mmap() and mremap()

2020-10-08 Thread Topi Miettinen
Writing a new value of 3 to /proc/sys/kernel/randomize_va_space enables full randomization of memory mappings created with mmap(NULL, ...). With 2, the base of the VMA used for such mappings is random, but the mappings are created in predictable places within the VMA and in sequential order. With 3