On 8/31/20 9:46 AM, Jann Horn wrote: > On Mon, Aug 31, 2020 at 5:32 PM Rich Felker <dalias@xxxxxxxx> wrote: >> The pwrite function, originally defined by POSIX (thus the "p"), is >> defined to ignore O_APPEND and write at the offset passed as its >> argument. However, historically Linux honored O_APPEND if set and >> ignored the offset. This cannot be changed due to stability policy, >> but is documented in the man page as a bug. >> >> Now that there's a pwritev2 syscall providing a superset of the pwrite >> functionality that has a flags argument, the conforming behavior can >> be offered to userspace via a new flag. Since pwritev2 checks flag >> validity (in kiocb_set_rw_flags) and reports unknown ones with >> EOPNOTSUPP, callers will not get wrong behavior on old kernels that >> don't support the new flag; the error is reported and the caller can >> decide how to handle it. >> >> Signed-off-by: Rich Felker <dalias@xxxxxxxx> > > Reviewed-by: Jann Horn <jannh@xxxxxxxxxx> > > Note that if this lands, Michael Kerrisk will probably be happy if you > send a corresponding patch for the manpage man2/readv.2. > > Btw, I'm not really sure whose tree this should go through - VFS is > normally Al Viro's turf, but it looks like the most recent > modifications to this function have gone through Jens Axboe's tree? Should probably go through Al's tree, I've only carried them when they've been associated with io_uring in some shape or form. -- Jens Axboe