This patch does a few cleanups/fixes with __verify_write: - Only comile it when needed. - Move test for KERNEL_DS out of line. - The mmap semaphore is needed to access the vma list. - Use fixmap for the WP test. - Removes an obsolete comment in fixmap.h In addion, I've found a possible bug with writes to userspace on real 386's. Without holding the mmap semaphore, it is possible to get preempted or go to sleep on a page fault, and then have another thread mark the page read-only. A 386 would continue to write to the page when the first thread woke up again. We need to prevent anyone from changing the page permissions until we are done writing to userspace. My suggestion is to replace access_ok() with begin_user_{read,write}(), and add end_user_{read,write}(). Thoughs? -- Brian Gerst