Skip to content

xtest: stats: handle an empty TA list - #861

Merged
jenswikl merged 1 commit into
OP-TEE:masterfrom
viiavi:fix/stats-empty-ta-list
Nov 27, 2026
Merged

jenswikl merged 1 commit into
OP-TEE:masterfrom
viiavi:fix/stats-empty-ta-list

Conversation

@viiavi

@viiavi viiavi commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

When no user trusted applications are loaded, STATS_CMD_TA_STATS returns
TEEC_ERROR_ITEM_NOT_FOUND. Currently, xtest --stats --ta treats this as a
command failure and exits with status 1. Handle this result by printing
No loaded TA found and closing the session successfully.

The change is limited to four added lines in host/xtest/stats.c.

Validation on QEMU Armv8-A:

  • Reproduced the empty-list failure using the saved original xtest executable:
    res 0xffff0008 err_orig 0x4, exit status 1.
  • The patched executable prints No loaded TA found and exits with status 0.
  • With a SIMS keepalive test TA session held open, the patched executable prints
    its UUID and statistics and exits with status 0.
  • An unexpected argument is still rejected with usage output and status 1.
  • The full xtest suite passes: 1,546 test cases.
  • Linux checkpatch.pl: 0 errors, 0 warnings.

The targeted checks and patched regression run used RUST_ENABLE=n,
CFG_TA_STATS=y, MEASURED_BOOT_FTPM=n, and an empty
CFG_IN_TREE_EARLY_TAS. The optional boot-loaded TAs were disabled to construct
the empty-list case. This does not claim coverage of Rust examples, hardware
platforms, or keyctl tests in this configuration. The additional QEMU test
harness was kept outside the repository; no new regression test is included
in this patch.

@etienne-lms etienne-lms left a comment

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.

Reviewed-by: Etienne Carriere <etienne.carriere@st.com>

@viiavi
viiavi force-pushed the fix/stats-empty-ta-list branch from 1fcc8e8 to 2657d38 Compare November 23, 2026 14:28
@viiavi

viiavi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Added the Reviewed-by tag to the commit. The code is unchanged and the patch is ready for merging. Thank you for the review.

@viiavi
viiavi force-pushed the fix/stats-empty-ta-list branch from 2657d38 to d312ed5 Compare November 23, 2026 14:28
@jenswikl

Copy link
Copy Markdown
Contributor

Please add your real name and a real email address https://optee.readthedocs.io/en/latest/general/contribute.html#developer-certificate-of-origin

STATS_CMD_TA_STATS returns TEEC_ERROR_ITEM_NOT_FOUND when no user
trusted applications are loaded. Handle this result by printing
"No loaded TA found" and closing the session successfully instead
of reporting a command failure.

Signed-off-by: Vainavi Arun Kumar <vainaviarunkumar@gmail.com>
Reviewed-by: Etienne Carriere <etienne.carriere@st.com>
@viiavi
viiavi force-pushed the fix/stats-empty-ta-list branch from d312ed5 to f3c9843 Compare November 26, 2026 14:12
@viiavi

viiavi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Updated the commit author, committer, and Signed-off-by to my full name and real email address. The Reviewed-by tag is retained and the code is unchanged. Thank you for the guidance.

@jenswikl

Copy link
Copy Markdown
Contributor

Merging when CI passes.

@jenswikl
jenswikl merged commit b0a6daa into OP-TEE:master Nov 27, 2026
2 checks passed
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