Re: kernel BUG at mm/truncate.c:475!

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hugh Dickins
Date: Tuesday, December 14, 2010 - 12:31 am

On Mon, 13 Dec 2010, Andrew Morton wrote:

Thanks a lot for working this out, Miklos.

(I don't see any explanation here for the madvise fuzzing page_mapped bug,
but that's not your fault!  I'll have to do my own thinking on that one.)


Yes, I knowingly built that assumption into it 6 years ago.


Did you work out how it came about?  About 2.6.10, I was observing that
unmap_mapping_range() is always called with i_mutex (and usually also
i_alloc_sem) held; whereas around the same time you were adding calls to
unmap_mapping_range() into invalidate_inode_pages2(), which has a much
looser definition than truncation, and does not (necessarily) have
i_mutex held.  We raced.

One fix might be to take i_mutex in invalidate_inode_pages2(); but
I suspect a thorough search would show some calls do already hold it.
Truncation/invalidation have grown a lot more paths since those days,
hard work auditing through them all.  generic_error_remove_page() is
also exceptional to be truncating without i_mutex, but I can never
care very deeply about what might go wrong with hwpoison.


Yes, I very much agree with you there: valiant effort by Miklos to
avoid bloat, but we're better off using a known primitive for now.


invalidate_inode_pages2() calls are the ones to check for that; but I
got tired, and maybe Miklos already found problems with that approach.


That would be lovely, but in fact no: it's guarding against operations on
vmas, things like munmap and mprotect, which can shuffle the prio_tree
when i_mmap_lock is dropped, without i_mutex ever being taken.

However, if we adopt Peter's preemptible mmu_gather patches, i_mmap_lock
becomes a mutex, so there's then no need for any of this (I think Peter
just did a straight conversion here, leaving it in, but it becomes
pointless and would gladly be removed).

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

Messages in current thread:
kernel BUG at mm/truncate.c:475!, Michael Leun, (Tue Nov 30, 11:49 am)
Re: kernel BUG at mm/truncate.c:475!, Hugh Dickins, (Tue Nov 30, 4:00 pm)
Re: kernel BUG at mm/truncate.c:475!, Miklos Szeredi, (Wed Dec 1, 3:25 am)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Wed Dec 1, 4:45 am)
Re: kernel BUG at mm/truncate.c:475!, Miklos Szeredi, (Wed Dec 1, 10:22 am)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Thu Dec 2, 12:41 am)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Thu Dec 2, 1:15 am)
Re: kernel BUG at mm/truncate.c:475!, Miklos Szeredi, (Thu Dec 2, 2:42 am)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Thu Dec 2, 3:57 am)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Fri Dec 3, 12:53 am)
Re: kernel BUG at mm/truncate.c:475!, Miklos Szeredi, (Mon Dec 6, 5:36 am)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Mon Dec 6, 12:43 pm)
Re: kernel BUG at mm/truncate.c:475!, Michael Leun, (Sat Dec 11, 12:50 pm)
Re: kernel BUG at mm/truncate.c:475!, Andrew Morton, (Mon Dec 13, 3:20 pm)
Re: kernel BUG at mm/truncate.c:475!, Hugh Dickins, (Tue Dec 14, 12:31 am)
Re: kernel BUG at mm/truncate.c:475!, Peter Zijlstra, (Tue Dec 14, 2:10 am)
Re: kernel BUG at mm/truncate.c:475!, Peter Zijlstra, (Tue Dec 14, 2:11 am)
Re: kernel BUG at mm/truncate.c:475!, Miklos Szeredi, (Tue Dec 14, 3:45 am)
Re: kernel BUG at mm/truncate.c:475!, Hugh Dickins, (Tue Dec 14, 9:32 pm)
Re: kernel BUG at mm/truncate.c:475!, Miklos Szeredi, (Wed Dec 15, 4:22 am)
Re: kernel BUG at mm/truncate.c:475!, Hugh Dickins, (Wed Dec 15, 5:26 pm)
Re: kernel BUG at mm/truncate.c:475!, Robert Święcki, (Thu Dec 16, 7:50 am)
Re: kernel BUG at mm/truncate.c:475!, Hugh Dickins, (Thu Dec 16, 12:05 pm)