Hi,

I observe that in node_by_name hash we store a node with name 
"unix-cli-local:0" and node index 720 (not sure the purpose of the node).
The node name is stored as key in the node_by_name hash.
But later at some time when I print the node_by_name hash's each entry I see 
the key of node i.e the node name is printing some junk value (I figured it out 
via checking it against the node index).

When I looked at code in unix_cli_file_add(), below we are first time adding 
the node with name "unix-cli-local:0".

static vlib_node_registration_t r = {
.function = unix_cli_process,
.type = VLIB_NODE_TYPE_PROCESS,
.process_log2_n_stack_bytes = 18,
};

r.name = name;

vlib_worker_thread_barrier_sync (vm);

vlib_register_node (vm, &r);   <<<<<<<<<<<<
vec_free (name);

n = vlib_get_node (vm, r.index);
vlib_worker_thread_node_runtime_update ();
vlib_worker_thread_barrier_release (vm);

Later it again calls unix_cli_file_add(), there we pass a different name 
"unix-cli-local:1".
In this case we are overwriting the already existing node name from 
"unix-cli-local:0" to "unix-cli-local:1".

for (i = 0; i < vec_len (vlib_mains); i++)
{
this_vlib_main = vlib_mains[i];
if (this_vlib_main == 0)
continue;
n = vlib_get_node (this_vlib_main,
cm->unused_cli_process_node_indices[l - 1]);
old_name = n->name;          <<<<<<<<<<<
n->name = (u8 *) name;       <<<<<<<<<<<
}
vec_free (old_name);      <<<<<<<<<<

But the node name is already present in node_by_name hash as a key and there we 
haven't updated it instead we have deleted the old name.
This is resulting in printing some corrupted node name for the above node in 
node_by_name hash, which I think can sometimes results in VPP crash also as the 
hash key points to some freed memory.

Regards,
Sontu
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19560): https://lists.fd.io/g/vpp-dev/message/19560
Mute This Topic: https://lists.fd.io/mt/83471274/21656
Mute #vpp:https://lists.fd.io/g/vpp-dev/mutehashtag/vpp
Mute #vpp-dev:https://lists.fd.io/g/vpp-dev/mutehashtag/vpp-dev
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to