Skip to contentSkip to conversation

[[email protected]: Re: 2.6.5-rc2-aa vma merging]

[email protected]: Re: 2.6.5-rc2-aa vma merging Andrea Arcangeli 2 participants 3 messages Mar 29, 2004 – Mar 30, 2004

lore
Share & tools
lore
#0 lore raw

though it was a private email.

----- Forwarded message from Andrea Arcangeli <[email protected]> -----

Date: Tue, 30 Mar 2004 00:32:30 +0200
From: Andrea Arcangeli <[email protected]>
To: Hugh Dickins <[email protected]>
Subject: Re: 2.6.5-rc2-aa vma merging

Quoted 8 lines · Hugh Dickins

Andrea,

Again I beg you to attend to vma merging in your anon_vma tree. Still you have #if VMA_MERGING_FIXUP throughout mm/mprotect.c (and much less seriously in mremap.c), and that's just masking the real problem: that when you do enable vma merging there, your anon_vmas will get in the way of merging in significant cases.

Quoted 8 lines

Try the example below, on mainline and on anonmm and on anon_vma, even when you've done the VMA_MERGING_FIXUP: you're limited by the MAX_MAP_COUNT of vmas, one per page. Now, I know there's a move afoot to have /proc/sys/vm/max_map_count tunable, but I don't think that's the right answer for you ;)

If I remember rightly, Linus tried to do away with a lot of the vma merging about three years ago, but some had to be reinstated.

it was me to reistantiate it. And it wasn't for mprotect. Infact it was me adding it to mprotect and mremap too, it has never been there before (the day I did mprotect and mremap I got bored at some point and that's why we never had it for mlock yet).

Quoted 2 lines

So I assume that what's there is needed, and the example below does looks plausible enough: add page, fill it, protect it, ...

this will work perfect, absolutely perfect. You didn't read my code well enough.

You still can write an exploit for it, but it will not be a real life one.

----- End forwarded message -----

#1 lore raw
Quoted 7 lines · Andrea Arcangeli
Quoted 2 lines · Hugh Dickins

So I assume that what's there is needed, and the example below does looks plausible enough: add page, fill it, protect it, ...

this will work perfect, absolutely perfect. You didn't read my code well enough.

Sure, and I most certainly haven't read your future code well enough. Your present implementation, one vma per page (in that real case where vmas are properly merged by mainline or anonmm), is far from perfect.

anon_vma has surprised me more than once by working smoothly just where I thought it must go wrong. Please do surprise me again:
write that code and post the patch which resolves this doubt.

Thanks,
Hugh

#2 lore raw
Quoted 9 lines · Hugh Dickins
Quoted 7 lines · Andrea Arcangeli
Quoted 2 lines · Hugh Dickins

So I assume that what's there is needed, and the example below does looks plausible enough: add page, fill it, protect it, ...

this will work perfect, absolutely perfect. You didn't read my code well enough.

Quoted 7 lines

Sure, and I most certainly haven't read your future code well enough. Your present implementation, one vma per page (in that real case where vmas are properly merged by mainline or anonmm), is far from perfect.

anon_vma has surprised me more than once by working smoothly just where I thought it must go wrong. Please do surprise me again:
write that code and post the patch which resolves this doubt.

I will, it just wasn't high prio enough at this time (I mean, I still have pending some prio-tree bit to fixup with the xfs, that was higher prio since it impacts functionality, and the mremap race may also be higher prio).

My point is that merging in your program will work fine, this is what matters to me, it doesn't right now because I didn't fixup the merging code yet, but there's nothing that will prevent your program to use just 1 single vma for the whole thing (after I fixup the merging code ;). The bonus is that after I fixup the merging, it'll use 1 vma even for the file mappings, not just for anonymous memory, something that is not true with anonmm (and the complexity of doing file merging or anon-vma merging is the same, so I will do both at the same cost).