[PR #32] [MERGED] kernel: finish Xoodyak entropy integration #88

Closed
opened 2026-11-03 22:04:34 -07:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RhapsodiOS/RhapsodiOS/pull/32
Author: @raynorpat
Created: 9/26/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @raynorpat

Base: master ← Head: claude/clever-wozniak-vlavpe


📝 Commits (2)

  • fa3ea2e kernel: finish Xoodyak entropy integration (models B/C, per-open reseed, ioctl, blocking /dev/random)
  • d73e79c kernel: drop the random(4) entropy ioctl

📊 Changes

4 files changed (+150 additions, -21 deletions)

View changed files

📝 docs/kernel/CSPRNG.md (+47 -18)
📝 src/kernel-7/bsd/dev/random/randomdev.c (+90 -3)
📝 src/kernel-7/bsd/dev/random/randomdev.h (+5 -0)
📝 src/kernel-7/bsd/kern/kern_clock.c (+8 -0)

📄 Description

Summary

  • Add random_harvest_jitter(), hooked from hardclock() (bsd/kern/kern_clock.c), folding interrupt-timing jitter into the CSPRNG (entropy model B). It uses simple_lock_try rather than simple_lock so it can never spin against the lock held by process-context device I/O.
  • Track a boot-time jitter pool (entropy model C): /dev/random reads block via tsleep()/wakeup() until enough early samples have been folded in; /dev/urandom never blocks.
  • random_open() now performs a per-open reseed, mixing a fresh microtime() sample into the state on every open.
  • Update docs/kernel/CSPRNG.md to describe the finished entropy model and remove the now-completed "Future hooks" section.

An entropy-reporting ioctl was prototyped and then dropped: real XNU's own descendant of this driver never exposed one (d_ioctl stays eno_ioctl), so this keeps parity with that instead of inventing a bespoke command number.

Closes #31.

Test plan

  • Reviewed diff for interrupt-safety of the hardclock() hook (simple_lock_try, rate-limited).
  • Confirmed tsleep/wakeup/PZERO/PCATCH/hz are declared via existing includes.
  • Full kernel build/boot (not available in this environment).

🤖 Generated with Claude Code

https://claude.ai/code/session_014TCvq31jNfaBjMSLEnrqxD


Generated by Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RhapsodiOS/RhapsodiOS/pull/32 **Author:** [@raynorpat](https://github.com/raynorpat) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@raynorpat](https://github.com/raynorpat) **Base:** `master` ← **Head:** `claude/clever-wozniak-vlavpe` --- ### 📝 Commits (2) - [`fa3ea2e`](https://github.com/RhapsodiOS/RhapsodiOS/commit/fa3ea2e5af76f58e4721a14137215537fb4ee899) kernel: finish Xoodyak entropy integration (models B/C, per-open reseed, ioctl, blocking /dev/random) - [`d73e79c`](https://github.com/RhapsodiOS/RhapsodiOS/commit/d73e79c712ac62b9f021695600558ab9d0904de3) kernel: drop the random(4) entropy ioctl ### 📊 Changes **4 files changed** (+150 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `docs/kernel/CSPRNG.md` (+47 -18) 📝 `src/kernel-7/bsd/dev/random/randomdev.c` (+90 -3) 📝 `src/kernel-7/bsd/dev/random/randomdev.h` (+5 -0) 📝 `src/kernel-7/bsd/kern/kern_clock.c` (+8 -0) </details> ### 📄 Description ## Summary - Add `random_harvest_jitter()`, hooked from `hardclock()` (`bsd/kern/kern_clock.c`), folding interrupt-timing jitter into the CSPRNG (entropy model B). It uses `simple_lock_try` rather than `simple_lock` so it can never spin against the lock held by process-context device I/O. - Track a boot-time jitter pool (entropy model C): `/dev/random` reads block via `tsleep()`/`wakeup()` until enough early samples have been folded in; `/dev/urandom` never blocks. - `random_open()` now performs a per-open reseed, mixing a fresh `microtime()` sample into the state on every open. - Update `docs/kernel/CSPRNG.md` to describe the finished entropy model and remove the now-completed "Future hooks" section. An entropy-reporting ioctl was prototyped and then dropped: real XNU's own descendant of this driver never exposed one (`d_ioctl` stays `eno_ioctl`), so this keeps parity with that instead of inventing a bespoke command number. Closes #31. ## Test plan - [x] Reviewed diff for interrupt-safety of the `hardclock()` hook (`simple_lock_try`, rate-limited). - [x] Confirmed `tsleep`/`wakeup`/`PZERO`/`PCATCH`/`hz` are declared via existing includes. - [ ] Full kernel build/boot (not available in this environment). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014TCvq31jNfaBjMSLEnrqxD --- _Generated by [Claude Code](https://claude.ai/code/session_014TCvq31jNfaBjMSLEnrqxD)_ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-11-03 22:04:34 -07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github-starred/RhapsodiOS#88
No description provided.