Skip to content

Conversation

assembler-0
Copy link
Owner

@assembler-0 assembler-0 commented Sep 12, 2025

Summary by CodeRabbit

  • New Features
    • Added support for running a.out executables.
  • Bug Fixes
    • Strengthened stack canary installation and verification to prevent misconfiguration and improve reliability.
    • Ensured terminated processes are always cleaned up to avoid lingering metadata.
  • Documentation
    • Updated version badges and architecture docs to v0.0.2-rc2.
  • Chores
    • Bumped project version to v0.0.2-rc2.
    • Enabled stack protection in the build configuration.

Copy link

coderabbitai bot commented Sep 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Version bumped to v0.0.2-rc2 across docs, banners, and build. Added a.out executable format support with new loader module and ExecLoader integration. Enabled Cerberus stack protection and reworked stack canary placement/verification. Made procinfo auto-cleanup unconditional in MLFQ. StackGuard now uses a fixed canary value.

Changes

Cohort / File(s) Summary of Changes
Version strings and build config
README.md, docs/ARCHITECTURE.md, kernel/core/Kernel.c, kernel/etc/Shell.c, meson.build
Bump version to v0.0.2-rc2 in docs and kernel/shell banners; update Meson project version; add a.out include/src; enable CERBERUS_STACK_PROTECTION; comment out PROCINFO_AUTO_CLEANUP.
Exec format integration
kernel/execf/ExecLoader.c, kernel/execf/ExecLoader.h
Add EXEC_FORMAT_AOUT detection and handling path; include a.out loader header; route loads to CreateProcessFromAout with defaulted AoutLoadOptions; add enum member and trailing comma.
A.out loader module
kernel/execf/aout/AoutLoader.h, kernel/execf/aout/AoutLoader.c
New API and implementation for validating and loading a.out binaries, memory checks, segment copying, entry computation, and process creation; define header struct, magic constants, options struct, and loader functions.
Scheduler cleanup behavior
kernel/sched/MLFQ.c
Remove VF_CONFIG_PROCINFO_AUTO_CLEANUP guard; always compute cleanup path and delete procinfo for terminated processes.
Stack canary behavior
mm/StackGuard.c, mm/security/Cerberus.c
StackGuardInit sets fixed STACK_CANARY_VALUE and logs; Cerberus moves canary near stack top, adds bounds/map/writeability checks, validates/unmaps handling, and updates mismatch reporting.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as User
  participant Shell as Shell
  participant Exec as ExecLoader
  participant FS as VFS
  participant AOUT as AoutLoader
  participant Sched as MLFQ

  User->>Shell: exec "prog"
  Shell->>Exec: LoadExecutable("prog", options)
  Exec->>FS: Read first bytes
  FS-->>Exec: Magic
  alt Format == A.OUT (new)
    Exec->>AOUT: CreateProcessFromAout("prog", AoutLoadOptions)
    AOUT->>FS: VfsGetFileSize / VfsReadFile
    AOUT->>AOUT: ValidateAoutFile()
    AOUT->>AOUT: Allocate process memory, copy text/data, zero bss
    AOUT->>Sched: MLFQCreateProcess(entry, name, priv)
    Sched-->>AOUT: pid
    AOUT-->>Exec: pid
  else Other formats
    Exec->>Exec: Existing loaders (ELF/PE/etc.)
  end
  Exec-->>Shell: pid or error
  Shell-->>User: Report result
  note over Exec,AOUT: New A.OUT detection and loader path
Loading
sequenceDiagram
  autonumber
  participant Kernel as Kernel
  participant Cerb as Cerberus
  participant VMem as VMem
  participant Proc as Process

  rect rgb(235,245,255)
  note right of Kernel: Install phase (on process creation)
  Kernel->>Cerb: CerberusInstallStackCanary(pid, stack_top, stack_size)
  Cerb->>Cerb: Validate pid and min stack size
  Cerb->>VMem: VMemGetPhysAddr(canary_addr=stack_top-0x100)
  alt mapped and writable
    Cerb->>VMem: Test write/read at canary_addr
    Cerb->>Proc: Store STACK_CANARY_VALUE at canary_addr
  else invalid
    Cerb-->>Kernel: -1
  end
  end

  rect rgb(245,235,255)
  note right of Kernel: Check phase (on preemption/trap)
  Kernel->>Cerb: CerberusCheckStackCanary(pid)
  Cerb->>VMem: Ensure canary address mapped
  Cerb->>Proc: Read canary (volatile)
  alt mismatch
    Cerb-->>Kernel: 1 (violation)
  else ok
    Cerb-->>Kernel: 0
  end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Development #104 — Both touch Cerberus and build flags; this PR enables Cerberus stack protection and updates Cerberus/StackGuard logic.
  • Development #115 — Overlaps on version string updates across README, docs, Kernel.c, Shell.c, and meson.build.
  • Development #118 — Similar version/branding updates in the same files and build configuration.

Poem

Hop, hop—new loader on the trail,
A.out sails where bytes prevail.
Cerberus guards with steady glare,
A fixed canary in the air.
Schedulers sweep without a pause,
rc2 stamped—applause, applause!
(_/) ⭐ (•_•) ⭐ />🍪

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a4d8180 and 30c9456.

📒 Files selected for processing (12)
  • README.md (2 hunks)
  • docs/ARCHITECTURE.md (1 hunks)
  • kernel/core/Kernel.c (1 hunks)
  • kernel/etc/Shell.c (2 hunks)
  • kernel/execf/ExecLoader.c (3 hunks)
  • kernel/execf/ExecLoader.h (1 hunks)
  • kernel/execf/aout/AoutLoader.c (1 hunks)
  • kernel/execf/aout/AoutLoader.h (1 hunks)
  • kernel/sched/MLFQ.c (0 hunks)
  • meson.build (4 hunks)
  • mm/StackGuard.c (1 hunks)
  • mm/security/Cerberus.c (3 hunks)
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Development

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@assembler-0 assembler-0 merged commit 5361d1e into main Sep 12, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant