Re: Deadlock in do_page_fault() on ARM (old kernel)
From: Michal Hocko
Date: Mon Jan 20 2014 - 05:15:21 EST
On Wed 15-01-14 20:13:04, Alan Ott wrote:
> 2. __copy_to_user_memcpy() takes a read lock (down_read()) on
This looks like a bug. copy_to_user_* shouldn't take mmap_sem at all
Check the might_fault annotation used in generic code. Arm version of
copy_to_user* doesn't seem to use the annotation and I do not see a good
reason for that.
> mm->mmap_sem. While that lock is held, __copy_to_user_memcpy() can
> generate a page fault, causing do_page_fault() to get called, which
> will also try to get a read lock (down_read()) on mm->mmap_sem.
> Multiple read locks can be taken on an rw_semaphore, but deadlock
> will occur if another thread tries to get a write lock
> (down_write()) in between. For example:
> Task 1: Task 2:
> down_write(sem) <-- Goes to sleep
> down_read(sem) <-- Goes to sleep
> There is a thread from 2005 which seems to discuss the same
> concept of recursive rw_semaphores, but for futexes.
> Other comments:
> 1. My analysis of this probably wrong. Otherwise it seems many
> others would have the same problem, and they don't seem to. I'm
> hoping this email will help to correct my understanding.
> 2. I looked through the git logs for recent (since 2.6.37 time
> frame) and nothing else jumped out at me as being an obvious fix for
> this situation.
> Thanks for any insight you can give,
>  http://www.signal11.us/~alan/show-all-tasks-deadlock.txt
>  Some websites/bugtrackers mention this commit with a similar
> issue, but I'm not entirely sure how it's related:
> This one seems obviously related, but has no effect on my system:
>  http://thread.gmane.org/gmane.linux.kernel/280900
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/