-
Notifications
You must be signed in to change notification settings - Fork 1
Development #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development #14
Conversation
WalkthroughThe changes update kernel process management by introducing a secure process exit stub, enforcing stack alignment, and ensuring stack cleanup on security violations. The kernel integrity subsystem now throttles its security checks. Additionally, panic messages are reformatted for clarity, interrupt handler formatting is improved, and the QEMU run command is updated to prevent automatic reboot or shutdown. Changes
Sequence Diagram(s)sequenceDiagram
participant Scheduler
participant Process
participant SecureProcessExitStub
participant MemoryManager
Scheduler->>Process: Start process (entry point)
Process-->>SecureProcessExitStub: If entry point returns
SecureProcessExitStub->>SecureProcessExitStub: Print kernel message, halt CPU
Scheduler->>Process: Detect invalid security token
Scheduler->>MemoryManager: Free process stack memory
Scheduler->>Process: Set stack pointer to NULL (terminate process)
sequenceDiagram
participant SecureKernelIntegritySubsystem
participant Scheduler
loop Every 1000 iterations
SecureKernelIntegritySubsystem->>Scheduler: Validate process security tokens
end
Note right of SecureKernelIntegritySubsystem: Busy-wait delay between checks
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Kernel/Process/Process.c (1)
6-6
: Consider using a common header for NULL definition.While this definition is correct for a freestanding kernel environment, consider centralizing such common definitions in a shared header file to avoid duplication across multiple source files.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
Kernel/Core/Kernel.c
(1 hunks)Kernel/Drivers/Interrupts.c
(1 hunks)Kernel/Process/Process.c
(5 hunks)meson.build
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
Kernel/Drivers/Interrupts.c (3)
Kernel/Drivers/Io.h (2)
outb
(6-8)outb
(6-6)Kernel/Process/Process.h (1)
ScheduleFromInterrupt
(62-62)Kernel/Process/Process.c (1)
ScheduleFromInterrupt
(219-293)
Kernel/Core/Kernel.c (1)
Kernel/Core/Panic.h (1)
Panic
(7-7)
🔇 Additional comments (7)
meson.build (1)
124-124
: LGTM! Useful debugging flags added.Adding
-no-reboot
and-no-shutdown
flags prevents QEMU from automatically restarting or shutting down when the kernel crashes or exits, which is helpful for debugging kernel panics and inspecting final system states.Kernel/Drivers/Interrupts.c (1)
37-77
: LGTM! Formatting improvements enhance readability.The added empty lines improve visual separation between logical blocks without affecting functionality.
Kernel/Core/Kernel.c (1)
172-172
: LGTM! Improved panic message formatting.Adding newlines around the panic message enhances visibility of this critical security failure.
Kernel/Process/Process.c (4)
86-89
: Excellent addition of process exit safety mechanism.The
SecureProcessExitStub
function provides a safe landing point for processes that unexpectedly return from their entry point, preventing undefined behavior and making debugging easier.
148-156
: Well-implemented stack setup with proper alignment and safety.The changes ensure:
- Processes that return from their entry point will safely land in
SecureProcessExitStub
- Stack pointer is properly 16-byte aligned as required by the x86-64 ABI
This is a robust defensive programming approach.
190-192
: Important fix for memory leak on security violations.Properly freeing the stack memory and setting the pointer to NULL prevents memory leaks when processes are terminated due to invalid security tokens. This is a critical resource management fix.
345-349
: Good performance optimization with throttling.The throttling mechanism reduces CPU usage by performing security checks only once every 1000 iterations. However, ensure this delay is acceptable from a security perspective.
Consider documenting the security implications of the 1000-iteration delay between checks. In a high-frequency timer environment, this could mean several milliseconds between security validations.
Summary by CodeRabbit
New Features
Style
Chores