kernel/usermode/mpu_userspace.html · kernel/usermode/mpu_userspace.rst 공식 원문 ↗

Zephyr 3.7.0 · Kernel · Userspace

MPU Backed Userspace

Build-time privileged stack과 runtime MPU 전환으로 user parameter를 검증한 뒤 kernel API를 격리 실행합니다.

Official pathkernel/usermode/mpu_userspace.html
Source filekernel/usermode/mpu_userspace.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

ELF stack discovery부터 user drop, syscall privilege elevation과 user-stack 복원까지의 흐름을 설명합니다.

Build

ELF scan · privileged stack

Entry

validate · elevate

Return

user mode · user stack

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 BFA6260AE2D6EB008F60D40A2A19AEBA68345F1AF4FEA8069E9F0BB22BAC9B22
.. _mpu_userspace:

MPU Backed Userspace
####################

The MPU backed userspace implementation requires the creation of a secondary
set of stacks.  These stacks exist in a 1:1 relationship with each thread stack
defined in the system.  The privileged stacks are created as a part of the
build process.

A post-build script :ref:`gen_kobject_list.py` scans the generated
ELF file and finds all of the thread stack objects.  A set of privileged
stacks, a lookup table, and a set of helper functions are created and added
to the image.

During the process of dropping a thread to user mode, the privileged stack
information is filled in and later used by the swap and system call
infrastructure to configure the MPU regions properly for the thread stack and
guard (if applicable).

During system calls, the user mode thread's access to the system call and the
passed-in parameters are all validated.  The user mode thread is then elevated
to privileged mode, the stack is switched to use the privileged stack, and the
call is made to the specified kernel API.  On return from the kernel API,  the
thread is set back to user mode and the stack is restored to the user stack.

Part 3

한국어 전문 번역

MPU-backed userspace는 system의 각 thread stack과 1:1 관계인 secondary privileged stack 집합을 필요로 합니다. 이 privileged stack은 build process에서 생성됩니다.

Post-build gen_kobject_list.py가 generated ELF를 scan해 모든 thread stack object를 찾고, privileged stack 집합·lookup table·helper function을 생성해 image에 추가합니다.

MPU userspace stack 전환
Build

ELF thread stack scan → privileged stacks + lookup

Drop to user

thread별 privileged stack 정보와 MPU region 준비

System call entry

call·parameter validation

Privilege elevation

user stack → privileged stack

Kernel API

supervisor mode에서 실행

Return

user mode + user stack 복원

Thread를 user mode로 낮출 때 privileged stack 정보를 채우고, 이후 context swap과 system call infrastructure가 thread stack 및 optional guard에 맞는 MPU region을 구성할 때 사용합니다.

System call에서는 user thread의 call access와 전달 parameter를 모두 검증합니다. 그 뒤 privileged mode로 올리고 privileged stack으로 전환해 kernel API를 호출합니다. Return하면 다시 user mode로 낮추고 user stack을 복원합니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.