CodeVetter · Repo Unpack · Contributor handoff
torvalds/linux
This is a review-driven C codebase with hard ABI boundaries (syscalls, UAPI headers, module interface) and strict process rules: coding-style.rst + checkpatch.pl for style, MAINTAINERS + get_maintainer.pl for ownership, submitting-patches.rst for the email workflow, and a dedicated coding-assistants.rst that forbids AI agents from adding Signed-off-by and prescribes an Assisted-by: LLM tag plus a reproducer-then-fix discipline. Safe first edits live in leaf drivers/ or new selftests; touching kernel/sched, mm, fs/namei or arch entry code requires reading the extensive lock-ordering and retry-protocol comments. Test with kunit.py and kselftest; build with make + Kconfig.
- Style and patch hygiene: follow Documentation/process/coding-style.rst, run scripts/checkpatch.pl on diffs, and locate reviewers via scripts/get_maintainer.pl against MAINTAINERS (M:/R:/L:/S:/F: entry format documented at the top of MAINTAINERS).
- AI-specific contribution rules exist: Documentation/process/coding-assistants.rst states agents MUST NOT add Signed-off-by (only humans certify the DCO), contributions should carry an 'Assisted-by: LLM [tools]' tag, and bug fixes require reading full process docs plus a working reproducer before submitting.
- Build from the top Makefile: 'make' runs recursive Kbuild (sub-Makefiles only touch their own dir), config via Kconfig ('make menuconfig'/'make defconfig'); per-dir objects are wired with obj-y/obj-$(CONFIG_*) lists as in init/Makefile.
- Run tests with tools/testing/kunit/kunit.py (e.g. './tools/testing/kunit/kunit.py run' under UML/QEMU) for KUnit, and tools/testing/selftests via run_kselftest.sh/runner.sh; per-subsystem .kunitconfig fragments (init/.kunitconfig, rust/.kunitconfig) show minimal configs.
- Read-first files for orientation: init/main.c (boot ordering and initcall protocol), the subsystem's Makefile+Kconfig, the relevant MAINTAINERS entry, and for syscall work arch/x86/entry/syscall_64.c + syscall_64.tbl.
- Trap — stable syscall ABI: never renumber or change entries in arch/x86/entry/syscalls/syscall_64.tbl or alter UAPI headers under include/uapi/ incompatibly; new syscalls append new numbers and new structs must be extensible like struct open_how (size-checked via copy_struct_from_user).
- Trap — __init lifetime: functions/data marked __init are freed by free_initmem() after boot (SYSTEM_FREEING_INITMEM -> SYSTEM_RUNNING); calling them post-boot crashes, and mark_readonly() then enforces STRICT_KERNEL_RWX on kernel text/rodata.
- Trap — namei retry protocol: path lookup restarts on -ECHILD (RCU->ref walk), -ESTALE (revalidation) and translates -EOPENSTALE; any code holding state across link_path_walk must handle restarts, and dcache lookups may run under RCU with no refcounting.
- Trap — scheduler locking: __schedule() holds rq->lock and documents exact memory-barrier pairings (smp_mb__after_spinlock vs signal wake-up paths); violating these or calling schedule() with preemption enabled corrupts task state.
- Privilege checks precede security hooks: kernel code calls capable()/CAP_* first (e.g. may_init_module requires CAP_SYS_MODULE), then LSM hooks (security_*) run via call_int_hook — new code must wire both layers, not just one.
- Rust contributions must go through rust/kernel wrappers — the crate docs explicitly forbid bypassing it with raw C calls — and module glue is generated by rust/macros/module.rs; study samples/rust/rust_minimal.rs before writing drivers.
- Safe edit boundaries: leaf drivers (drivers/*/*) and new tools/testing/selftests entries are low blast-radius; init/main.c, kernel/fork.c, kernel/sched/core.c, mm/memory.c, fs/namei.c and arch/*/entry/* are blast-radius hotspots where changes affect every task/syscall. (inferred)