#!/bin/bash # iter6 v3 second-pass: KCSAN-only kernel build (if KASAN-pass comes up silent) # # Run AFTER the KASAN-pass build/install/test cycle is complete. # This script applies the KCSAN config delta on top of the lockdep base. # KCSAN is mutually exclusive with KASAN on this kernel # (lib/Kconfig.kcsan: depends on ... !KASAN). # # Usage: cd ~/src/linux-rockchip && bash /path/to/this/script set -e cd "$(dirname "$(readlink -f "$0")")" [[ -f Makefile ]] || cd ~/src/linux-rockchip echo "=== restore lockdep config (pre-kasan baseline) ===" [[ -f .config.pre-iter6v3-kasan ]] && cp .config.pre-iter6v3-kasan .config echo echo "=== apply KCSAN-only config delta ===" ./scripts/config --disable KASAN --disable KASAN_GENERIC --disable KASAN_OUTLINE \ --disable KASAN_STACK --disable KASAN_VMALLOC \ --enable KCSAN --enable KCSAN_VERBOSE \ --set-val KCSAN_REPORT_ONCE_IN_MS 2000 \ --enable KCSAN_REPORT_VALUE_CHANGE_ONLY \ --enable DEBUG_PREEMPT --enable DEBUG_ATOMIC_SLEEP \ --enable DEBUG_OBJECTS --enable DEBUG_OBJECTS_RCU_HEAD \ --enable DEBUG_LIST \ --enable SLUB_DEBUG --enable SLUB_DEBUG_ON \ --enable PAGE_POISONING \ --set-str LOCALVERSION "-lockdep-kcsan" make olddefconfig grep -E "^CONFIG_(KASAN|KCSAN)" .config | head echo echo "=== verify mutex with KASAN ===" if grep -q "^CONFIG_KASAN=y" .config; then echo "ERROR: KASAN still =y — KCSAN won't enable. Fix .config manually." exit 1 fi echo "=== KCSAN build can proceed with: time pump make -j8 CC='distcc gcc' Image modules dtbs ==="