mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework
@ 2005-12-02  0:11 Blaisorblade
  2005-12-03 10:03 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Blaisorblade @ 2005-12-02  0:11 UTC (permalink / raw)
  To: Hugh Dickins, Andrew Morton; +Cc: LKML, linux-mm

I recently found a bug introduced in your commit 
65500d234e74fc4e8f18e1a429bc24e51e75de4a, i.e. between 2.6.14 and 2.6.15-rc1, 
about do_file_page changes wrt remap_file_pages and MAP_POPULATE.

Quoting from the changelog (which is wrong):

    do_file_page's fallback to do_no_page dates from a time when we were 
testing
    pte_file by using it wherever possible: currently it's peculiar to 
nonlinear
    vmas, so just check that.  BUG_ON if not?  Better not, it's probably page
    table corruption, so just show the pte: hmm, there's a pte_ERROR macro, 
let's
    use that for do_wp_page's invalid pfn too.

This is false:

do_mmap_pgoff:
        if (flags & MAP_POPULATE) {
                up_write(&mm->mmap_sem);
                sys_remap_file_pages(addr, len, 0,
                                        pgoff, flags & MAP_NONBLOCK);
                down_write(&mm->mmap_sem);
        }

So, with MAP_POPULATE|MAP_NONBLOCK passed, you can get a linear PAGE_FILE pte 
in a !VM_NONLINEAR vma.

That PTE is very useless since it doesn't add any information, I know that, so 
avoiding that possible installation is a possible fix, but for now it's 
simpler to change the test in do_file_page(). Btw, in fact I discovered this 
bug while I was implementing this optimization (working again on 
remap_file_pages() patches of this summer).

Indeed, the condition to test (and to possibly BUG_ON/pte_ERROR) is that 
->populate must exist for the sys_remap_file_pages call to work.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework
  2005-12-02  0:11 [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework Blaisorblade
@ 2005-12-03 10:03 ` Hugh Dickins
  2005-12-03 12:06   ` Sorry (was: Re: [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework) Blaisorblade
  0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2005-12-03 10:03 UTC (permalink / raw)
  To: Blaisorblade; +Cc: Andrew Morton, LKML, linux-mm

On Fri, 2 Dec 2005, Blaisorblade wrote:
> I recently found a bug introduced in your commit 
> 65500d234e74fc4e8f18e1a429bc24e51e75de4a, i.e. between 2.6.14 and 2.6.15-rc1, 
> about do_file_page changes wrt remap_file_pages and MAP_POPULATE.
> 
> Quoting from the changelog (which is wrong):
> 
>     do_file_page's fallback to do_no_page dates from a time when we were 
> testing
>     pte_file by using it wherever possible: currently it's peculiar to 
> nonlinear
>     vmas, so just check that.  BUG_ON if not?  Better not, it's probably page
>     table corruption, so just show the pte: hmm, there's a pte_ERROR macro, 
> let's
>     use that for do_wp_page's invalid pfn too.
> 
> This is false:
> 
> do_mmap_pgoff:
>         if (flags & MAP_POPULATE) {
>                 up_write(&mm->mmap_sem);
>                 sys_remap_file_pages(addr, len, 0,
>                                         pgoff, flags & MAP_NONBLOCK);
>                 down_write(&mm->mmap_sem);
>         }
> 
> So, with MAP_POPULATE|MAP_NONBLOCK passed, you can get a linear PAGE_FILE pte 
> in a !VM_NONLINEAR vma.
> 
> That PTE is very useless since it doesn't add any information, I know that, so 
> avoiding that possible installation is a possible fix, but for now it's 
> simpler to change the test in do_file_page(). Btw, in fact I discovered this 
> bug while I was implementing this optimization (working again on 
> remap_file_pages() patches of this summer).
> 
> Indeed, the condition to test (and to possibly BUG_ON/pte_ERROR) is that 
> ->populate must exist for the sys_remap_file_pages call to work.

I'm puzzled.  Both filemap_populate and shmem_populate
now test VM_NONLINEAR before calling install_file_pte.

Hugh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Sorry (was: Re: [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework)
  2005-12-03 10:03 ` Hugh Dickins
@ 2005-12-03 12:06   ` Blaisorblade
  0 siblings, 0 replies; 3+ messages in thread
From: Blaisorblade @ 2005-12-03 12:06 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrew Morton, LKML, linux-mm

On Saturday 03 December 2005 11:03, Hugh Dickins wrote:
> On Fri, 2 Dec 2005, Blaisorblade wrote:

> > Indeed, the condition to test (and to possibly BUG_ON/pte_ERROR) is that
> > ->populate must exist for the sys_remap_file_pages call to work.
>
> I'm puzzled.

Don't worry, you're right.

> Both filemap_populate and shmem_populate 
> now test VM_NONLINEAR before calling install_file_pte.

Uff, sorry, you're right - I hadn't seen this change (not mentioned in the 
Changelog, and I'm in shortness of time currently).

I haven't had the time to look even at the whole commit I referred to... (this 
summer I had studied the code for a whole month!).
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-03 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-02  0:11 [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework Blaisorblade
2005-12-03 10:03 ` Hugh Dickins
2005-12-03 12:06   ` Sorry (was: Re: [2.6.15-rc1+ regression] do_file_page bug introduced in recent rework) Blaisorblade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®