Skip to content

minkipc: add patch for pkcs11 static initialization issue#2739

Open
Jiaxing Li (jiaxli-QC) wants to merge 1 commit into
qualcomm-linux:masterfrom
jiaxli-QC:fix/pkcs11-compound_variable_fix
Open

minkipc: add patch for pkcs11 static initialization issue#2739
Jiaxing Li (jiaxli-QC) wants to merge 1 commit into
qualcomm-linux:masterfrom
jiaxli-QC:fix/pkcs11-compound_variable_fix

Conversation

@jiaxli-QC

@jiaxli-QC Jiaxing Li (jiaxli-QC) commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

meta-qcom uses OP-TEE optee_test v4.0.0, where pkcs11 test code takes the address of a compound literal in a static initializer (e.g. &(CK_BBOOL){CK_TRUE}). Under compiler optimization, the storage for such compound literals may be reused or overlap with other objects, which can result in invalid values being read back during the test.

Add a new patch (0003) to the minkipc recipe's optee_test source to fix this issue, and reference it in SRC_URI. The patch replaces the compound literal usage with statically allocated objects to ensure correct initialization and improve reliability.

Inherited from: #2726

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Test run workflow

Test jobs for commit f98f934

qcom-distro_linux-qcom-6.18
Pass: 221 | Fail: 0 | Total: 254
qcom-distro
Pass: 270 | Fail: 1 | Total: 302
nodistro
Pass: 10 | Fail: 0 | Total: 10

@test-reporting-app

test-reporting-app Bot commented Jul 15, 2026

Copy link
Copy Markdown

Test Results

  110 files  +   89    652 suites  +631   9h 34m 59s ⏱️ + 8h 39m 32s
  159 tests +  148    151 ✅ +  147   1 💤 + 1   7 ❌ ±0 
4 212 runs  +4 027  4 136 ✅ +3 959  64 💤 +64  12 ❌ +4 

For more details on these failures, see this check.

Results for commit f98f934. ± Comparison against base commit 2be91de.

This pull request removes 4 and adds 152 tests. Note that renamed tests count towards both.
lava ‑ auto-login-action
lava ‑ boot-qdl-retry
lava ‑ flash-qdl
lava ‑ minimal-boot
0_AudioRecord_Config01 ‑ AudioRecord_Config01
0_BT_FW_KMD_Service ‑ BT_FW_KMD_Service
0_GStreamer_Video_Encode_h264_480p ‑ GStreamer_Video_Encode_h264_480p
0_Libcamera_cam ‑ Libcamera_cam
0_Weston_Runtime_Preflight ‑ Weston_Runtime_Preflight
0_hotplug ‑ hotplug
10_AudioRecord ‑ AudioRecord
10_Docker_Kernel_Config ‑ Docker_Kernel_Config
10_Kubernetes_Kernel_Config ‑ Kubernetes_Kernel_Config
11_DSP_AudioPD ‑ DSP_AudioPD
…

♻️ This comment has been updated with latest results.

@ricardosalveti

Copy link
Copy Markdown
Contributor

Why are we having this PR which is duplicating #2726 and ignoring the review comments which were already made there?

@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit 14b6a01

  • qcomdistro: multimedia image-prop
    Pass: 27 | Fail: 2 | Total: 29
  • qcomdistro: multimedia image
    Pass: 9 | Fail: 0 | Total: 9

@harshaldev27

Copy link
Copy Markdown
Contributor

Why are we having this PR which is duplicating #2726 and ignoring the review comments which were already made there?

Hi Ricardo Salveti (@ricardosalveti) , I checked with the original PR owner, they informed me that they are unable to validate the PR due to environment setup issues on their Linux machine. Hence, they've closed that PR and asked Jiaxing Li (@jiaxli-QC) to take over.

Jiaxing Li (@jiaxli-QC) can you please take care of the comments provided on the other PR and ensure we are aligned with the expectations here?

Modified the compound literals used for session object templates to avoid problems arising from taking the address of a compound literal during
static initialization.

Upstream-Status: Inappropriate [tests applicable for optee]

@harshaldev27 Harshal Dev (harshaldev27) Jul 16, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Upstream-Status is wrong, please mention the status as 'Submitted/Merged' and explain that this patch for back-porting the fix to our v4.0.0 tag of optee-test.

@jiaxli-QC Jiaxing Li (jiaxli-QC) Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit: 75f4e20

Updated.

@jiaxli-QC
Jiaxing Li (jiaxli-QC) force-pushed the fix/pkcs11-compound_variable_fix branch 2 times, most recently from a64f430 to 75f4e20 Compare July 16, 2026 09:36
@jiaxli-QC Jiaxing Li (jiaxli-QC) changed the title optee-test: pkcs11: Fix static initialization issue caused by compound literal address minkipc: add patch for pkcs11 static initialization issue Jul 16, 2026
@jiaxli-QC

Jiaxing Li (jiaxli-QC) commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Why are we having this PR which is duplicating #2726 and ignoring the review comments which were already made there?

Hi Ricardo Salveti (Ricardo Salveti (@ricardosalveti)) , I checked with the original PR owner, they informed me that they are unable to validate the PR due to environment setup issues on their Linux machine. Hence, they've closed that PR and asked Jiaxing Li (Jiaxing Li (@jiaxli-QC)) to take over.

Jiaxing Li (Jiaxing Li (@jiaxli-QC)) can you please take care of the comments provided on the other PR and ensure we are aligned with the expectations here?

Yes, Updated. Please review.

All test cases for PKCS#11 passed on PURWA.

~# xtest_qtee
Run test suite with level=0

TEE test application started over default TEE instance
######################################################
#
# pkcs11
#
######################################################
.
.
.
+-----------------------------------------------------
Result of testsuite pkcs11:
pkcs11_1000 OK
pkcs11_1001 OK
pkcs11_1002 OK
pkcs11_1003 OK
pkcs11_1004 OK
pkcs11_1005 OK
pkcs11_1006 OK
pkcs11_1007 OK
pkcs11_1008 OK
pkcs11_1009 OK
pkcs11_1010 OK
pkcs11_1011 OK
pkcs11_1012 OK
pkcs11_1013 OK
pkcs11_1014 OK
pkcs11_1015 OK
pkcs11_1017 OK
pkcs11_1020 OK
pkcs11_1022 OK
pkcs11_1023 OK
pkcs11_1024 OK
+-----------------------------------------------------
3580 subtests of which 0 failed
21 test cases of which 0 failed
0 test cases were skipped
TEE test application done!

@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit 75f4e20

  • qcomdistro: multimedia image
    Pass: 10 | Fail: 1 | Total: 11
  • qcomdistro: multimedia image-prop
    Pass: 41 | Fail: 1 | Total: 42

@anujm1

Copy link
Copy Markdown
Contributor

Add a new patch (0003) to the minkipc recipe's optee_test source to
fix this issue, and reference it in SRC_URI.

Which issue? The issue is mentioned in PR description but not the commit message.

@jiaxli-QC

Copy link
Copy Markdown
Contributor Author

Add a new patch (0003) to the minkipc recipe's optee_test source to
fix this issue, and reference it in SRC_URI.

Which issue? The issue is mentioned in PR description but not the commit message.

I think that I have described the issue in the second paragraph of the commit message and explained why we need this patch. Please review it.

minkipc: add patch for pkcs11 static initialization issue
Add a new patch (0003) to the minkipc recipe's optee_test source to
fix this issue, and reference it in SRC_URI.
This patch is required because meta-qcom uses OP-TEE optee_test v4.0.0,
where taking the address of a compound literal in a static initializer
(&(CK_BBOOL){CK_TRUE} etc.) may be reused or overlapped by the compiler
under optimization, which can result in invalid values.
Backport of OP-TEE/optee_test@31fa5e6.

Signed-off-by: Jiaxing Li jiaxing.li@oss.qualcomm.com

@lumag

Copy link
Copy Markdown
Contributor

Start by describing the issue.

meta-qcom uses OP-TEE optee_test v4.0.0, where pkcs11 test code takes
the address of a compound literal in a static initializer (e.g.
&(CK_BBOOL){CK_TRUE}). Under compiler optimization, the storage for such
compound literals may be reused or overlap with other objects, which can
result in invalid values being read back during the test.

Add a new patch (0003) to the minkipc recipe's optee_test source to fix
this issue, and reference it in SRC_URI. The patch replaces the compound
literal usage with statically allocated objects to ensure correct
initialization and improve reliability.

Backport of OP-TEE/optee_test@31fa5e6.

Signed-off-by: Jiaxing Li <jiaxing.li@oss.qualcomm.com>
@jiaxli-QC
Jiaxing Li (jiaxli-QC) force-pushed the fix/pkcs11-compound_variable_fix branch from 75f4e20 to f98f934 Compare July 20, 2026 06:55
@jiaxli-QC

Copy link
Copy Markdown
Contributor Author

Update commit message.
(f98f934)

@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit f98f934

  • qcomdistro: multimedia image
    Pass: 10 | Fail: 0 | Total: 10
  • qcomdistro: multimedia image-prop
    Pass: 54 | Fail: 2 | Total: 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants