Licensing and docs

This commit is contained in:
River 2025-03-29 00:44:54 -04:00
parent cb50a6d58c
commit 2eccf91884
Signed by: shibedrill
GPG Key ID: 5FE0CB25945EFAA2
34 changed files with 145 additions and 17 deletions

42
SECURITY.md Normal file
View File

@ -0,0 +1,42 @@
# Security
Part of the design philosophy that drives my inspiration for Gila is the idea of creating a new, fast, and safe kernel with security as a central focus. Kernels such as Linux, Mach, and NT have been around for too long to work perfectly with today's system security model. Gila is brand-new, and built almost exclusively in Rust for the utmost memory safety.
## Goals
- Distrustful by default
- Small, simple, and transparent
- Performant
- Capability based
- Highly isolated
## Gila's security model
### Microkernel architecture
Gila is a microkernel. Only the most important functionality runs at Ring 0 (Protected Mode) to reduce attack surface. This functionality includes:
- Modifying and reading kernel configurations
- Process creation and destruction
- Scheduling
- Memory allocation and management
- Inter-process communication
- Hardware communication interfaces
User processes perform complex functionality by interacting with server processes. Servers perform many different things:
- PCI(e)
- USB
- Security policy
- Filesystems
- Logins
A user process can be registered as a server by any process with the `ServerRegister` capability. The kernel takes the process's ID and a functionality type as arguments to the registration function. Registering is important, because it allows processes to discover the PIDs of server processes for IPC.
### Capabilities
Every process in Gila has a set of capabilities. These capabilities define the ways it may interact with the kernel's limited functions, and do not govern what it can do with any other userspace process.
### Access control
Access control will be accomplished by means of a "policy server" process, which is registered as a system server by the init process, and is given the authority (by means of its registration with the kernel being readable) to allow or deny specific resource accesses. The relevant server will submit the PID of the requesting process & the resource it desires to the security server, which will check the request against the process's rights, and return a verdict to the issuing server.

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use core::arch::asm; use core::arch::asm;
#[allow(clippy::missing_safety_doc)] #[allow(clippy::missing_safety_doc)]

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,2 +1,5 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
pub mod asm; pub mod asm;
pub mod display; pub mod display;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use core::arch::asm; use core::arch::asm;
#[allow(clippy::missing_safety_doc)] #[allow(clippy::missing_safety_doc)]

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,2 +1,5 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
pub mod asm; pub mod asm;
pub mod display; pub mod display;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
pub mod x86_64; pub mod x86_64;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use core::arch::asm; use core::arch::asm;
#[allow(clippy::missing_safety_doc)] #[allow(clippy::missing_safety_doc)]

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,2 +1,5 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
pub mod asm; pub mod asm;
pub mod display; pub mod display;

View File

@ -1 +1,4 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
// TODO: Implement per-arch memory handlers for ACPI memory map regions // TODO: Implement per-arch memory handlers for ACPI memory map regions

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(clippy::missing_safety_doc)] #![allow(clippy::missing_safety_doc)]
use core::arch::asm; use core::arch::asm;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_variables)] #![allow(unused_variables)]

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
pub mod acpi; pub mod acpi;
pub mod asm; pub mod asm;
pub mod display; pub mod display;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use limine::{BaseRevision, request::*}; use limine::{BaseRevision, request::*};
#[used] #[used]

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use core::fmt::Write; use core::fmt::Write;
use crate::memory::alloc; use crate::memory::alloc;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(allocator_api)] #![feature(allocator_api)]

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(unused_imports)] #![allow(unused_imports)]
use enumflags2::*; use enumflags2::*;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use core::panic::*; use core::panic::*;
#[panic_handler] #[panic_handler]

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
use crate::memory::alloc; use crate::memory::alloc;
use alloc::string::String; use alloc::string::String;
use alloc::vec::Vec; use alloc::vec::Vec;

View File

@ -67,18 +67,23 @@ pub enum ProcessCapabilities {
ProcessKill, // Kill any process ProcessKill, // Kill any process
ProcessSpawn, // Create a new process ProcessSpawn, // Create a new process
ProcessExec, // Replace self with new process image ProcessExec, // Replace self with new process image
ProcessSession, // Create and accept Session requests. ProcessSession, // Create and accept IPC requests.
// File system capabilities // Capability meta
FileEnum, // Enumerate directories and files CapabilityRead, // Inspect a process's capabilities
FileRead, // Read files CapabilityAdd, // Add a capability to a process
FileWrite, // Write to files // Hardware access capabilities
FilePermission, // Modify file permissions HardwareWrite, // Write to memory-mapped IO
FileCreate, // Create files HardwareRead, // Read from memory-mapped IO
FileDelete, // Delete files HardwareLock, // Obtain exclusive access to a device
FileSystem, // Mount, unmount, and modify filesystems HardwareQuery, // Check on the lock status of a device
// Kernel config capabilities // Kernel config capabilities
KernelCfgRead, // Read kernel configurations KernelCfgRead, // Read kernel configurations
KernelCfgWrite, // Modify kernel configurations KernelCfgWrite, // Modify kernel configurations
KernelProtCall, // Call protected kernel functions
// Server resolution capabilities
ServerEnum, // Enumerate server processes
ServerGet, // Get the PID of a specific server for IPC.
ServerRegister, // Register a process as a server.
} }
// Interprocess communication system: // Interprocess communication system:

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(dead_code)] #![allow(dead_code)]
use crate::process::Process; use crate::process::Process;

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
pub mod x86_64; pub mod x86_64;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]

View File

@ -1 +1,2 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,2 +1,5 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
mod registers_impl; mod registers_impl;
mod syscall_impl; mod syscall_impl;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#[allow(dead_code)] #[allow(dead_code)]
pub struct Registers { pub struct Registers {
// Private fields // Private fields

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(dead_code, unused_variables)] #![allow(dead_code, unused_variables)]
// The system call API for x86_64. // The system call API for x86_64.

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![no_std] #![no_std]
#![allow(unused_imports)] #![allow(unused_imports)]
mod arch; mod arch;

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
// Every architecture MUST implement this as part of the ABI. // Every architecture MUST implement this as part of the ABI.
// Additional registers can be implemented with architecture-specific traits. // Additional registers can be implemented with architecture-specific traits.
pub unsafe trait RegStoreLoad pub unsafe trait RegStoreLoad

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 shibedrill
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(dead_code)] #![allow(dead_code)]
// TODO: Implement a nice API for system calls. // TODO: Implement a nice API for system calls.
@ -19,7 +22,6 @@ pub enum SyscallError {
Ok, // No error. Ok, // No error.
Unspecified, // Unspecified error occurred. Unspecified, // Unspecified error occurred.
SyscallNotExist, // System call does not exist. SyscallNotExist, // System call does not exist.
FileNotExist, // The file mentioned does not exist.
ProcessNotExist, // The process mentioned does not exist. ProcessNotExist, // The process mentioned does not exist.
PermissionDenied, // The process lacks capabilities. PermissionDenied, // The process lacks capabilities.
Aborted, // The kernel gave up on a blocking request. Aborted, // The kernel gave up on a blocking request.