* Fix localization text, Intune capitalization, ADMX indentation, unused import - distributions/validate.py: Remove unused 'import base64' - en-US/en-GB Resources.resw: Fix word order 'the list distribution' -> 'the distribution list' in MessageCouldFetchDistributionList - en-US/en-GB Resources.resw: Remove trailing space from MessageCorruptedDistroRegistration value - intune/en-US/WSL.adml: Fix 'For Linux' -> 'for Linux' capitalization (5 occurrences) to match official product name - intune/WSL.admx: Fix inconsistent 3-space indent to 4-space on AllowWSL1 and CustomKernelUserSettingConfigurable policies * Fix grammar, typos, and formatting in docs and source code - WmiService.h: Fix duplicated word 'of of' -> 'is of' in WQL comment - drvfs.md: Fix 'which tell' -> 'which tells' (subject-verb agreement), double space, second 'tell' -> 'tells' - systemd.md: Fix 'tries synchronizes' -> 'tries to synchronize' - wslhost.exe.md: Fix 'processes terminates' -> 'process terminates' - boot-process.md: Add missing 'in' preposition, fix C:/ -> C:\, fix lowercase 'linux' to 'Linux' (4 occurrences), fix misplaced parenthesis - init.md: Fix double space before hvsocket backtick - session-leader.md: Fix heading level ## -> ### to match sibling section - CONTRIBUTING.md: Fix double period after bold security notice - debugging.md: Fix missing word 'be' in 'can enabled', fix 'process' -> 'processes' - index.md: Add missing period at end of sentence - technical-documentation/index.md: Fix 'API's' -> 'APIs' (remove incorrect apostrophe) - relay.md: Fix lowercase 'linux' to 'Linux' (3 occurrences) - localhost.md: Fix lowercase 'linux' to 'Linux' - plan9.md: Fix lowercase 'linux' to 'Linux' * update errormessages testcase --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
1.2 KiB
Session leader
A session leader is a linux process, which is forked from init after receiving a LxInitMessageCreateSession message (see src/linux/init.cpp)
Creating linux processes
Session leaders are used to create linux processes on behalf of the user. Each linux session leader is associated to a Windows console.
To create a user process, wslservice.exe sends a LxInitMessageCreateProcess message (WSL1) or a LxInitMessageCreateProcessUtilityVm message (WSL2), which contains details about the process to create such as:
- Command line
- Current directory
- Environment variables
- User name
Creating a WSL1 process
When running in a WSL1 distribution, the session leader forks(), and uses the child process to exec() into the user linux process. Before calling exec(), child configures various settings such as:
- The user and group id
- The current directory
- The standard file descriptors (stdin, stdout, stderr)
Creating a WSL2 process
When running in a WSL2 distribution, the session leader forks() to create a relay process, which is responsible for creating the user process and relaying its output back to wsl.exe