]> git.baikalelectronics.ru Git - kernel.git/commit
fix writev regression: pan hanging unkillable and un-straceable
authorNick Piggin <nickpiggin@yahoo.com.au>
Sat, 2 Feb 2008 14:01:17 +0000 (15:01 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Feb 2008 20:55:39 +0000 (07:55 +1100)
commitcb148754bb4667e5dae0860e7d09e02ad05c24ee
tree9b92dd8f99c10ae0a0931ce71f3e9a20b32b167b
parent662c2666e25a3c989bf2001e72e7fc03d499fe3d
fix writev regression: pan hanging unkillable and un-straceable

Frederik Himpe reported an unkillable and un-straceable pan process.

Zero length iovecs can go into an infinite loop in writev, because the
iovec iterator does not always advance over them.

The sequence required to trigger this is not trivial. I think it
requires that a zero-length iovec be followed by a non-zero-length iovec
which causes a pagefault in the atomic usercopy. This causes the writev
code to drop back into single-segment copy mode, which then tries to
copy the 0 bytes of the zero-length iovec; a zero length copy looks like
a failure though, so it loops.

Put a test into iov_iter_advance to catch zero-length iovecs. We could
just put the test in the fallback path, but I feel it is more robust to
skip over zero-length iovecs throughout the code (iovec iterator may be
used in filesystems too, so it should be robust).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c