TEE Data Transmission via Shared Memory Offset Buffering

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing TEE systems face performance losses due to inefficient data transmission between the TEE and non-TEE sides, particularly during operations like log printing, where context switching and shared memory management lead to overheads and delays.

Innovation Solution

A method and apparatus for data transmission in a TEE system utilizing a shared memory with specific address structures for write and read offsets, allowing asynchronous data transfer by determining writable bytes and managing data discard when necessary, ensuring high-performance asynchronous data transmission.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If data transmission is performed through special instructions (SMC call, ECall/OCall) in existing TEE systems, then data security and confidentiality are guaranteed, but execution speed and performance are reduced due to context switching and waiting overheads

Engineering Contradiction:
Improvedata securityVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent pre-allocates a shared memory buffer on the non-TEE side before data transmission is needed. This buffer is prepared in advance with proper memory mapping and permissions configured, so that when data needs to be transmitted, the TEE side can directly write to the pre-prepared buffer address without performing context switching or waiting for non-TEE side readiness, thus eliminating the performance overhead while maintaining security through the established memory protection mechanisms

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent extracts the buffer allocation and management functionality from the TEE execution context and places it on the non-TEE side. The non-TEE side thread continuously monitors and manages the shared memory buffer, handling buffer allocation, data copying, and status updates outside the TEE context. This allows the TEE side to simply write data to the buffer without context switching, while the non-TEE side handles the complex buffer management operations that don't require TEE security guarantees

Inventive Principle:
Principle #2Taking out (Extraction)

2Productivity

If a shared memory buffer is used for data transmission, then transmission efficiency is improved, but memory management complexity and overhead increase

Engineering Contradiction:
Improvetransmission efficiencyVSAvoidmemory management complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent implements a self-managing buffer system where the non-TEE side thread automatically monitors the shared memory buffer status, detects when data has been written, and autonomously handles data copying and buffer management without requiring explicit TEE side intervention. The system uses atomic operations and memory barriers to ensure thread-safe access without complex locking mechanisms, and automatically recycles buffer space after data transmission, reducing management overhead

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent introduces a non-TEE side thread as an intermediary between the TEE side data producer and the final data destination. This intermediary thread handles all complex buffer management operations including allocation, data copying, and status tracking, while the TEE side simply performs simple write operations. The intermediary abstracts the complexity of memory management from the TEE execution context, reducing overhead while maintaining efficiency

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS11042642B2Method and apparatus for data transmission in a TEE system
Publication Date: 2021.06.22 ANTCHAIN TECHNOLOGY PTE LTD
  • US11042642B2 patent drawing
  • US11042642B2 patent drawing
  • US11042642B2 patent drawing

AI summary

A computer-implemented method, non-transitory, computer-readable medium, and computer-implemented system are provided for data transmission in a trusted execution environment (TEE) system. The method can be executed by a thread on a TEE side of the TEE system. The method includes obtaining first data; calling a predetermined function using the first data as an input parameter to switch to a non-TEE side; obtaining a write offset address by reading a first address; obtaining a read offset address by reading a second address; determining whether a quantity of bytes of the first data is less than or equal to a quantity of writable bytes; if so, writing the first data into third addresses starting from the write offset address; updating the write offset address in the first address; and returning to the TEE side.