-
Notifications
You must be signed in to change notification settings - Fork 365
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
TCTI: Separate namespaces for internal struct #2843
base: master
Are you sure you want to change the base?
TCTI: Separate namespaces for internal struct #2843
Conversation
@@ -622,7 +622,7 @@ TSS2_RC Tss2_Tcti_Cmd_Init (TSS2_TCTI_CONTEXT *tctiContext, size_t *size, | |||
} | |||
|
|||
/* public info structure */ | |||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_cmd_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndreasFuchsTPM any reason not to make these static
too, just to reduce the incidence of these?
src/tss2-tcti/tcti-i2c-helper.c
Outdated
@@ -846,7 +846,7 @@ TSS2_RC Tss2_Tcti_I2c_Helper_Init (TSS2_TCTI_CONTEXT* tcti_context, size_t* size | |||
return TSS2_RC_SUCCESS; | |||
} | |||
|
|||
static const TSS2_TCTI_INFO tss2_tcti_info = { | |||
static const TSS2_TCTI_INFO tss2_tcti_i2c_helper_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndreasFuchsTPM why is this one static, but the other ones aren't?
Some (dynamic) linkers seam to resolve internal symbols against the loading library in a dlopen() instead of its local symbols. Namely a tss2_tcti_info symbol ref of e.g. tcti-device would resolve against the symbol of tctildr. We protect against such situations by separating the names. Signed-off-by: Andreas Fuchs <andreas.fuchs@infineon.com>
a3c0f8c
to
b1d63ca
Compare
Final piece of why you should always use |
@@ -622,7 +622,7 @@ TSS2_RC Tss2_Tcti_Cmd_Init (TSS2_TCTI_CONTEXT *tctiContext, size_t *size, | |||
} | |||
|
|||
/* public info structure */ | |||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_cmd_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_cmd_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_cmd_info = { |
@@ -530,7 +530,7 @@ Tss2_Tcti_Device_Init ( | |||
return TSS2_RC_SUCCESS; | |||
} | |||
|
|||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_device_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_device_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_device_info = { |
@@ -280,7 +280,7 @@ Tss2_Tcti_I2c_Ftdi_Init (TSS2_TCTI_CONTEXT* tcti_context, size_t* size, const ch | |||
return Tss2_Tcti_I2c_Helper_Init (tcti_context, size, &tcti_platform); | |||
} | |||
|
|||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_i2c_ftdi_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_i2c_ftdi_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_i2c_ftdi_info = { |
@@ -846,7 +846,7 @@ TSS2_RC Tss2_Tcti_I2c_Helper_Init (TSS2_TCTI_CONTEXT* tcti_context, size_t* size | |||
return TSS2_RC_SUCCESS; | |||
} | |||
|
|||
static const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_i2c_helper_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_i2c_helper_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_i2c_helper_info = { |
@@ -880,7 +880,7 @@ Tss2_Tcti_Libtpms_Init( | |||
} | |||
|
|||
/* public info structure */ | |||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_libtpms_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_libtpms_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_libtpms_info = { |
@@ -197,7 +197,7 @@ Tss2_Tcti_Spidev_Init (TSS2_TCTI_CONTEXT* tcti_context, size_t* size, const char | |||
return Tss2_Tcti_Spi_Helper_Init (tcti_context, size, &platform); | |||
} | |||
|
|||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_spidev_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_spidev_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_spidev_info = { |
@@ -639,7 +639,7 @@ Tss2_Tcti_Swtpm_Init ( | |||
} | |||
|
|||
/* public info structure */ | |||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_swtpm_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_swtpm_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_swtpm_info = { |
@@ -315,7 +315,7 @@ Tss2_Tcti_Tbs_Init ( | |||
return TSS2_RC_SUCCESS; | |||
} | |||
|
|||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_tbs_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_tbs_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_tbs_info = { |
@@ -587,7 +587,7 @@ TSS2_RC Tss2_Tcti_TctiLdr_Init (TSS2_TCTI_CONTEXT *tctiContext, size_t *size, | |||
} | |||
|
|||
__attribute__((weak)) | |||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tctildr_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tctildr_info = { | |
static const TSS2_TCTI_INFO tss2_tctildr_info = { |
@@ -265,7 +265,7 @@ Tss2_Tcti_Fuzzing_Init ( | |||
} | |||
|
|||
/* public info structure */ | |||
const TSS2_TCTI_INFO tss2_tcti_info = { | |||
const TSS2_TCTI_INFO tss2_tcti_fuzzing_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TSS2_TCTI_INFO tss2_tcti_fuzzing_info = { | |
static const TSS2_TCTI_INFO tss2_tcti_fuzzing_info = { |
@AndreasFuchsTPM ping |
@AndreasFuchsTPM any movement here? |
Some (dynamic) linkers seam to resolve internal symbols against the loading library in a dlopen() instead of its local symbols. Namely a tss2_tcti_info symbol ref of e.g. tcti-device would resolve against the symbol of tctildr.
We protect against such situations by separating the names.
Fixes: #2840