Again: Fix multithread coredump deadlock (patch Manfred Spraul)

Again: Fix multithread coredump deadlock (patch Manfred Spraul)

Post by Kirill Korotae » Fri, 04 Jul 2003 10:30:18



Hi!

There was a patch some time ago included in linux-2.4.17-pre6 which fixed mmap
semaphore deadlock in do_coredump (double down_read() on mmap_sem).
This fix introduces down_write() on mmap_sem and uses get_user_pages()
function to avoid do_page_fault().
The question is why down_write() is used in elf_core_dump() (instead of
down_read())?

Kirill

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Again: Fix multithread coredump deadlock (patch Manfred Spraul)

Post by Manfred Sprau » Fri, 04 Jul 2003 19:10:11



>Hi!

>There was a patch some time ago included in linux-2.4.17-pre6 which fixed mmap
>semaphore deadlock in do_coredump (double down_read() on mmap_sem).
>This fix introduces down_write() on mmap_sem and uses get_user_pages()
>function to avoid do_page_fault().
>The question is why down_write() is used in elf_core_dump() (instead of
>down_read())?

down_write is required to prevent expand_stack() from growing the stack
- expand_stack is called by the page fault handler under
down_read(&->mmap_sem) and changes vma->vm_start. A change of vm_start
between writing the program headers and the actual segment dump would
corrupt the coredump.

--
    Manfred

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/