[LTP] [PATCH v2] syscalls/brk: add direct syscall tst_variant

Richard Palethorpe rpalethorpe@suse.de
Tue Dec 13 10:34:20 CET 2022


Hello,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Teo,
>
>> Hi Petr,
>
>> On 12/12/2022 15:22, Petr Vorel wrote:
>> > Hi Richie,
>
>> > > Cyril, Petr, Would you like to add your reviewed by tags? Then we can
>> > > merge this.
>> > By accident I reply to my points to v1 [1].
>> > To copy it here:
>
>> > 1) There are warnings:
>> > brk02.c: In function ‘brk_variants’:
>> > brk02.c:26:28: warning: cast to pointer from integer of different size
>> > [-Wint-to-pointer-cast]
>> >     26 |                 brk_addr = (void *)brk(addr);
>> >           |                            ^
>
>> > 2) make check reports errors which are easily fixed.
>
>> > Teo replied [2], that he's going to fix it. I thought I had set it
>> > "Changes requested", but now I see "Needs Review / ACK". Setting it to
>> > "Changes requested".
>
>> I believe the points you raised are fixed in the v2, on top of this thread.
>> Re-applying it on top of master on my side doesn't give me any warnings for
>> the brk tests, as I do not cast the result from the libc brk anymore, and
>> make check reports existing issues with the name of the function, but no
>> style problems that did exist in v1. (I don't mind changing them if you
>> want, but they are present on master as well).
>
>> If you give a quick look at the patch v2 you'll see that indeed there is no
>> more (void *)brk(addr) or such that generated the warnings, for example.
>> (The syscalls still need it, as they return the break directly rather than
>> an error, which is what the libc wrapper does.)
>
>> I might be missing something, please do tell me if that's the case ! But I
>> believe that the v2 _should_ be free of those issues.
>
> I thought I must have put v1 code into my v2 branch. But the warnings are
> actually when compiling on Alpine:
>
> $ make V=1
> gcc -I../../../../include -I../../../../include
> -I../../../../include/old/ -g -O2 -g -O2 -fno-strict-aliasing -pipe
> -Wall -W -Wold-style-definition -L../../../../lib brk01.c -lltp -o
> brk01
> brk01.c: In function 'verify_brk':
> brk01.c:22:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>    22 |                 cur_brk = (void *)tst_syscall(__NR_brk, 0);
>       |                           ^
> brk01.c:52:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>    52 |                         cur_brk = (void *)tst_syscall(__NR_brk, new_brk);
>       |                                   ^
> gcc -I../../../../include -I../../../../include
> -I../../../../include/old/ -g -O2 -g -O2 -fno-strict-aliasing -pipe
> -Wall -W -Wold-style-definition -L../../../../lib brk02.c -lltp -o
> brk02
> brk02.c: In function 'brk_variants':
> brk02.c:24:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>    24 |                 brk_addr = (void *)tst_syscall(__NR_brk, addr);
>       |                            ^
> brk02.c: In function 'brk_down_vmas':
> brk02.c:38:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>    38 |                 brk_addr = (void *)tst_syscall(__NR_brk, 0);
>       |                            ^
>

How is this possible when tst_syscall (now) uses intptr_t?

-- 
Thank you,
Richard.


More information about the ltp mailing list