qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] clang -fsanitize=undefined warnings in the string visit


From: Peter Maydell
Subject: Re: [Qemu-devel] clang -fsanitize=undefined warnings in the string visitors
Date: Mon, 11 May 2015 09:53:59 +0100

Paolo: ping^2, since we're out of release freeze now?

thanks
-- PMM

On 5 February 2015 at 17:03, Peter Maydell <address@hidden> wrote:
> Ping on this warning issue, since I guess everybody missed it
> over Christmas :-)
>
> thanks
> -- PMM
>
> On 23 December 2014 at 23:17, Peter Maydell <address@hidden> wrote:
>> If you do a clang build with -fsanitize=undefined, then you get some
>> sanitizer errors in make check:
>>
>> TEST: tests/test-string-output-visitor... (pid=31713)
>>   /string-visitor/output/int:                                          OK
>>   /string-visitor/output/int:                                          OK
>>   /string-visitor/output/bool:                                         OK
>>   /string-visitor/output/bool:                                         OK
>>   /string-visitor/output/number:
>> /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/string-output-visitor.c:92:16:OK
>>  runtime error: signed integer overflow: 9223372036854775807
>> /string-visitor/output/number:                                       +
>> 1 cannot be represented in type 'long'
>> OK
>>   /string-visitor/output/string:                                       OK
>> [etc]
>>
>> and later
>> TEST: tests/test-visitor-serialization... (pid=31729)
>> [etc]
>>   /visitor/serialization/String/primitives/boolean_true2:              OK
>>   /visitor/serialization/String/primitives/boolean_true3:              OK
>>   /visitor/serialization/String/primitives/boolean_false1:             OK
>>   /visitor/serialization/String/primitives/boolean_false2:
>> /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/string-output-visitor.c:83:16:OK
>>   /visitor/serialization/String/primitives/number_sanity1:
>>  runtime error: signed integer overflow: 9223372036854775807 + 1
>> cannot be represented in type OK
>> 'long'
>>   /visitor/serialization/String/primitives/number_sanity2:
>> /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/string-input-visitor.c:58:34:OK
>>  runtime error: signed integer overflow:
>> /visitor/serialization/String/primitives/number_min:
>> 9223372036854775807 + 1 cannot be represented in type 'long long'
>> OK
>> /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/string-input-visitor.c:216:13:
>> runtime error:   /visitor/serialization/String/primitives/number_max:
>>                signed integer overflow: 9223372036854775807 + 1 cannot
>> be represented in type 'int64_t' (aka 'long')
>> OK
>>   /visitor/serialization/String/primitives/integer_sanity1:            OK
>>   /visitor/serialization/String/primitives/integer_sanity2:            OK
>> [etc]
>>
>> You can also see these without clang if you run under gdb and put in
>> appropriate conditional breakpoints (eg string_output_append_range()
>> with condition (e > 50000). Sample backtrace:
>>
>> (gdb) bt
>> #0  string_output_append_range (sov=0x5555557adbc0,
>> s=9223372036854775806, e=9223372036854775807)
>>     at 
>> /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/string-output-visitor.c:89
>> #1  0x000055555558285c in print_type_int (v=0x5555557adbc0,
>> obj=0x5555557adec0, name=0x0, errp=0x7fffffffdec8)
>>     at 
>> /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/string-output-visitor.c:158
>> #2  0x00005555555800ab in visit_type_int (v=0x5555557adbc0,
>> obj=0x5555557adec0, name=0x0, errp=0x7fffffffdec8)
>>     at /home/petmay01/linaro/qemu-from-laptop/qemu/qapi/qapi-visit-core.c:100
>> #3  0x000055555555e73f in visit_type_intList (m=0x5555557adbc0,
>> obj=0x7fffffffdf28, name=0x0, errp=0x7fffffffdf30)
>>     at qapi-visit.c:57
>> #4  0x0000555555558263 in test_visitor_out_intList
>> (data=0x5555557adb30, unused=0x7fffffffe350)
>>     at 
>> /home/petmay01/linaro/qemu-from-laptop/qemu/tests/test-string-output-visitor.c:93
>> #5  0x00007ffff7b3ea81 in test_case_run (tc=0x5555557ad500) at
>> /build/buildd/glib2.0-2.40.2/./glib/gtestutils.c:2059
>> #6  g_test_run_suite_internal (address@hidden,
>> address@hidden "")
>>     at /build/buildd/glib2.0-2.40.2/./glib/gtestutils.c:2120
>> #7  0x00007ffff7b3ec46 in g_test_run_suite_internal
>> (address@hidden,
>>     address@hidden "") at
>> /build/buildd/glib2.0-2.40.2/./glib/gtestutils.c:2131
>> #8  0x00007ffff7b3ec46 in g_test_run_suite_internal
>> (address@hidden,
>>     address@hidden "") at
>> /build/buildd/glib2.0-2.40.2/./glib/gtestutils.c:2131
>> #9  0x00007ffff7b3ef9b in g_test_run_suite (suite=0x5555557ac820)
>>     at /build/buildd/glib2.0-2.40.2/./glib/gtestutils.c:2184
>> #10 0x00007ffff7b3efd1 in g_test_run () at
>> /build/buildd/glib2.0-2.40.2/./glib/gtestutils.c:1488
>> #11 0x0000555555558fee in main (argc=1, argv=0x7fffffffe468)
>>     at 
>> /home/petmay01/linaro/qemu-from-laptop/qemu/tests/test-string-output-visitor.c:286
>>
>> and you can see that 'e' is the max 64 bit signed
>> integer and we're about to increment it...
>>
>> Paolo, the file says you wrote this code?
>>
>> thanks
>> -- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]