Re: [PATCH 2/2] Perform check in iov_iter_fault_in_readable() by check_readable_bytes()

From: Vitaly Mayatskikh
Date: Fri May 15 2009 - 03:56:25 EST


At Fri, 15 May 2009 08:56:00 +0200, Andi Kleen wrote:

> Can you describe how it makes it POSIX friendly?
>
> My understanding was that EFAULT behaviour was undefined in POSIX.
>
> The obvious hole in the patch is that all these checks are not race
> free -- they don't pin pages -- so if there's a parallel unmap even
> with your change they can still fail in the middle.


ptr = mmap(0, page_size, ....);
...
write(fd, ptr + page_size - 256, 512);

Write() will fail here, but it can write first 256 bytes. Previously,
all 512 bytes were proceeded, but last 256 bytes were zeroed, and
sys_write() returned 256. Not very nice too.

--
wbr, Vitaly
--
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/