Skip to content
Snippets Groups Projects
  • Elijah Caine's avatar
    9abfdf23
    Many tweaks to the Redox Book · 9abfdf23
    Elijah Caine authored
    The changes include:
    - Editing for flow and understandability.
    - Unifying how links are included in the source files.
    - Adding an `About this Book` page to the introduction.
    - Adding a few examples or new pieces of information I felt were
      lacking when I read the book.
    - Unifying 'user space' and 'kernel space' spelling.
    - Added myself to the authors list in `overview/welcome.md`.
    9abfdf23
    History
    Many tweaks to the Redox Book
    Elijah Caine authored
    The changes include:
    - Editing for flow and understandability.
    - Unifying how links are included in the source files.
    - Adding an `About this Book` page to the introduction.
    - Adding a few examples or new pieces of information I felt were
      lacking when I read the book.
    - Unifying 'user space' and 'kernel space' spelling.
    - Added myself to the authors list in `overview/welcome.md`.
unsafes.md 736 B

Unsafes

unsafe is a way to tell Rust that "I know what I'm doing!", which is often necessary when writing low-level code, providing safe abstractions. You cannot write a kernel without unsafes.

In that light, a kernel cannot be 100% safe, however the unsafe parts have to be marked with an unsafe, which keeps the unsafe parts segregated from the safe code. We seek to eliminate the unsafes where we can, and when we use unsafes, we are extremely careful.

A quick grep gives us some stats: The kernel has 16.52% unsafe code, a 50% improvement in the last three weeks. User space has roughly ~0.2%.

This contrasts with kernels written in C, which cannot make guarantees about safety without costly formal analysis.