add debug trace in vxtss_symlist.c and vxtss.c (#72)

Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/72
Co-authored-by: siddhant <siddhant.singh@neominds.in>
Co-committed-by: siddhant <siddhant.singh@neominds.in>
This commit is contained in:
2026-07-30 20:45:01 +05:30
committed by neelimap
parent 680b258e4e
commit 4abf671aa0
2 changed files with 30 additions and 0 deletions
+2
View File
@@ -26,6 +26,7 @@ DESCRIPTION
#include <taskVarLib.h>
#include <vxtss_symlist.h>
#include <errnoLib.h>
#include <openssl/trace.h>
typedef void (*tss_dtor_t)(void*);
@@ -44,6 +45,7 @@ crypto_once(CRYPTO_ONCE *once_control, void (*init_routine)(void))
semTake(once_control->sem, WAIT_FOREVER);
if (!once_control->done) {
OSSL_TRACE1(TSS, "Init routine invoked, run_once_arg: %s\n", once_control->run_once_arg);
init_routine();
once_control->done = TRUE;
}
+28
View File
@@ -8,6 +8,7 @@
#include <taskHookLib.h>
#include <taskVarLib.h>
#include <vxtss_symlist.h>
#include <openssl/trace.h>
#define MAX_TSS_SYM_ENTRY 256
#define MAX_CLONE_ENTRIES 32
@@ -233,6 +234,7 @@ tss_symlist_add_new_internal(TASK_ID taskId,
void
tss_symlist_task_cleanup_hook(int taskId)
{
OSSL_TRACE2(TSS, "Cleanup hook invoked: task %s (0x%x)", name ? name : "(null)", (unsigned int)taskId);
const char *name = taskName(taskId);
CRYPTO_THREAD_write_lock(tss_sym_table_lock);
@@ -250,9 +252,15 @@ tss_symlist_task_cleanup_hook(int taskId)
*thread_local_ptr = (tss_t)0;
if (entry) {
/* Log the entry being cleaned */
OSSL_TRACE2(TSS, "Cleaning entry key='%s' arg='%s'",
tss_sym_table[i].info.tss_key_name ? tss_sym_table[i].info.tss_key_name : "(null)",
tss_sym_table[i].info.run_once_arg_str ? tss_sym_table[i].info.run_once_arg_str : "(null)");
/* Call destructor only if entry->var is non‑NULL and looks valid */
if (entry->var && tss_sym_table[i].info.dtor) {
OSSL_TRACE1(TSS, "Calling destructor for key '%s'",
tss_sym_table[i].info.tss_key_name);
tss_sym_table[i].info.dtor(entry->var);
}
@@ -269,6 +277,8 @@ tss_symlist_task_cleanup_hook(int taskId)
}
CRYPTO_THREAD_unlock(tss_sym_table_lock);
OSSL_TRACE(TSS, "Exiting cleanup hook\n");
}
/* Initialize the TSS symbol table and clone list */
@@ -313,6 +323,8 @@ tss_symlist_add_new(TASK_ID taskId, char *run_once_arg_str, char *tss_key_name,
run_once_arg_str == NULL || run_once_arg_str[0] == '\0')
return ERROR;
OSSL_TRACE2(TSS, "Adding new entry: %s, %s\n", run_once_arg_str, tss_key_name);
/* Acquire lock */
CRYPTO_THREAD_write_lock(tss_sym_table_lock);
@@ -331,6 +343,8 @@ tss_symlist_add_new(TASK_ID taskId, char *run_once_arg_str, char *tss_key_name,
tmp.tss_key = key;
tmp.dtor = tmp_entry ? tmp_entry->dtor : NULL;
tss_clone_list_add(&tmp);
OSSL_TRACE4(TSS, "Adding to clone list: run_once_arg_str: %s, key_name: %s, tss_key: %p, *tss_key: %p\n",
run_once_arg_str, tss_key_name, tmp.tss_key, *tmp.tss_key);
}
/* Release lock */
@@ -382,6 +396,8 @@ tss_create_and_update_table(tss_t *key, char *tss_key_name,
*key = (tss_t)0;
return ERROR;
}
OSSL_TRACE2(TSS, "Cloned and added an entry: %s, %s\n", run_once_arg_str, tss_key_name);
return OK;
}
@@ -438,6 +454,8 @@ tss_symlist_clone_entries_for_new_task(char *run_once_arg_string)
}
int i;
int clones_created = 0;
/* Iterate through clone list entries matching the argument string */
for (i = 0; i < MAX_CLONE_ENTRIES; i++) {
if (tss_clone_list[i].tss_key == NULL)
@@ -447,9 +465,19 @@ tss_symlist_clone_entries_for_new_task(char *run_once_arg_string)
tss_clone_list[i].run_once_arg_str,
tss_clone_list[i].tss_key,
tss_clone_list[i].dtor);
if (result == OK) {
clones_created++;
}
}
CRYPTO_THREAD_unlock(tss_sym_table_lock);
/* Show table only if clones were created, AFTER releasing the lock */
if (clones_created > 0) {
OSSL_TRACE3(TSS, "\n*** TSS Clone: Created %d entries for task %s (0x%x) ***\n",
clones_created, taskName((int)taskId) ? task_name : "(null)", (unsigned int)taskId);
}
}
/* De-initialize the TSS symbol table */