Re: [RFC] writev() semantics with invalid iovec in the middle

2016-09-16 Thread Linus Torvalds
On Fri, Sep 16, 2016 at 6:25 AM, One Thousand Gnomes wrote: > > 1003.1 says > > "Each iovec entry specifies the base address and length of an area in > memory from which data should be written. The writev() function shall > always write a complete area before proceeding to the next." > > and I ima

Re: [RFC] writev() semantics with invalid iovec in the middle

2016-09-16 Thread One Thousand Gnomes
> Unfortunately, some of LTP writev tests end up checking that writev() does > behave that way - they feed it a three-element iovec with shorter-than-page > segments, the second of which is all invalid. And they check that the > entire first segment had been written. 1003.1 says "Each iovec entr

Re: [RFC] writev() semantics with invalid iovec in the middle

2016-09-15 Thread Linus Torvalds
On Thu, Sep 15, 2016 at 3:29 PM, Al Viro wrote: > > Unfortunately, some of LTP writev tests end up checking that writev() does > behave that way - they feed it a three-element iovec with shorter-than-page > segments, the second of which is all invalid. And they check that the > entire first segme

Re: [RFC] writev() semantics with invalid iovec in the middle

2016-09-15 Thread Cedric Blancher
PAGE_SIZE isn't accurate on architectures which do multiple page sizes, like 8k, 64k, 512k, 4M, 32M, 256M on SPARC64 and same on PPC64/Power. Ced On 16 September 2016 at 00:29, Al Viro wrote: > On Thu, Sep 15, 2016 at 06:23:24AM -0400, Mike Marshall wrote: >> If you squeeze out every byte won't

Re: [RFC] writev() semantics with invalid iovec in the middle

2016-09-15 Thread Al Viro
On Thu, Sep 15, 2016 at 06:23:24AM -0400, Mike Marshall wrote: > If you squeeze out every byte won't you still have a short > write? And the written data wouldn't be cut at the bad > place, but it would have a weird hole or discontinuity there. ??? What I mean is that if we have an invalid addres

Re: [RFC] writev() semantics with invalid iovec in the middle

2016-09-15 Thread Mike Marshall
If you squeeze out every byte won't you still have a short write? And the written data wouldn't be cut at the bad place, but it would have a weird hole or discontinuity there. -Mike On Wed, Sep 14, 2016 at 5:34 PM, Al Viro wrote: > Right now writev() with 3-iovec array that has unmapped

[RFC] writev() semantics with invalid iovec in the middle

2016-09-14 Thread Al Viro
Right now writev() with 3-iovec array that has unmapped address in the second element and total length less than PAGE_SIZE will write the first segment and stop at that. Among other things, it guarantees the short copy, and I would rather have it yeild 0-bytes write (and -EFAULT as return