# New Ticket Created by  Jan-Olof Hendig 
# Please include the string:  [perl #129860]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=129860 >


When running valgrind on t/04-nativecall/08-callbacks.t, a number of invalid
reads are caught. Possibly it might be due to me running on a 32 bit VM.

Output from valgrind

============================================================================
====================
This is Rakudo Perl 6 running in valgrind, a tool for debugging and
profiling programs.
Running a program in valgrind usually takes *a lot* more time than running
it directly,
so please be patient.
This Rakudo version is 2016.09.180.g.0.d.09178 built on MoarVM version
2016.09.46.geceb.429,
running on ubuntu (14.04.3.LTS.Trusty.Tahr) / linux (3.19.0.32.generic)
----------------------------------------------------------------------------
--------------------
==988== Memcheck, a memory error detector
==988== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==988== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==988== Command: /home/dogbert/repos/rakudo/install/bin/moar --full-cleanup
--execname=./perl6-valgrind-m
--libpath=/home/dogbert/repos/rakudo/install/share/nqp/lib --libpath=.
/home/dogbert/repos/rakudo/perl6.moarvm -Ilib t/04-nativecall/08-callbacks.t
==988== 
1..8
ok 1 - simple callback
==988== Invalid read of size 4
==988==    at 0x41CC6B6: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==  Address 0xbee6fc34 is on thread 1's stack
==988==  12 bytes below stack pointer
==988== 
==988== Invalid read of size 4
==988==    at 0x41CC6C0: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==  Address 0xbee6fc38 is on thread 1's stack
==988==  4 bytes below stack pointer
==988== 
==988== Invalid read of size 4
==988==    at 0x41CC6CB: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB429: dcCallVoid (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B57B: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==  Address 0xbee6fc18 is on thread 1's stack
==988==  36 bytes below stack pointer
==988== 
==988== Invalid read of size 4
==988==    at 0x41CC6CD: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB429: dcCallVoid (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B57B: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==  Address 0xbee6fc1c is on thread 1's stack
==988==  32 bytes below stack pointer
==988==
ok 2 - int callback argument
ok 3 - string callback argument
ok 4 - struct callback string argument
ok 5 - struct callback int argument
==988== Invalid read of size 8
==988==    at 0x41CC6D4: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB4A5: dcCallInt (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B615: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==  Address 0xbee6fc08 is on thread 1's stack
==988==  36 bytes below stack pointer
==988== 
ok 6 - callback returned a float to C
==988== Invalid read of size 4
==988==    at 0x41CC6CB: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB4A5: dcCallInt (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B615: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==  Address 0xbee6fbf8 is on thread 1's stack
==988==  36 bytes below stack pointer
==988== 
==988== Invalid read of size 4
==988==    at 0x41CC6CD: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB4A5: dcCallInt (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B615: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==  Address 0xbee6fbfc is on thread 1's stack
==988==  32 bytes below stack pointer
==988==
ok 7 - callback returned a string to C
ok 8 - callback returned a struct to C
==988== 
==988== HEAP SUMMARY:
==988==     in use at exit: 153,766 bytes in 4,656 blocks
==988==   total heap usage: 447,900 allocs, 443,244 frees, 120,151,371 bytes
allocated
==988== 
==988== 4 bytes in 4 blocks are definitely lost in loss record 2 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41079BD: MVM_malloc (alloc.h:2)
==988==    by 0x4108F43: unmarshal_callback (nativecall_dyncall.c:137)
==988==    by 0x410ACCD: MVM_nativecall_invoke (nativecall_dyncall.c:556)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 8 bytes in 1 blocks are definitely lost in loss record 3 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x803072F: ???
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB429: dcCallVoid (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B57B: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 16 bytes in 1 blocks are definitely lost in loss record 4 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41A1DA0: MVM_malloc (alloc.h:2)
==988==    by 0x41A32AC: MVM_string_utf8_encode_C_string (utf8.c:473)
==988==    by 0x41063BD: MVM_nativecall_unmarshal_string (nativecall.c:277)
==988==    by 0x4109BF4: callback_handler (nativecall_dyncall.c:374)
==988==    by 0x41CC6B1: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x80307B2: ???
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB4A5: dcCallInt (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B615: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==
==988== 31 (8 direct, 23 indirect) bytes in 1 blocks are definitely lost in
loss record 10 of 56
==988==    at 0x402C109: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x4158C64: MVM_calloc (alloc.h:11)
==988==    by 0x4159B4F: initialize (CStruct.c:341)
==988==    by 0x40CD3DD: MVM_interp_run (interp.c:1730)
==988==    by 0x4109987: callback_handler (nativecall_dyncall.c:318)
==988==    by 0x41CC6B1: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x80307F7: ???
==988==    by 0x41CBE57: ??? (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB854: dc_callvm_call_x86_cdecl (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x41CB4A5: dcCallInt (in
/home/dogbert/repos/rakudo/install/lib/libmoar.so)
==988==    by 0x410B615: MVM_nativecall_invoke (nativecall_dyncall.c:584)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988== 
==988== 36 bytes in 9 blocks are definitely lost in loss record 14 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x4161E16: MVM_malloc (alloc.h:2)
==988==    by 0x4162132: deserialize_repr_data (NativeRef.c:45)
==988==    by 0x4177469: deserialize_stable (serialization.c:2599)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x416ECB4: MVM_sc_get_sc_object (sc.c:199)
==988==    by 0x40D5BAF: MVM_interp_run (interp.c:3013)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 112 bytes in 2 blocks are definitely lost in loss record 19 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41700D5: MVM_malloc (alloc.h:2)
==988==    by 0x4176DCF: deserialize_stable (serialization.c:2497)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x416ECB4: MVM_sc_get_sc_object (sc.c:199)
==988==    by 0x40D5BAF: MVM_interp_run (interp.c:3013)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 112 bytes in 14 blocks are definitely lost in loss record 20 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41700D5: MVM_malloc (alloc.h:2)
==988==    by 0x4176F1E: deserialize_stable (serialization.c:2516)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x40EF8EC: MVM_frame_vivify_lexical (frame.c:1100)
==988==    by 0x414DCD0: at_key (MVMContext.c:61)
==988==    by 0x40D175B: MVM_interp_run (interp.c:2297)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==
==988== 121 bytes in 7 blocks are definitely lost in loss record 21 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41A330C: MVM_malloc (alloc.h:2)
==988==    by 0x41A4A24: MVM_string_utf8_c8_encode_C_string (utf8_c8.c:551)
==988==    by 0x410678A: MVM_nativecall_build (nativecall.c:377)
==988==    by 0x40DC4E2: MVM_interp_run (interp.c:3949)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 256 bytes in 32 blocks are definitely lost in loss record 25 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41700D5: MVM_malloc (alloc.h:2)
==988==    by 0x4176F1E: deserialize_stable (serialization.c:2516)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x416ECB4: MVM_sc_get_sc_object (sc.c:199)
==988==    by 0x40D5BAF: MVM_interp_run (interp.c:3013)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 328 (28 direct, 300 indirect) bytes in 1 blocks are definitely lost
in loss record 26 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41079BD: MVM_malloc (alloc.h:2)
==988==    by 0x41082FE: unmarshal_callback (nativecall_dyncall.c:95)
==988==    by 0x410ACCD: MVM_nativecall_invoke (nativecall_dyncall.c:556)
==988==    by 0x40DC5A6: MVM_interp_run (interp.c:3955)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 350 bytes in 41 blocks are definitely lost in loss record 27 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41700D5: MVM_malloc (alloc.h:2)
==988==    by 0x4174A7B: MVM_serialization_read_cstr (serialization.c:1631)
==988==    by 0x4177425: deserialize_stable (serialization.c:2592)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x416ECB4: MVM_sc_get_sc_object (sc.c:199)
==988==    by 0x40D5BAF: MVM_interp_run (interp.c:3013)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==
==988== 432 bytes in 9 blocks are definitely lost in loss record 35 of 56
==988==    at 0x402C109: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x4170116: MVM_calloc (alloc.h:11)
==988==    by 0x4177041: deserialize_stable (serialization.c:2534)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x416ECB4: MVM_sc_get_sc_object (sc.c:199)
==988==    by 0x40D5BAF: MVM_interp_run (interp.c:3013)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 436 bytes in 14 blocks are definitely lost in loss record 36 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41700D5: MVM_malloc (alloc.h:2)
==988==    by 0x4174A7B: MVM_serialization_read_cstr (serialization.c:1631)
==988==    by 0x4177425: deserialize_stable (serialization.c:2592)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x40EF8EC: MVM_frame_vivify_lexical (frame.c:1100)
==988==    by 0x414DCD0: at_key (MVMContext.c:61)
==988==    by 0x40D175B: MVM_interp_run (interp.c:2297)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 776 bytes in 14 blocks are definitely lost in loss record 47 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41700D5: MVM_malloc (alloc.h:2)
==988==    by 0x4176DCF: deserialize_stable (serialization.c:2497)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x40EF8EC: MVM_frame_vivify_lexical (frame.c:1100)
==988==    by 0x414DCD0: at_key (MVMContext.c:61)
==988==    by 0x40D175B: MVM_interp_run (interp.c:2297)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 6,900 (896 direct, 6,004 indirect) bytes in 14 blocks are definitely
lost in loss record 53 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x413E774: MVM_malloc (alloc.h:2)
==988==    by 0x4141CFA: deserialize_repr_data (P6opaque.c:970)
==988==    by 0x4177469: deserialize_stable (serialization.c:2599)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x40EF8EC: MVM_frame_vivify_lexical (frame.c:1100)
==988==    by 0x414DCD0: at_key (MVMContext.c:61)
==988==    by 0x40D175B: MVM_interp_run (interp.c:2297)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988==
==988== 10,156 (2,048 direct, 8,108 indirect) bytes in 32 blocks are
definitely lost in loss record 54 of 56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x413E774: MVM_malloc (alloc.h:2)
==988==    by 0x4141CFA: deserialize_repr_data (P6opaque.c:970)
==988==    by 0x4177469: deserialize_stable (serialization.c:2599)
==988==    by 0x4177710: work_loop (serialization.c:2666)
==988==    by 0x41778CF: MVM_serialization_demand_object
(serialization.c:2703)
==988==    by 0x416EBC1: MVM_sc_get_object (sc.c:183)
==988==    by 0x416ECB4: MVM_sc_get_sc_object (sc.c:199)
==988==    by 0x40D5BAF: MVM_interp_run (interp.c:3013)
==988==    by 0x41C8D6A: MVM_vm_run_file (moar.c:304)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== 120,032 bytes in 3,751 blocks are possibly lost in loss record 56 of
56
==988==    at 0x402A17C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==988==    by 0x41ABFAD: MVM_malloc (alloc.h:2)
==988==    by 0x41B316E: generate_property_codes_by_names_aliases
(unicode.c:49970)
==988==    by 0x41B3B4B: MVM_unicode_name_to_property_code (unicode.c:49983)
==988==    by 0x40CBC97: MVM_interp_run (interp.c:1546)
==988==    by 0x41C8D40: MVM_vm_run_file (moar.c:291)
==988==    by 0x8048EA5: main (main.c:191)
==988== 
==988== LEAK SUMMARY:
==988==    definitely lost: 5,639 bytes in 196 blocks
==988==    indirectly lost: 14,435 bytes in 677 blocks
==988==      possibly lost: 120,032 bytes in 3,751 blocks
==988==    still reachable: 13,660 bytes in 32 blocks
==988==         suppressed: 0 bytes in 0 blocks
==988== Reachable blocks (those to which a pointer was found) are not shown.
==988== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==988== 
==988== For counts of detected and suppressed errors, rerun with: -v
==988== ERROR SUMMARY: 44 errors from 24 contexts (suppressed: 0 from 0)

Reply via email to