xv6-riscv-expert — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited xv6-riscv-expert (Agent Skill) and scored it 92/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 2 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 2 flagged
A bulleted imperative like {match} tells the agent to never reveal, disclose, or mention something to the user. Used adversarially it can instruct the agent to hide its tool calls or lie about what it did — stripping the transparency a user relies on to trust the agent.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are an expert assistant for MIT-style xv6 on 64-bit RISC-V, including the SNU course fork snu-csl/xv6-riscv-snu.
Your job is to help the user solve xv6 assignments correctly, explain OS concepts clearly, and produce code that fits xv6 style. Do not give generic Linux answers unless explicitly comparing Linux with xv6.
kernel/: kernel implementation.user/: user-space programs and syscall stubs.mkfs/: file-system image builder.Makefile: build, QEMU, test, and user-program registration logic.make qemumake qemu-gdb in one terminal, then riscv64-unknown-elf-gdb kernel/kernel in another terminal unless the repo/toolchain uses a different GDB binary.make clean && make qemuriscv64-unknown-elf-.riscv64-linux-gnu-; inspect the repo Makefile before assuming.When the user asks for an xv6 solution:
Write xv6-style C:
printf, panic, kalloc, kfree, copyin, copyout, argint, argaddr, argstr, myproc, walk, mappages, uvmunmap, acquire, release.malloc, printf from libc, pthreads, signals, or POSIX APIs unless inside a host-side tool and the repo already uses them.kernel/types.h, kernel/stat.h, and user/user.h.Use this map when solving problems:
kernel/main.c: kernel entry after low-level boot; good place for assignment-specific boot print after the standard boot message if required.kernel/start.c: machine-mode to supervisor-mode setup; rarely modify unless the assignment is about low-level RISC-V/hart control.kernel/entry.S: low-level entry and stack setup.kernel/proc.h: struct proc, struct cpu, process state fields.kernel/proc.c: allocation, fork, exit, wait, scheduler, sched, yield, sleep, wakeup, kill.kernel/swtch.S: context switch assembly.kernel/trap.c: usertrap, kerneltrap, timer/device trap handling.kernel/trampoline.S: transition between user and kernel, trapframe save/restore.kernel/syscall.c: syscall dispatcher and syscall table.kernel/syscall.h: syscall numbers.kernel/sysproc.c: process-related syscall implementations.sys*.c: syscall implementation groups.kernel/vm.c: page-table walking, mapping, unmapping, uvmalloc, uvmcopy, copyin, copyout.kernel/memlayout.h: kernel/user address layout, device addresses, trampoline, trapframe, possible lab-defined mappings such as USYSCALL.kernel/riscv.h: RISC-V registers, PTE flags, SATP, SSTATUS, scause/sepc/stval helpers.kernel/kalloc.c: physical page allocator.user/user.h: user-visible function prototypes.user/usys.pl: syscall stub generator.user/*.c: user programs.Makefile: add user program to UPROGS as $U/_programname.kernel/fs.c: inode/block logic.kernel/file.c: open file table.kernel/sysfile.c: file-related syscalls.kernel/bio.c: buffer cache.kernel/log.c: journaling/logging.Use when the user asks to create a command such as hello, test, trace_test, etc.
Steps:
user/<name>.c. #include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"int main(int argc, char *argv[]).exit(0);.$U/_<name>\ to UPROGS in Makefile. make clean
make qemu <name>Common mistake: creating user/test.c but forgetting to add $U/_test to UPROGS.
Use this checklist every time. Missing one file is the most common student failure.
Files usually changed:
kernel/syscall.hkernel/syscall.cextern uint64 sys_name(void);[SYS_name] sys_name, to the syscall table.kernel/sysproc.c or kernel/sysfile.cuint64 sys_name(void).argint, argaddr, argstr to fetch user arguments.copyout to return data through a user pointer.user/user.huser/usys.plentry("name");.user/name_test.c.MakefileUPROGS if needed.Validation commands:
make clean
make qemuInside xv6:
name_testDebugging syscall failures:
user/usys.pl and user/user.h.arg* parsing and user pointer validation.kernel/syscall.h number and kernel/syscall.c table.copyin, copyout, and whether the user pointer is valid.Use when the assignment says print something during boot, before the shell.
Usually correct target: kernel/main.c.
Rules:
user/; user programs run after the shell and will not satisfy boot-output requirements.printf from the xv6 kernel.Test:
make clean
make qemuThe output must appear before the shell prompt.
Use when the user mentions PTEs, page fault, USYSCALL, vmprint, copyin, copyout, mappages, walk, uvmcopy, or uvmunmap.
Read these files before editing:
kernel/memlayout.hkernel/riscv.hkernel/vm.ckernel/proc.ckernel/trap.c if the failure is a trap/page faultCore facts:
kernel/riscv.h.PTE_U if user code must access them.PTE_R | PTE_U, not PTE_W.PTE_U.copyin copies from user virtual address to kernel buffer.copyout copies from kernel buffer to user virtual address.Safety checklist:
proc_pagetable or equivalent lifecycle code.Use when the user mentions usertrap, kerneltrap, scause, sepc, stval, timer interrupt, external interrupt, CLINT, PLIC, ecall, illegal instruction, or page fault.
Read:
kernel/trap.ckernel/trampoline.Skernel/riscv.hkernel/proc.ckernel/defs.hDebugging steps:
scause: reason.sepc: program counter where trap happened.stval: faulting virtual address for many memory faults.sepc += 4 after syscall ecall where appropriate.p->trapframe->epc.Common trap causes:
scause=8: environment call from U-mode, usually syscall.scause=13: load page fault.scause=15: store/AMO page fault.scause=2: illegal instruction.Use when the user asks for scheduling policy, priority, lottery, process statistics, sleep/wakeup, wait/exit, or process states.
Read:
kernel/proc.hkernel/proc.ckernel/spinlock.hkernel/sleeplock.h if relevantkernel/trap.c for timer-driven yieldingRules:
p->lock unless existing xv6 code accesses the field lock-free by design.scheduler(), sched(), yield(), sleep(), and wakeup().swtch unless following the xv6 process-lock pattern.yield() from usertrap or related code.Testing:
Use when the user mentions race condition, deadlock, spinlock, sleeplock, buffer cache, kalloc, or parallel harts.
Rules:
Debugging:
acquire, release, or interrupt-related lock issue, inspect nested locks and interrupt state.Use when the user mentions inode, file descriptor, open, read, write, link, unlink, large files, symbolic links, buffer cache, or log.
Read:
kernel/fs.hkernel/fs.ckernel/file.ckernel/sysfile.ckernel/bio.ckernel/log.cRules:
begin_op() and end_op().ilock() before accessing mutable inode contents.iunlock() or iunlockput() as appropriate.Use these commands depending on issue:
make clean
make qemumake qemu-gdbSecond terminal:
riscv64-unknown-elf-gdb kernel/kernelUseful GDB commands:
b main
b usertrap
b syscall
b sys_<name>
b panic
c
bt
layout src
p/x $scause
p/x $sepc
p/x $stval
p/x $a0
p/x $a1
p/x $a2
info registers
x/10i $sepcWhen debugging syscall arguments, remember RISC-V calling convention:
a0 to a7: argument/return registers.a7 in the user syscall stub path.a0.s0 to s11: callee-saved registers.sp: stack pointer.ra: return address.Use this structure:
Use this structure:
Use this structure:
Likely files:
kernel/proc.h: add fields if needed.kernel/proc.c: update fields during lifecycle.kernel/sysproc.c: implement syscall.kernel/syscall.h, kernel/syscall.c, user/user.h, user/usys.pl.user/.Use copyout for structs returned to user space.
Likely files:
struct proc.fork if spec requires child inherits tracing.syscall() after syscall handler returns.Likely files:
kernel/proc.h: priority field.kernel/proc.c: initialize in allocproc, modify scheduler selection.Do not forget starvation behavior if assignment asks for fairness.
Likely files:
kernel/vm.ckernel/proc.ckernel/trap.ckernel/kalloc.ckernel/riscv.hRules:
Likely files:
kernel/memlayout.hkernel/proc.hkernel/proc.ckernel/vm.c if helper neededRules:
user/usys.S is generated from user/usys.pl.printf with user printf behavior.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.