This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 2/2] posix: Implement preadv2 and pwritev2
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Zack Weinberg <zackw at panix dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Siddhesh Poyarekar <siddhesh at gotplt dot org>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 2 Jun 2017 15:19:57 -0300
- Subject: Re: [PATCH v3 2/2] posix: Implement preadv2 and pwritev2
- Authentication-results: sourceware.org; auth=none
- References: <1493901791-13438-1-git-send-email-adhemerval.zanella@linaro.org> <1493901791-13438-2-git-send-email-adhemerval.zanella@linaro.org> <8ceeaabf-110f-31fe-516b-18f2fe6710f8@gotplt.org> <7412360d-c776-532b-e22c-dd3f0048cfba@linaro.org> <CAMe9rOpu=yRUr=bHE=h2CJA7e0=U8qz5g5M_PL3GKAtLoUmmJA@mail.gmail.com> <CAKCAbMi95KU=kO1vyj7O4GpHFngOpjDGxCog83nnaYjrRwOF4Q@mail.gmail.com> <7f07b067-a074-d670-88b1-3da917451c71@redhat.com> <b2e4c8cc-0fe7-aa9b-08c8-389e7bb0fa76@linaro.org> <CAKCAbMgAuA0-Zc1n_BwjGW767semHr-ApjUWecCo4h9gJk=unQ@mail.gmail.com>
On 02/06/2017 11:22, Zack Weinberg wrote:
> On Fri, Jun 2, 2017 at 10:07 AM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>> On 02/06/2017 10:34, Florian Weimer wrote:
>>> On 06/02/2017 03:04 PM, Zack Weinberg wrote:
>>>> I see this as well, for both tst-preadvwritev2 and
>>>> tst-preadvwritev64v2 on my x86-64 machine (kernel 4.9). Like HJ, if I
>>>> run the test manually, it succeeds.
>>>
>>> I see this on x86-64.
>>>
>>> pwritev2(3,
>>> [{iov_base="\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360",
>>> iov_len=32},
>>> {iov_base="\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"...,
>>> iov_len=64}], 2, 0, 0x30 /* RWF_??? */) = -1 EOPNOTSUPP (Operation not
>>> supported)
>>>
>>> On a kernel which supports pwritev2 in general. I do not know yet where
>>> the 0x30 comes from.
>>>
>>> Florian
>>>
>>
>> This one still puzzles me, on 4.10.0 with gcc 6.3.0 I am seeing:
>>
>> [...]
>> [pid 28447] setpgid(0, 0) = 0
>> [pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
>> [pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
>> [pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
>> [pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
>> [pid 28447] getpid() = 28447
>> [...]
>>
>> This only issue I can think of is something very fuzzy in test build or a miscompilation.
>
> There's gotta be something wonky with the argument passing. Maybe try
> running the test case under valgrind? Also this trick often helps
> when a failure goes away when you run it manually:
>
> export CHANGE_SIZE_OF_ENV=""
> while
> the-command-that-should-fail
> do
> CHANGE_SIZE_OF_ENV="${CHANGE_SIZE_OF_ENV}x"
> echo -n .
> done; echo
>
> zw
>
I am even more confident this is indeed a miscompilation from GCC7 branch.
Using a previous built x86_64-linux-gnu with GCC6 branch I saw no issue, however
using GCC7 there is indeed the test failure. And it seems to show only for kernels
with support for p{read,write}v2 syscall, which means it stress the default
SYSCALL_CANCEL path.
However, running a GCC6 built testcase with a GCC7 build glibc (with testrun.sh)
I saw no issue. The GCC7 built test also fails with a GCC6 built glibc. I will
check with GCC master to see if this is something only on GCC7 branch or if it
is still on master.
Also, I seems that for GCC7 only x86_64-linux-gnu is affect on x86.