This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use SYSCALL_LL[64] to pass 64-bit value [BZ #20349]


On Wed, Jul 13, 2016 at 9:15 AM, Chris Metcalf <cmetcalf@mellanox.com> wrote:
> On 7/11/2016 6:06 PM, H.J. Lu wrote:
>>
>> --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
>> +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
>> @@ -385,4 +385,8 @@
>>   # endif
>>   #endif
>>   +/* How to pass the off{64}_t argument on p{readv,writev}{64}.  */
>> +#undef LO_HI_LONG
>> +#define LO_HI_LONG(val) (val)
>> +
>
>
> But any 64-bit platform (or other ILP32 platform with 64-bit kernel API)
> that uses the consolidated preadv/pwritev will still have the bug you have
> fixed for x86.
>
> I suspect Adhermerval's commit 468700675f7f ("Fix LO_HI_LONG definition")
> may not have been the patch he intended, since his commit comment says:
>
>     GLIBC already defines a macro for such cases (__OFF_T_MATCHES_OFF64_T),
>     so this patch uses it instead.
>
> but the actual code does not use __OFF_T_MATCHES_OFF64_T.  I suspect
> that we actually want what his commit comment implied.
>

__OFF_T_MATCHES_OFF64_T.has nothing to do how 64-bit off_t is passed
to p{readv,writev}{64}.  Kernel has

sys_preadv, compat_sys_preadv and compat_sys_preadv64.

64-bit platforms always use sys_preadv and should use:

#define LO_HI_LONG(val) (val)

32-bit platforms which use compat_sys_preadv64, like x32, should also use

#define LO_HI_LONG(val) (val)


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]