Part 1
요약·해설
app_memory 요구 사항과 flag 기반 shared/private memory 복사를 설명합니다.
PT · Encrypt · Print
Protected partitions
Enigma-like simulation
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
AAE734A7F8E5F97408CC13D980B45F6E0FAA9647A823C46DC341C54507B3BA12
.. _userspace_protected_memory:
Userspace Protected Memory
##########################
Overview
********
This sample is an example of running multiple threads assigned
unique memory domains with protected partitions. The
application uses memory partitioning with a sample algorithm
simulating an enigma-like machine, but the implementation of the
machine has not been validated and should not be used for any
actual security purposes.
Requirements
************
The sample is dependent on the subsystem app_memory, and it will
not run on boards that do not support the subsystem. The sample
was tested on the following boards qemu_x86,frdm_k64, and ``96b_carbon/stm32f401xe``.
Building and Running
********************
This example will only cover the qemu_x86 board, since the sample
just prints text to a console.
.. zephyr-app-commands::
:zephyr-app: samples/userspace/shared_mem
:board: qemu_x86
:goals: build run
:compact:
After starting, the console will display multiple starting messages
followed by two series of repeating messages. The repeating messages
are the input and output of the enigma-like machine. The second
message is the output of the first message, and the resulting
output is the first message without spaces. The two messages are
marked as 1 and 1' respectively.
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
Two definitions can be inserted to change the wheel settings and print
the state information. To enable the definitions uncomment the last
two lines in CMakeLists.txt.
Functionality
*************
The PT thread sends a message followed by the encrypted version of the
message after sleeping. To send the message the PT thread checks a
flag, and if it is clear, writes the message to a buffer shared with
the encrypt thread. After writing the buffer, the flag is set. The
encrypt thread copies the memory from the common buffer into the
encrypted thread's private memory when the flag is set and then clears
the flag. Once the encrypted thread receives the text string, it
performs a simulation of the enigma machine to produce cypher text(CT).
The CT is copied to a shared memory partition connecting to the third
thread. The third thread prints the CT to the console with a banner
denoting the content as CYPHER TEXT.
Part 3
한국어 전문 번역
개요
Protected partition을 가진 고유 memory domain에 여러 thread를 할당해 실행하는 example입니다. Enigma와 비슷한 machine을 흉내 내는 sample algorithm으로 memory partitioning을 보여 주지만, machine implementation은 검증되지 않았으므로 실제 security 목적으로 사용하면 안 됩니다.
요구 사항
이 sample은 app_memory subsystem에 의존하므로 subsystem을 지원하지 않는 board에서는 실행되지 않습니다. qemu_x86, frdm_k64, 96b_carbon/stm32f401xe에서 시험되었습니다.
빌드 및 실행
Sample은 console에 text만 출력하므로 여기서는 qemu_x86 board만 다룹니다. 다음 command로 build하고 실행합니다.
west build -b qemu_x86 samples/userspace/shared_mem
west build -t run
시작하면 여러 initialization message 뒤에 반복 message 두 묶음이 표시됩니다. 이는 Enigma-like machine의 input과 output입니다. 두 번째 message는 첫 번째 message를 변환한 결과이며, 결과에서 space를 제거하면 첫 번째 message가 됩니다. 두 message는 각각 1과 1'로 표시됩니다.
QEMU를 종료하려면 CTRL+A를 누른 뒤 x를 누릅니다.
Wheel setting을 바꾸고 state 정보를 출력하는 definition 두 개를 추가할 수 있습니다. 이를 활성화하려면 CMakeLists.txt의 마지막 두 줄에서 comment를 제거합니다.
기능
PT thread는 sleep한 뒤 message와 그 encrypted version을 차례로 보냅니다. Message를 보낼 때 PT thread는 flag를 확인하고, clear 상태라면 encrypt thread와 공유하는 buffer에 message를 쓴 뒤 flag를 set합니다.
Encrypt thread는 flag가 set되면 common buffer의 memory를 자신의 private memory로 복사한 다음 flag를 clear합니다. Text string을 받은 encrypt thread는 Enigma machine simulation을 수행해 cipher text(CT)를 만듭니다.
CT는 세 번째 thread와 연결된 shared memory partition으로 복사됩니다. 세 번째 thread는 content가 CYPHER TEXT임을 알리는 banner와 함께 CT를 console에 출력합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.