This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: misc/tst-preadvwritev2 incorrect test of [BZ #23579"]
On 25/01/2019 11:45, Sergey Kolosov wrote:
> On Fri, 2019-01-25 at 14:40 +0100, Florian Weimer wrote:
>> * Sergey Kolosov:
>>
>>> glibc misc/tst-preadvwritev2 and misc/tst-preadvwritev64v2 tests
>>> are
>>> always passing even on unpatched glibc. I've found out that added
>>> test
>>> case function do_test_with_invalid_fd() checks preadv2 (-1, &iov,
>>> 1, 0,
>>> RWF_HIPRI) result with TEST_VERIFY (errno == EBADF || errno ==
>>> ENOTSUP), that means both values(correct EBADF and incorrect
>>> ENOTSUP)
>>> are considered valid, so the test is always passing.
>>
>> I think we need to probe first if there is emulation or not, and skip
>> the test if there is kernel support.
>>
>> Do you want to work on a patch?
>>
>> Thanks,
>> Florian
>
> Sure, I would like to work on a patch.
>
> Thanks,
> Sergey
>
Maybe adding something like:
bool emulated = true;
#ifdef SYS_preadv2
if (syscall (SYS_preadv2, -1, NULL, 0) == -1 && errno == EBADF)
emulated = false;
#endif
We will pass invalid data on 'offset' and 'flags', but for syscall
code first validate the fd (and avoid to handle the off_t kABI
handling).