Part 1
요약·해설
ELF stack discovery부터 user drop, syscall privilege elevation과 user-stack 복원까지의 흐름을 설명합니다.
ELF scan · privileged stack
validate · elevate
user mode · user stack
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
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에 추가합니다.
ELF thread stack scan → privileged stacks + lookup
thread별 privileged stack 정보와 MPU region 준비
call·parameter validation
user stack → privileged stack
supervisor mode에서 실행
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
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.