The entry return_fault
The return of the kernel to a process, against threads that try to break it. The design: Architecture: The return to a process.
The kernel returns to a thread with iretq. A thread whose saved state the processor refuses there made the processor fault in the kernel, and one process stopped the machine. Each case of this process starts a child process (this module, with a role) that gives the kernel such a thread. The kernel must stop that child as its own fault, or return to it with a state that a process may have; the machine goes on, and the next case runs.
- 1. A syscall in the last two bytes below the half of a process: its return address is 2^47, which is not canonical. The thread holds values in the high halves of its ymm registers when the kernel stops it, so a switch saves them.
- 2. A stack address that is not canonical, held in rsp while the thread waits for the timer.
- 3. The flag nested task, set with popfq before a syscall: the kernel clears it for itself, and the process gets its flags back without it.
- 4. The trap flag, set with popfq right before a syscall: the kernel clears it for itself, takes no trap, and gives it back; the trap then comes in the process, after its first instruction: its own fault.
- 5. A stack address that is not canonical, held at a syscall: the entry saves it without a use of it, and the return refuses it.
What it is for. It is the regression test of a fault of the kernel that let one process stop the machine. Each case is a hostile state that the return of the kernel once trusted; the machine must go on after each one.
Start: start("return_fault") in the console, or the bar of the desktop. The parent starts each child from the boot image, one at a time: its budget has room for two processes.
Grants, as the root service gives them:
- Image: the boot image, read-only, to start the children from it.
What a reader sees: one row for each case, with the stop cause and the stop report of the child. The log has "return_fault: ok, 5 cases: each child stopped as its own fault or returned with the flags of a process, and the machine goes on", or "return_fault: failed: N cases of 5".
The design:.
return_fault module with an entry
- Hash
90c77a56895e026c4cb3abe86375f1b94ceade28d4e893c87845fc12cc67ebe0- Size
300649 bytes- Exports
0- Imports
0- Imported by
0- License
- MIT
The return of the kernel to a process, against threads that try to break it
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/return_fault |
| Boot image | yes: in the boot image, 300649 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
entry() | The entry of return_fault: a child runs its one hostile case; the parent runs the five cases and shows them |
entry
entry()
The entry of return_fault: a child runs its one hostile case; the parent runs the five cases and shows them.
The context value VALUE_ROLE chooses the role:
- a role of a case: the child makes its hostile state at once. It never comes back here: the kernel stops it as its own fault, or it stops itself. The child of the trap flag writes a line and stops with
Failedwhen no trap came. Parent(0, as the root service starts it): it takes its random generator, opens its window and maps the boot image (no seed stops it withRefused, a window or an image that fails withFailed), runs each case withcase_run, writes the result on the log, and then draws its window for ever.
A role word that names no role stops it with Refused.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/return_fault/main.odin:253
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | It starts its children from the boot image. | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| One child at a time, with one thread: 1353 pages. And the glyph memory of the copy of the text rendering of the drawing module, which draws its text: 354 pages (display.TEXT_MEMORY_PAGES). 1353 + 354 = 1707. |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
