Skip to content

Support multiple built-in TAs#829

Open
athvu wants to merge 2 commits intomainfrom
avu/multi_ta
Open

Support multiple built-in TAs#829
athvu wants to merge 2 commits intomainfrom
avu/multi_ta

Conversation

@athvu
Copy link
Copy Markdown
Contributor

@athvu athvu commented May 4, 2026

This PR adds support for having multiple built-in TAs.

Copy link
Copy Markdown
Contributor

@sangho2 sangho2 left a comment

Choose a reason for hiding this comment

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

Hi Angelina, Thank you for your PR!

I've requested a minor change to maintain the core behavior of load_ldelf.

Comment thread litebox_shim_optee/src/lib.rs Outdated
Comment on lines +230 to +232
if ta_bin.is_none() {
return Err(loader::elf::ElfLoaderError::InvalidUuid);
}
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.

ta_bin == None will trigger dynamic TA loading (once it is ready). So, None is an expected value.

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.

Thank you for the review!

There is an issue with loading the OP-TEE module if I remove this.
As part of optee_probe(), there is a call to optee_enumerate_devices() which opens a session with device enumeration PTA. On the LiteBox side, this is handled as a normal TA.
Currently, Some(TA_BINARY) is passed to load_ldelf() as the ta_bin: Option<&[u8]> argument and the function returns Err(loader::elf::ElfLoaderError::InvalidUuid) at this point:

        if let Some(ta_bin) = ta_bin
            && !entrypoints.task.global.store_ta_bin(&ta_uuid, ta_bin)
        {
            return Err(loader::elf::ElfLoaderError::InvalidUuid);
        }

Then, returning to VTL0 and skipping the rest of the device enumeration code.

With my changes, None is passed to load_ldelf(), instead of Some(TA_BINARY), so the rest of load_ldelf() runs and returns Ok() and eventually there is a panic when ldelf tries to load the TA:

ldelf/TA_CreateEntryPoint failed: return_code=ItemNotFound
panicked at litebox_runner_lvbs/src/lib.rs:1209:5:

How would you suggest handling this?

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.

I think we shouldn't call load_ldelf in that case. load_ldelf is for loading a TA ELF binary through ldelf. PTA is not an ELF binary. I think it might be better to call find_ta_binary before load_ldelf and return InvalidUuid if it fails to find a corresponding TA.

Angelina Vu added 2 commits May 5, 2026 18:00
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

🤖 SemverChecks 🤖 No breaking API changes detected

Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered.

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.

2 participants