glibc/misc
Adhemerval Zanella 7a16bdbb9f Fix misreported errno on preadv2/pwritev2 (BZ#23579)
The fallback code of Linux wrapper for preadv2/pwritev2 executes
regardless of the errno code for preadv2, instead of the case where
the syscall is not supported.

This fixes it by calling the fallback code iff errno is ENOSYS. The
patch also adds tests for both invalid file descriptor and invalid
iov_len and vector count.

The only discrepancy between preadv2 and fallback code regarding
error reporting is when an invalid flags are used.  The fallback code
bails out earlier with ENOTSUP instead of EINVAL/EBADF when the syscall
is used.

Checked on x86_64-linux-gnu on a 4.4.0 and 4.15.0 kernel.

	[BZ #23579]
	* misc/tst-preadvwritev2-common.c (do_test_with_invalid_fd): New
	test.
	* misc/tst-preadvwritev2.c, misc/tst-preadvwritev64v2.c (do_test):
	Call do_test_with_invalid_fd.
	* sysdeps/unix/sysv/linux/preadv2.c (preadv2): Use fallback code iff
	errno is ENOSYS.
	* sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
	* sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
	* sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.
2018-09-28 10:08:09 -03:00
..
bits
sys Add <bits/indirect-return.h> 2018-07-24 07:55:47 -07:00
acct.c
allocate_once.c Implement allocate_once for atomic initialization with allocation 2018-05-23 15:27:01 +02:00
ar.h
brk.c
bug18240.c
bug-hsearch1.c
chflags.c
chroot.c
daemon.c
dirname.c
efgcvt_r.c
efgcvt.c
err.c error, warn, warnx: Use __fxprintf for wide printing [BZ #23519] 2018-08-14 17:54:49 +02:00
err.h
error.c error, warn, warnx: Use __fxprintf for wide printing [BZ #23519] 2018-08-14 17:54:49 +02:00
error.h
fchflags.c
fdatasync.c
fgetxattr.c
flistxattr.c
fremovexattr.c
fsetxattr.c
fstab.c
fstab.h
fsync.c
ftruncate64.c
ftruncate.c
futimes.c
futimesat.c Add missing start-of-file descriptive comment. 2018-03-06 09:21:04 +01:00
getauxval.c
getclktck.c
getdomain.c
getdtsz.c
gethostid.c
gethostname.c
getloadavg.c
getpagesize.c
getpass.c
getsysstats.c
getttyent.c Fix -Os getc_unlocked linknamespace, localplt issues (bug 15105, bug 19463). 2018-02-21 18:01:11 +00:00
getusershell.c
getxattr.c
gtty.c
hsearch_r.c
hsearch.c
ifunc-impl-list.c
init-misc.c
insremque.c
ioctl.c
lgetxattr.c
libgen.h
listxattr.c
llistxattr.c
lremovexattr.c
lsearch.c
lsetxattr.c
lutimes.c
madvise.c
makedev.c
Makefile misc: New test misc/tst-gethostid 2018-09-20 12:03:01 +02:00
mincore.c
mkdtemp.c
mkostemp64.c
mkostemp.c
mkostemps64.c
mkostemps.c
mkstemp64.c
mkstemp.c
mkstemps64.c
mkstemps.c
mktemp.c
mlock.c
mlockall.c
mmap64.c
mmap.c
mntent_r.c
mntent.c
mntent.h
mprotect.c
msync.c
munlock.c
munlockall.c
munmap.c
preadv2.c
preadv64.c
preadv64v2.c
preadv.c
pselect.c
ptrace.c
pwritev2.c
pwritev64.c
pwritev64v2.c
pwritev.c
qefgcvt_r.c
qefgcvt.c
readv.c
reboot.c
regexp.c
regexp.h
remap_file_pages.c
removexattr.c
revoke.c
sbrk.c
search.h
select.c
setdomain.c
setegid.c
seteuid.c
sethostid.c
sethostname.c
setregid.c
setreuid.c
setxattr.c
sgtty.h
sstk.c
stab.h
stty.c
swapoff.c
swapon.c
sync.c
syncfs.c
syscall.c
syscall.h
sysexits.h
syslog.c Fix -Os putc_unlocked, fputc_unlocked linknamespace, localplt issues (bug 15105, bug 19463). 2018-02-21 18:02:24 +00:00
syslog.h
truncate64.c
truncate.c
tsearch.c
tst-allocate_once.c Implement allocate_once for atomic initialization with allocation 2018-05-23 15:27:01 +02:00
tst-atomic-long.c
tst-atomic.c
tst-dirname.c
tst-efgcvt.c
tst-empty.c
tst-error1.c
tst-fdset.c
tst-gethostid.c misc: New test misc/tst-gethostid 2018-09-20 12:03:01 +02:00
tst-hsearch.c
tst-insremque.c
tst-makedev.c
tst-mntent2.c
tst-mntent-blank-corrupt.c
tst-mntent-blank-passno.c
tst-mntent.c
tst-preadvwritev2-common.c Fix misreported errno on preadv2/pwritev2 (BZ#23579) 2018-09-28 10:08:09 -03:00
tst-preadvwritev2.c Fix misreported errno on preadv2/pwritev2 (BZ#23579) 2018-09-28 10:08:09 -03:00
tst-preadvwritev64.c Avoid running some tests if the file system does not support holes 2018-08-21 12:56:53 +02:00
tst-preadvwritev64v2.c Fix misreported errno on preadv2/pwritev2 (BZ#23579) 2018-09-28 10:08:09 -03:00
tst-preadvwritev-common.c Avoid running some tests if the file system does not support holes 2018-08-21 12:56:53 +02:00
tst-preadvwritev.c
tst-pselect.c
tst-tsearch.c
tst-warn-wide.c error, warn, warnx: Use __fxprintf for wide printing [BZ #23519] 2018-08-14 17:54:49 +02:00
ttyent.h
ttyslot.c
ualarm.c
usleep.c
ustat.c Deprecate ustat syscall interface 2018-05-02 08:43:31 -03:00
utimes.c Add missing start-of-file descriptive comment. 2018-03-06 09:21:04 +01:00
Versions Implement allocate_once for atomic initialization with allocation 2018-05-23 15:27:01 +02:00
vhangup.c
writev.c