Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1487316
| From | Jan Stancek <jstancek@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [bug] pwritev02 hang on s390x with 4.8.0-rc7 |
| Date | 2016-09-20 15:00 +0200 |
| Message-ID | <sjsOu-34H-23@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Hi,
I'm hitting a regression with LTP's pwritev02 [1] on s390x with 4.8.0-rc7.
Specifically the EFAULT case, which is passing an iovec with invalid base address:
#define CHUNK 64
static struct iovec wr_iovec3[] = {
{(char *)-1, CHUNK},
};
hangs with 100% cpu usage and not very helpful stack trace:
# cat /proc/28544/stack
[<0000000000001000>] 0x1000
[<ffffffffffffffff>] 0xffffffffffffffff
The problem starts with d4690f1e1cda "fix iov_iter_fault_in_readable()".
Before this commit fault_in_pages_readable() called __get_user() on start
address which presumably failed with -EFAULT immediately.
With this commit applied fault_in_multipages_readable() appears to return 0
for the case when "start" is invalid but "end" overflows. Then according to
my traces we keep spinning inside while loop in iomap_write_actor().
Patch below makes the issue go away for me:
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 66a1260b33de..e443dbd2b5df 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -600,11 +600,11 @@ static inline int fault_in_multipages_readable(const char __user *uaddr,
int size)
{
volatile char c;
- int ret = 0;
+ int ret = -EFAULT;
const char __user *end = uaddr + size - 1;
if (unlikely(size == 0))
- return ret;
+ return 0;
while (uaddr <= end) {
ret = __get_user(c, uaddr);
Regards,
Jan
[1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/pwritev/pwritev02.c
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[bug] pwritev02 hang on s390x with 4.8.0-rc7 Jan Stancek <jstancek@redhat.com> - 2016-09-20 15:00 +0200
Re: [bug] pwritev02 hang on s390x with 4.8.0-rc7 Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-20 17:10 +0200
Re: [bug] pwritev02 hang on s390x with 4.8.0-rc7 Jan Stancek <jstancek@redhat.com> - 2016-09-20 19:20 +0200
Re: [bug] pwritev02 hang on s390x with 4.8.0-rc7 Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-20 19:40 +0200
[PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-20 21:10 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-20 22:30 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-20 22:40 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-20 22:50 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-20 23:10 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-20 23:40 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-21 01:50 +0200
Re: [PATCH] fix fault_in_multipages_...() on architectures with no-op access_ok() Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-21 02:40 +0200
csiph-web