5 Commits

Author SHA1 Message Date
c5d51ec8f7 build: export RUSTC_BOOTSTRAP=1 when NV_RS_KERNEL_IBT=1 (fixes #31)
Stock 580.178.04 nv-kernel.o_binary unconditionally emits endbr64
(f3 0f 1e fa) prologues so CONFIG_X86_KERNEL_IBT=y kernels do not raise
#CP on indirect calls. utils.mk already enables -Z cf-protection=branch
-C jump-tables=no on IBT kernels, but stable/distro rustc (including
rust-toolchain.toml 1.100.0, Arch rust, Gentoo dev-lang/rust) rejected
-Z without RUSTC_BOOTSTRAP=1.

Exporting RUSTC_BOOTSTRAP=1 inside the NV_RS_KERNEL_IBT=1 block allows
stable rustc to emit ENDBR64 prologues directly (verified on stable
rustc 1.100.0: check_kernel_module.py passed=true, largest_stack=1000,
data_relocation_targets_without_endbr=0,
data_relocations_pointing_inside_a_function=0).
2026-12-01 05:28:22 +00:00
4472b75ccd Follow-up to PR #10/#11: auto-gate IBT flags, fix RUSTC fallback & section-reloc gate, align stock 580.178.04 compat/FOLL_LONGTERM
- utils.mk: search ~/.cargo/bin in rustup lookup and fall back to ~/.cargo/bin/rustc; auto-gate -Z cf-protection=branch -C jump-tables=no on CONFIG_X86_KERNEL_IBT=y (overridable via NV_RS_KERNEL_IBT=0/1).
- rust-toolchain.toml: restore default stable 1.100.0 (IBT kernels build with RUSTUP_TOOLCHAIN=nightly-2026-11-29).
- tools/check_kernel_module.py: resolve section-symbol relocation targets against disassembled function-entry addresses (avoiding false mid-function failures on valid .text+<entry_off> relocs) and enforce the x86 endbr64 gate when IBT is configured or emitted.
- Stock 580.178.04 parity: omit .llseek across fops (matching nv.c/uvm.c), use container_of() in nano_timer_adapter.c (matching nv-timer.h), use #if defined(MAX_PAGE_ORDER) in rom_fw_adapter.c (matching nv-linux.h), and pass FOLL_LONGTERM in nv_rs_rmapi_os_lock_user_pages (matching os-mlock.c).
- Docs: remove scratch docs/HISTORY.md and update docs/KERNEL_COMPAT.md.
2026-11-30 17:19:30 +00:00
cd5d5e7aea Pin the nightly by date to the build that produced the validation report
PR #10 review nitpick: channel = nightly is an updateable channel, not a fixed
compiler build, so the codegen the ENDBR gate measures can drift between runs.
Pin nightly-2026-11-29 - the dated archived nightly on this box (rustc
1.102.0-nightly, commit-hash 2be539647feed020b47ddbf897b8533d2d8d4c46,
commit-date 2026-11-29) that produced
reports/kernel-module-codegen-validation.json. Unstable-flag support is kept:
the pin is a nightly, just a fixed one. The box resolves the pin through rustup
in utils.mk RUSTC; the dated toolchain is fetched on first use (it is not
installed under the dated name yet - rustup will install it, no action taken
here).
2026-11-30 17:39:55 +01:00
94e9bbfeba Nightly -Z cf-protection=branch so the Rust object gets the ENDBR objtool demands
- utils.mk RUST_KERNEL_FLAGS (x86 kernel target) gains -Z cf-protection=branch; the ARM64 branch be left alone — IBT be an x86 CET feature and no BTI was ordered.
- rust-toolchain.toml moved from pinned stable 1.100.0 to nightly, since the flag be unstable. Verified against the tool: rustc --print=codegen-options on 1.100.0 lists nothing for CF protection, and the unstable book lists none/branch/full for the LLVM backend.
- Make RUSTC explicit so the pinned toolchain is what actually runs:
  - utils.mk: RUSTC ?= $(or $(shell rustup which rustc),$(shell command -v rustc)). Resolves the toolchain pinned in rust-toolchain.toml instead of trusting PATH order; still overridable with RUSTC=..., and no hardcoded ~/.cargo path that may not exist on another box.
  - The gotcha that made this necessary is recorded in the scroll: plain rustc here be the system stable 1.100.0 and rejects -Z. Boxes without rustup still fail - honest limit, no magic.
2026-11-30 17:39:55 +01:00
4526e6a816 Baseline: validated 30/30 tree with passing Level 7 hardware regression
- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime
- Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after)
- Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
2026-11-23 23:48:38 +00:00