Re: Lockless/Get_User_Pages_Fast causes Xorg 1.4.99.* to lock

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hugh Dickins
Date: Monday, July 7, 2008 - 10:48 am

On Mon, 7 Jul 2008, Carsten Otte wrote:

Though it would be more obvious to use a MAP_SHARED mapping, we had that
earlier thread in which it emerged that you're not using shared writable
xip mappings, IIRC.  So, sticking to MAP_PRIVATE, I'd expect the following
sequence

ptr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, xip_fd, 0);
var = *ptr;
mprotect(ptr, PAGE_SIZE, PROT_NONE);
munmap(ptr, PAGE_SIZE);

to do a put_page on a non-existent struct page derived from the pfn:
perhaps corrupting other memory without being noticed?  Or if
you have CONFIG_DEBUG_VM=y (that would be a good move), to hit
vm_normal_page's VM_BUG_ON(!pfn_valid(pte_pfn(pte))) before that.

(I think you can just as well use PROT_READ|PROT_WRITE rather than
PROT_NONE there, but in principle mprotect could optimize away that
pte modification - though I think it goes ahead and does it anyway.)

Hugh
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Lockless/Get_User_Pages_Fast causes Xorg 1.4.99.* to lock, Martin Schwidefsky, (Mon Jul 7, 4:08 am)
Re: Lockless/Get_User_Pages_Fast causes Xorg 1.4.99.* to lock, Hugh Dickins, (Mon Jul 7, 10:48 am)