V2 [PATCH 2/2] Add a syscall test for [BZ #25810]
Florian Weimer
fw@deneb.enyo.de
Wed Apr 22 12:47:23 GMT 2020
* H. J. Lu:
> On Wed, Apr 22, 2020 at 5:25 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * H. J. Lu via Libc-alpha:
>>
>> > Add a test to pass 64-bit long arguments to syscall with undefined upper
>> > 32 bits on ILP32 systems.
>>
>> What does this test, exactly? How does it ensure that the upper bits
>> are indeed non-zero, to exercise the zero-extension case?
>
> On x32,
>
> struct Array
> {
> size_t length;
> void *ptr;
> };
>
> can be passed in a single 64-bit integer register. When a 32-bit
> integer is passed in
> a 64-bit integer, its upper 32 bits can contain undefined value:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94541
>
> This testcase arranges syscalls in such a way that the upper 32 bits
> of 64 big integer
> register, which is used to pass unsigned long to kernel, contains the
> "ptr" value passed in
> function arguments. If the upper 32 bits aren't cleared, syscall
> will fail since long in kernel
> is 64 bits, not 32 bits.
Would you please add this as a comment to the patch, and one-line
comments where the clobbers happen?
And say that the test is in this formulation likely x32-specific, but
that it is expected to work on other architectures as well.
More information about the Libc-alpha
mailing list