[PATCH v3 2/2] posix: Implement preadv2 and pwritev2

H.J. Lu hjl.tools@gmail.com
Sat Jun 3 01:47:00 GMT 2017


On Fri, Jun 2, 2017 at 12:46 PM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
> On 02/06/2017 16:02, Florian Weimer wrote:
>> On 06/02/2017 08:19 PM, Adhemerval Zanella wrote:
>>> 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.
>>
>> I see it with GCC 6.3 on Fedora 24, x86-64 as well.  It could be a
>> broken GCC 7 patch that was backported, or perhaps our constraints for
>> the syscall instruction are off.
>
> My GCC 6.3 was built with build-many-glibcs.py, so I assume it contains
> no backports.  I just checked with GCC trunk (gcc version 8.0.0 20170602)
> built also with build-many-glibcs.py and it does not trigger the issue.

The kernel interface for p{readv,writev}{64}v is

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos_l, unsigned long pos_h)

The LO_HI_LONG macro is used to pass offset to the pos_l and pos_h pair.
Since pos_h is ignored when size of offset == sizeof of pos_l, x86-64
has

 #define LO_HI_LONG(val) (val)

But the kernel interface for p{readv,writev}{64}v2 is

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos_l, unsigned long pos_h, int flags)

Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64V2 and
__ARCH_WANT_COMPAT_SYS_PWRITEV64V2,

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos, int flags)

will be used for p{readv,writev}{64}v2.  X32 is the only such target.
The x86-64 LO_HI_LONG can't be used for p{readv,writev}{64}v2.  Add a
new macro, LO_HI_LONG_FLAGS, to pass the off{64}_t and flags arguments.

Please test it on other aches.

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-LO_HI_LONG_FLAGS-for-p-readv-writev-64-v2.patch
Type: text/x-patch
Size: 5966 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170603/0490f15a/attachment.bin>


More information about the Libc-alpha mailing list