What is this project?
In 2019 Medtronic disclosed that its MiniMed 508 insulin pump could be wirelessly commanded to deliver a lethal overdose, with no authentication required. The root cause was a complete absence of OS-level access controls.
This project retrofits xv6-riscv, MIT's teaching kernel used in OS courses worldwide, with three security layers that mirror the controls a real medical-device OS must provide:
- User identity and boot-time authentication
- Inode-level discretionary access control (DAC)
- Immutable kernel audit trail for every security decision
Why xv6?
xv6 is intentionally minimal: ~10 000 lines of C, no MMU complexity, no driver jungle. Every security hook you add is immediately visible in context. That makes it the perfect teaching substrate for medical-device OS concepts where every line of kernel code must be auditable.
The kernel runs on qemu-system-riscv64 (virt board). The RISC-V ISA's privilege levels (U/S/M) map cleanly to xv6's user/kernel separation.
Three Security Phases
Each phase is a self-contained kernel modification. Together they satisfy the CIA triad for a medical-device OS.
Phase 1: Authentication
UID/GID identity added to every xv6 process. SHA-256-style credential lookup from /etc/passwd. Boot-time login enforces identity before any shell access.
struct proc {
uint uid; /* user id */
uint gid; /* group id */
uint role; /* 0=user 1=admin */
char uname[MAXNAME];
int authenticated;
};View implementation →Phase 2: File Permissions
Unix rwxrwxrwx mode bits + owner UID/GID on every inode. Four kernel hook points enforce DAC before any read, write, exec, or stat operation.
struct dinode {
/* ... existing fields ... */
uint mode; /* rwxrwxrwx bits */
uint uid; /* owner user id */
uint gid; /* owner group id */
};View implementation →Phase 3: Audit Log
A 256-entry kernel ring buffer records every security event with timestamp, UID, syscall, and result. Admin-only audit_read syscall; non-admins receive EPERM.
struct audit_entry {
uint timestamp;
uint uid;
int syscall_num;
char filename[MAXPATH];
int result; /* 0=allow -1=deny */
};View implementation →Architecture Overview
Security hooks intercept every syscall before kernel resources are touched.
Compliance Report
18 automated tests run on real xv6 inside QEMU. All pass.
T01: boot as root (admin) PASST02: uid=0 after root login PASST03: bad password rejected PASST04: good password accepted PASST05: file owner set on create PASST06: world-readable file readable PASST07: chmod 000 blocks owner PASST08: chmod 644 allows owner read PASST09: chown changes owner PASST10: admin can read any file PASST11: user cannot read root file PASST12: audit_read requires admin PASST13: audit log non-empty after ops PASST14: audit entries contain uid PASST15: exec blocked by perm PASST16: write blocked by perm PASST17: end-to-end medical workflow PASST18: role escalation prevented PASSResult: 18 / 18 tests passed
Team & Course
Course: CCY4304: Operating Systems Security
Lecturer: Prof. Dr. Ayman Adel Abdel-Hamid
Teaching Assistant: Abdelrahman Solyman

