Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

donaldsharp
Copy link

Version 0.8.0 of the library is generating this valgrind issues:

==3239843== Thread 5:
==3239843== Syscall param write(buf) points to uninitialised byte(s)
==3239843== at 0x4D308BF: __libc_write (write.c:26)
==3239843== by 0x4D308BF: write (write.c:24)
==3239843== by 0x486665A: rpki_update_cb_sync_rtr (bgp_rpki.c:758)
==3239843== by 0x54D5B9B: pfx_table_notify_clients (trie-pfx.c:64)
==3239843== by 0x54D65AD: pfx_table_add (trie-pfx.c:267)
==3239843== by 0x54DB8C6: rtr_update_pfx_table (packets.c:906)
==3239843== by 0x54DC7D8: rtr_sync_receive_and_store_pdus (packets.c:1178)
==3239843== by 0x54DD2FA: rtr_sync (packets.c:1377)
==3239843== by 0x54D94FB: rtr_fsm_start (rtr.c:155)
==3239843== by 0x4CB0AC2: start_thread (pthread_create.c:442)
==3239843== by 0x4D41A03: clone (clone.S:100)
==3239843== Address 0xa786e5c is on thread 5's stack
==3239843== in frame #2, created by pfx_table_notify_clients (trie-pfx.c:62)

Upon inspection of the code it was noticed that the struct pfx_record is being declared on the stack directly and then written to and passed to the callback function, in which the callback function does an immediate write of the data that was handed to it. Modify the code such that it initializes the stack data to 0's before working on it.

@waehlisch waehlisch requested a review from Brias August 28, 2025 12:29
@donaldsharp
Copy link
Author

so ci is failing because tests are failing in ci. When I run make test it passes for me. What should I be looking for/compiling to see where I've gone wrong? Does anyone have a hint?

Version 0.8.0 of the library is generating this valgrind issues:

==3239843== Thread 5:
==3239843== Syscall param write(buf) points to uninitialised byte(s)
==3239843==    at 0x4D308BF: __libc_write (write.c:26)
==3239843==    by 0x4D308BF: write (write.c:24)
==3239843==    by 0x486665A: rpki_update_cb_sync_rtr (bgp_rpki.c:758)
==3239843==    by 0x54D5B9B: pfx_table_notify_clients (trie-pfx.c:64)
==3239843==    by 0x54D65AD: pfx_table_add (trie-pfx.c:267)
==3239843==    by 0x54DB8C6: rtr_update_pfx_table (packets.c:906)
==3239843==    by 0x54DC7D8: rtr_sync_receive_and_store_pdus (packets.c:1178)
==3239843==    by 0x54DD2FA: rtr_sync (packets.c:1377)
==3239843==    by 0x54D94FB: rtr_fsm_start (rtr.c:155)
==3239843==    by 0x4CB0AC2: start_thread (pthread_create.c:442)
==3239843==    by 0x4D41A03: clone (clone.S:100)
==3239843==  Address 0xa786e5c is on thread 5's stack
==3239843==  in frame rtrlib#2, created by pfx_table_notify_clients (trie-pfx.c:62)

Upon inspection of the code it was noticed that the `struct pfx_record`
is being declared on the stack directly and then written to and passed
to the callback function, in which the callback function does an
immediate write of the data that was handed to it.  Modify the
code such that it initializes the stack data to 0's before working
on it.

Signed-off-by: Donald Sharp <[email protected]>
Valgrind is reporting a couple of different issues with
running the tests.  Let's clean them up a bit.

Signed-off-by: Donald Sharp <[email protected]>
@waehlisch
Copy link
Member

@Brias can you have a look into this PR?

@Brias
Copy link
Contributor

Brias commented Sep 17, 2025

@donaldsharp Thanks for this PR 👍. The changes in the source code look good from my perspective. I will merge this PR once the two open PRs #316 and #317 have been merged; they will also fix the CI issues in this PR I guess.

@Brias Brias self-assigned this Sep 17, 2025
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

Successfully merging this pull request may close these issues.

3 participants