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

From: One Thousand Gnomes
Date: Fri Sep 16 2016 - 09:26:20 EST


> 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 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 imagine that is what LTP is attempting to test.

The moment you pass an invalid address you are in the land of undefined
behaviour, so I would read the standard as actually trying to deal with
the behaviour in defined situations (eg out of disk space mid writev()).

Alan