Messages in this thread |  | | | From | KOSAKI Motohiro <> | | Subject | Re: [PATCH] proc: pagemap: Hold mmap_sem during page walk | | Date | Thu, 1 Apr 2010 14:54:43 +0900 (JST) |
| |
> > So Matt, please actually address the _bug_ I pointed out rather than talk > > about other things. And yes, getting rid of the vma accesses sounds like > > it would fix it best. If that means that it doesn't work for hugepages, so > > be it. > > That'd actually take us back to where it was when it hit mainline, which > would make a lot of people unhappy. I wouldn't be one of them as there > thankfully aren't any huge pages in my world. But I'm convinced > put_user() must go. In which case, get_user_pages() stays, and I've got > to switch things to direct physical page access into that array.
no. direct physical page access for /proc is completely wrong idea, i think. please imazine the caller process is multi threaded and it use fork case,
example scenario) 1. the parent process has thread-A and thread-B. 2. thread-A call read_pagemap 3. read_pagemap grab the page-C 3. at the same time, thread-B call fork(), now page-C pointed from two process. 4. thread-B touch page-C, cow occur, then the parent process has cowed page (page-C') and the child process has original page-C. 5. thread-A write page-C by physical page access, then the child page is modified, instead parent one.
I just recommend simply do double buffering.
thanks.
> Even if I fix that, I believe San's original bug can still be triggered > though, as all the new callers to find_vma are run outside of the > target's mm_sem. Fixing that should be reasonably straight-forward.
|  |