Skip to content

optee-teec: fix ConnectionMethods login codes and Context/Session Send-safety - #328

Merged
ivila merged 2 commits into
apache:mainfrom
ivila:bug/security-scan
Oct 16, 2026
Merged

ivila merged 2 commits into
apache:mainfrom
ivila:bug/security-scan

Conversation

@ivila

@ivila ivila commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Two related optee-teec fixes:

  1. Correct ConnectionMethods login-code mapping.
    ConnectionMethods previously derived its discriminants implicitly, but
    TEEC_LOGIN_APPLICATION, TEEC_LOGIN_USER_APPLICATION and
    TEEC_LOGIN_GROUP_APPLICATION are 0x4, 0x5, 0x6 (there is no 0x3),
    so login as u32 could pass a non-existent login code to
    TEEC_OpenSession. The variants are now pinned to the TEEC_LOGIN_*
    constants with #[repr(u32)] and num_enum, with an Unknown(u32)
    catch-all and a round-trip unit test covering every constant.

  2. Remove hand-written Send/Sync from Context and Session.

    • Context now holds Arc<Mutex<InnerContext>>, which is automatically
      Send + Sync because raw::TEEC_Context contains only scalars.
    • Session stores the opaque handle in a private
      RawTeecSession(raw::TEEC_Session) wrapper. A single, documented
      unsafe impl Send lives on that wrapper; Session itself is derived.
    • The raw handle is kept opaque and optee-teec-sys is untouched.

@ivila
ivila merged commit 9561be0 into apache:main Oct 16, 2026
16 checks passed
@ivila ivila added the enhancement New feature or request label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant