Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory issue in test_execprocess that shows up with valgrind #343

Closed
jesper-friis opened this issue Sep 20, 2022 · 1 comment
Closed

Comments

@jesper-friis
Copy link
Collaborator

However, this issue does not shows up when running te test program manually eo via gdb, making rather hard to debug...

Output from valgrind:

$ valgrind src/utils/tests/test_execprocess 
==714222== Memcheck, a memory error detector
==714222== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==714222== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==714222== Command: src/utils/tests/test_execprocess
==714222== 
==714226== Syscall param execve(argv) points to unaddressable byte(s)
==714226==    at 0x48A599B: execve (syscall-template.S:120)
==714226==    by 0x401C27: exec_process (execprocess.c:116)
==714226==    by 0x401479: test_exec_process (test_execprocess.c:23)
==714226==    by 0x40189F: test_suite (test_execprocess.c:61)
==714226==    by 0x401AE9: main (test_execprocess.c:69)
==714226==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==714226== 
** Fatal 1: cannot execute pathname /home/jesperf/prosjekter/software/dlite/build/src/utils/tests/test_uuid: Bad address
==714226== 
==714226== HEAP SUMMARY:
==714226==     in use at exit: 0 bytes in 0 blocks
==714226==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==714226== 
==714226== All heap blocks were freed -- no leaks are possible
==714226== 
==714226== For lists of detected and suppressed errors, rerun with: -s
==714226== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
F
test_exec_process failed:
        /home/jesperf/prosjekter/software/dlite/src/utils/tests/test_execprocess.c:24: 0 expected but was 256
....

3 tests, 5 assertions, 1 failures

Finished in 0.00000000 seconds (real) 0.02006200 seconds (proc)

==714222== 
==714222== HEAP SUMMARY:
==714222==     in use at exit: 0 bytes in 0 blocks
==714222==   total heap usage: 228 allocs, 228 frees, 15,096 bytes allocated
==714222== 
==714222== All heap blocks were freed -- no leaks are possible
==714222== 
==714222== For lists of detected and suppressed errors, rerun with: -s
==714222== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Output without valgrind:

$ src/utils/tests/test_execprocess 
bswap_16           : OK
bswap_32           : OK
bswap_64           : OK
md5                : OK
sha1               : OK
uuid3              : OK
uuid5              : OK
uuid_as_string     : OK
uuid_from_string   : OK
.....

3 tests, 5 assertions, 0 failures

Finished in 0.00000000 seconds (real) 0.00000000 seconds (proc)
@jesper-friis
Copy link
Collaborator Author

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant