glibc/sysdeps
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
..
aarch64 Use round functions not __round functions in glibc libm. 2018-09-27 12:35:23 +00:00
alpha Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
arm Add new exp and exp2 implementations 2018-09-05 16:22:00 +01:00
generic Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
gnu Update netinet/udp.h from Linux 4.18. 2018-08-27 13:43:05 +00:00
hppa Move SNAN_TESTS_PRESERVE_PAYLOAD out of math-tests.h. 2018-08-01 11:21:16 +00:00
htl hurd: Avoid PLTs for __pthread_get/setspecific 2018-08-09 01:28:55 +02:00
hurd Fix ISO C threads installed header and HURD assumption 2018-07-25 17:27:45 -03:00
i386 Add new pow implementation 2018-09-19 10:04:51 +01:00
ia64 Add new pow implementation 2018-09-19 10:04:51 +01:00
ieee754 Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
init_array sysdeps/init_array: Add PREINIT_FUNCTION to crti.S 2018-01-29 10:22:26 -08:00
m68k Use trunc functions not __trunc functions in glibc libm. 2018-09-20 21:11:10 +00:00
mach hurd: Fix exec usage of mach_setup_thread 2018-08-01 00:10:03 +02:00
microblaze Mark _init and _fini as hidden [BZ #23145] 2018-06-08 10:28:52 -07:00
mips Split fenv_private.h out of math_private.h more consistently. 2018-08-28 20:48:49 +00:00
nios2 Move EXCEPTION_TESTS_* out of math-tests.h 2018-08-23 23:41:13 +00:00
nptl [BZ #20271] Add newlines in __libc_fatal calls. 2018-08-31 18:04:32 -07:00
posix Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
powerpc Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
pthread hurd: fix sigevent's sigev_notify_attributes field type 2018-04-19 21:43:44 +02:00
riscv Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s390 S390: Regenerate ULPs. 2018-09-06 14:29:01 +02:00
sh Update SH libm-tests-ulps 2018-07-31 10:33:53 -03:00
sparc Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
unix Fix misreported errno on preadv2/pwritev2 (BZ#23579) 2018-09-28 10:08:09 -03:00
wordsize-32 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
wordsize-64 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
x86 Use round functions not __round functions in glibc libm. 2018-09-27 12:35:23 +00:00
x86_64 Use trunc functions not __trunc functions in glibc libm. 2018-09-20 21:11:10 +00:00