modus
Menu
On this page

The entry fault

A process that writes to an address that it does not have. It shows that the kernel stops this process only: the rest of the system continues.

The write is three calls deep: the stop report has a stack trace from the frame pointers, with the instruction in three and the return addresses in two, one and entry (process errors).

fault module with an entry

Hash
bdb739a1b78e535834278e6b5d97d5cb14bdc296ac17e1f0f53a5aedf7b6a920
Size
32768 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

A process that writes to an address that it does not have

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/fault
Boot imageyes: in the boot image, 32768 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
entry()writes a log line, then writes to address 0 three calls deep

entry

entry()

entry writes a log line, then writes to address 0 three calls deep.

What it is for. It shows the sandbox of a process: a fault ends the process that made it, never the machine or another process. The kernel writes the stop report of the process (the vector, the address, and the frames of its stack), and keeps it while a handle names the process, so that a developer tool reads it later.

What a reader sees. Start it from the start menu, or with start("fault") in the console. It has no window and no grant. The log gets fault: this process writes to address 0, then the line of the kernel that reports the page fault (vector 14) and stops the process. The desktop goes on. In inspect, the stopped process shows its stop report, each frame named by its procedure and its source line from the debug image. The process errors starts it in its fault case, and checks that the four frames are all in this module.

Why the code looks odd. The address comes from a value of the context that no starter writes, so the compiler cannot prove that it is 0 and drop the write. Each function writes depth after its call, so no call is the last instruction of a function: each call keeps its frame and its return address, and the stack trace has every level.

If the write ever succeeds, the process writes fault: the write did not stop the process and stops with Failed: that line is a fault of the kernel.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/demonstrations/fault/main.odin:57

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

WhatValueAs the root service says
GrantsnoneIt writes to an address that it does not have.
Other terms of its start grant setnone
Budget that it asks for
  • the least budget
No MODULE_BUDGET in its source: it asks for the least budget.

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; 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).