Skip to content

ubjson: valgrind registers "Invalid write of size 4" in unittests #2175

@miri64

Description

@miri64

There's a problem with the stack in tests/unittests/tests-ubjson/tests-ubjson.c

$ make -C tests/unittests/ all-valgrind term-valgrind 
[…]

kernel_init(): This is RIOT! (Version: 2014.05-1780-gbd80)
kernel_init(): jumping into first task...
.......................................................................................................................................................................................................==14552== Invalid write of size 4
==14552==    at 0x40A5BD8: makecontext (/build/buildd/eglibc-2.19/stdlib/../sysdeps/unix/sysv/linux/i386/makecontext.S:82)
==14552==    by 0x804B76C: thread_stack_init (cpu/native/native_cpu.c:131)
==14552==    by 0x80498AC: thread_create (core/thread.c:188)
==14552==    by 0x8062F90: test_ubjson_test (tests/unittests/tests-ubjson/tests-ubjson.c:87)
==14552==    by 0x8063B65: test_ubjson_empty_object (tests/unittests/tests-ubjson/test-ubjson-empty-object.c:128)
==14552==    by 0x8065B44: TestCase_run (in /home/martine/Repositories/RIOT-OS/RIOT/tests/unittests/bin/native/unittests.elf)
==14552==    by 0x8065AC1: TestCaller_run (in /home/martine/Repositories/RIOT-OS/RIOT/tests/unittests/bin/native/unittests.elf)
==14552==    by 0x8065E4D: TestRunner_runTest (in /home/martine/Repositories/RIOT-OS/RIOT/tests/unittests/bin/native/unittests.elf)
==14552==    by 0x8063007: tests_ubjson (tests/unittests/tests-ubjson/tests-ubjson.c:112)
==14552==    by 0x804C643: main (tests/unittests/main.c:30)
==14552==  Location 0x8080b4c is 0 bytes inside receiver_stack[7788],
==14552==  a global variable declared at tests-ubjson.c:30
==14552== 
==14552== Invalid write of size 4
==14552==    at 0x40A5B57: setcontext (/build/buildd/eglibc-2.19/stdlib/../sysdeps/unix/sysv/linux/i386/setcontext.S:73)
==14552==  Location 0x8080b48 is 0 bytes inside receiver_stack[7784],
==14552==  a global variable declared at tests-ubjson.c:30
==14552== 
==14552== Invalid read of size 4
==14552==    at 0x40A5B6D: setcontext (/build/buildd/eglibc-2.19/stdlib/../sysdeps/unix/sysv/linux/i386/setcontext.S:92)
==14552==    by 0x8062ED4: test_ubjson_read_fun (tests/unittests/tests-ubjson/tests-ubjson.c:62)
==14552==    by 0x40A5BDA: makecontext (/build/buildd/eglibc-2.19/stdlib/../sysdeps/unix/sysv/linux/i386/makecontext.S:87)
==14552==    by 0x8079E87: ???
==14552==  Location 0x8080b48 is 0 bytes inside receiver_stack[7784],
==14552==  a global variable declared at tests-ubjson.c:30
==14552== 
==14552== Invalid read of size 4
==14552==    at 0x8062F25: test_ubjson_receiver_trampoline (tests/unittests/tests-ubjson/tests-ubjson.c:75)
==14552==    by 0x40A5BDA: makecontext (/build/buildd/eglibc-2.19/stdlib/../sysdeps/unix/sysv/linux/i386/makecontext.S:87)
==14552==    by 0x8079E87: ???
==14552==  Location 0x8080b4c is 0 bytes inside receiver_stack[7788],
==14552==  a global variable declared at tests-ubjson.c:30
==14552== 

OK (199 tests)
XXX: lpm_set(): LPM_POWERDOWN not implemented
lpm_set(): exit()
==14552== 
==14552== HEAP SUMMARY:
==14552==     in use at exit: 0 bytes in 0 blocks
==14552==   total heap usage: 11 allocs, 11 frees, 1,555 bytes allocated
==14552== 
==14552== All heap blocks were freed -- no leaks are possible
==14552== 
==14552== For counts of detected and suppressed errors, rerun with: -v
==14552== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
make: Leaving directory `/home/martine/Repositories/RIOT-OS/RIOT/tests/unittests'

Metadata

Metadata

Assignees

Labels

Area: testsArea: tests and testing frameworkImpact: minorThe PR is small in size and might only require a quick look of a knowledgeable reviewerState: staleState: The issue / PR has no activity for >185 daysType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions