vusec / kasper

Kasper: Scanning for Generalized Transient Execution Gadgets in the Linux Kernel
https://vusec.net/projects/kasper
Apache License 2.0
53 stars 8 forks source link

Failed to run task "kernel:config build" #6

Closed zyz-2333-huaiqian closed 1 year ago

zyz-2333-huaiqian commented 1 year ago

Failed to run task "build", maybe the command "make" go wrong here is the output:

task: [kernel:config] cd $KERNEL && make LLVM=1 LLVM_IAS=1 CC=$CLANG LD=$LD AR=$LLVM_AR NM=$LLVM_NM STRIP=$LLVM_STRIP OBJCOPY=$LLVM_OBJCOPY OBJDUMP=$LLVM_OBJDUMP READELF=$LLVM_READELF HOSTCC=$CLANG HOSTCXX=$CXX HOSTAR=$LLVM_AR HOSTLD=$LD defconfig
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_JUMP_LABEL
task: [kernel:config] cd ${KERNEL} && scripts/config --enable CONFIG_UNWINDER_FRAME_POINTER
task: [kernel:config] cd ${KERNEL} && scripts/config --enable CONFIG_KALLSYMS_ALL
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_RANDOMIZE_BASE
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_PREEMPT_VOLUNTARY
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_SMP
task: [kernel:config] cd ${KERNEL} && scripts/config --set-val CONFIG_NR_CPUS 1
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_HZ_1000
task: [kernel:config] cd ${KERNEL} && scripts/config --enable CONFIG_HZ_100
task: [kernel:config] cd ${KERNEL} && scripts/config --set-val CONFIG_HZ 100
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_HIGH_RES_TIMERS
task: [kernel:config] cd ${KERNEL} && scripts/config --disable CONFIG_LTO_NONE
task: [kernel:config] cd ${KERNEL} && scripts/config --enable CONFIG_LTO_CLANG_THIN
task: [kernel:config] \[ -z "$ENABLE_GDB_BUILD" \] || task kernel:config-gdb-build
task: [kernel:config-gdb-build] cd ${KERNEL} && scripts/config --enable CONFIG_X86_X2APIC
task: [kernel:config-gdb-build] cd ${KERNEL} && scripts/config --enable CONFIG_X86_LOCAL_APIC
task: [kernel:config-gdb-build] cd ${KERNEL} && scripts/config --enable CONFIG_HYPERVISOR_GUEST
task: [kernel:config-gdb-build] cd ${KERNEL} && scripts/config --enable CONFIG_KVM_GUEST
task: [kernel:config-gdb-build] cd ${KERNEL} && scripts/config --enable CONFIG_PARAVIRT
task: [kernel:config-gdb-build] cd ${KERNEL} && scripts/config --enable CONFIG_HAVE_STATIC_CALL
task: [kernel:config] \[ -z "$ENABLE_KSPECEM" \] ||    task kernel:config-kspecem
task: [kernel:config-kspecem] cd $KERNEL && scripts/config --enable CONFIG_KSPECEM
task: [kernel:config] \[ -z "$ENABLE_KDFSAN" \] ||    task kernel:config-kdfsan
task: [kernel:config-kdfsan] cd $KERNEL && scripts/config --enable CONFIG_KDFSAN
task: [kernel:config] \[ -z "$ENABLE_KASAN" \] ||     task kernel:config-kasan
task: [kernel:config-kasan] cd $KERNEL && scripts/config --disable CONFIG_VMAP_STACK
task: [kernel:config-kasan] cd $KERNEL && scripts/config --enable CONFIG_KASAN
task: [kernel:config-kasan] cd $KERNEL && scripts/config --disable CONFIG_KASAN_EXTRA
task: [kernel:config-kasan] cd $KERNEL && scripts/config --enable CONFIG_KASAN_OUTLINE
task: [kernel:config-kasan] cd $KERNEL && scripts/config --disable CONFIG_KASAN_INLINE
task: [kernel:config-kasan] cd $KERNEL && scripts/config --disable CONFIG_TEST_KASAN
task: [kernel:config-kasan] cd $KERNEL && scripts/config --enable CONFIG_KASAN_STACK_ENABLE
task: [kernel:config-kasan] cd $KERNEL && scripts/config --disable CONFIG_KASAN_VMALLOC
task: [kernel:config-kasan] cd $KERNEL && scripts/config --disable CONFIG_KASAN_MODULE_TEST
task: [kernel:config] \[ -z "$ENABLE_DEBUG" \] ||     task kernel:config-debug
task: [kernel:config-debug] cd $KERNEL && scripts/config --enable CONFIG_DEBUG_INFO
task: [kernel:config-debug] cd $KERNEL && scripts/config --enable CONFIG_DEBUG_INFO_REDUCED
task: [kernel:config-debug] cd $KERNEL && scripts/config --disable CONFIG_DEBUG_INFO_COMPRESSED
task: [kernel:config-debug] cd $KERNEL && scripts/config --disable CONFIG_DEBUG_INFO_SPLIT
task: [kernel:config-debug] cd $KERNEL && scripts/config --disable CONFIG_DEBUG_INFO_DWARF4
task: [kernel:config-debug] cd $KERNEL && scripts/config --disable CONFIG_DEBUG_INFO_DWARF5
task: [kernel:config-debug] cd $KERNEL && scripts/config --disable CONFIG_GDB_SCRIPTS
task: [kernel:config-debug] cd $KERNEL && scripts/config --enable CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
task: [kernel:config] \[ -z "$ENABLE_SYZKALLER" \] || task kernel:config-syzkaller
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --enable CONFIG_KCOV
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --enable CONFIG_KCOV_INSTRUMENT_ALL
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --enable CONFIG_KCOV_ENABLE_COMPARISONS
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --enable CONFIG_CONFIGFS_FS
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --enable CONFIG_SECURITYFS
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --disable CONFIG_NVME_TARGET
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --disable CONFIG_NETCONSOLE_DYNAMIC
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --disable CONFIG_OCFS2_FS
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --disable CONFIG_DLM
task: [kernel:config-syzkaller] cd $KERNEL && scripts/config --set-val CONFIG_KCOV_IRQ_AREA_SIZE 0x40000
task: [kernel:config] cd $KERNEL && yes "" | make -j${NPROC} LLVM=1 LLVM_IAS=1 CC=$CLANG LD=$LD AR=$LLVM_AR NM=$LLVM_NM STRIP=$LLVM_STRIP OBJCOPY=$LLVM_OBJCOPY OBJDUMP=$LLVM_OBJDUMP READELF=$LLVM_READELF HOSTCC=$CLANG HOSTCXX=$CXX HOSTAR=$LLVM_AR HOSTLD=$LD modules_prepare
  SYNC    include/config/auto.conf.cmd
.config:4758:warning: override: UNWINDER_FRAME_POINTER changes choice state
*
* Restart config...
*
*
* Linux guest support
*
Linux guest support (HYPERVISOR_GUEST) [Y/n/?] y
  Enable paravirtualization code (PARAVIRT) [Y/n/?] y
  paravirt-ops debugging (PARAVIRT_DEBUG) [N/y/?] (NEW) 
  Xen guest support (XEN) [N/y/?] (NEW) 
  KVM Guest support (including kvmclock) (KVM_GUEST) [Y/n/?] y
  Disable host haltpoll when loading haltpoll driver (ARCH_CPUIDLE_HALTPOLL) [Y/?] (NEW) y
  Support for running PVH guests (PVH) [N/y/?] (NEW) 
  Paravirtual steal time accounting (PARAVIRT_TIME_ACCOUNTING) [N/y/?] (NEW) 
  Jailhouse non-root cell support (JAILHOUSE_GUEST) [N/y/?] (NEW) 
  ACRN Guest support (ACRN_GUEST) [N/y/?] (NEW) 
*
* CPU Frequency scaling
*
CPU Frequency scaling (CPU_FREQ) [Y/n/?] y
  CPU frequency transition statistics (CPU_FREQ_STAT) [N/y/?] n
  Default CPUFreq governor
    1. performance (CPU_FREQ_DEFAULT_GOV_PERFORMANCE)
    2. powersave (CPU_FREQ_DEFAULT_GOV_POWERSAVE)
  > 3. userspace (CPU_FREQ_DEFAULT_GOV_USERSPACE)
    4. ondemand (CPU_FREQ_DEFAULT_GOV_ONDEMAND) (NEW)
    5. conservative (CPU_FREQ_DEFAULT_GOV_CONSERVATIVE) (NEW)
  choice[1-5?]: 
  'performance' governor (CPU_FREQ_GOV_PERFORMANCE) [Y/?] y
  'powersave' governor (CPU_FREQ_GOV_POWERSAVE) [N/m/y/?] n
  'userspace' governor for userspace frequency scaling (CPU_FREQ_GOV_USERSPACE) [Y/?] y
  'ondemand' cpufreq policy governor (CPU_FREQ_GOV_ONDEMAND) [Y/n/m/?] y
  'conservative' cpufreq governor (CPU_FREQ_GOV_CONSERVATIVE) [N/m/y/?] n
  *
  * CPU frequency scaling drivers
  *
  Intel P state control (X86_INTEL_PSTATE) [Y/n/?] y
  Processor Clocking Control interface driver (X86_PCC_CPUFREQ) [N/m/y/?] n
  ACPI Processor P-States driver (X86_ACPI_CPUFREQ) [Y/n/m/?] y
    Legacy cpb sysfs knob support for AMD CPUs (X86_ACPI_CPUFREQ_CPB) [Y/n/?] y
  AMD Opteron/Athlon64 PowerNow! (X86_POWERNOW_K8) [N/m/y/?] n
  AMD frequency sensitivity feedback powersave bias (X86_AMD_FREQ_SENSITIVITY) [N/m/y/?] n
  Intel Enhanced SpeedStep (deprecated) (X86_SPEEDSTEP_CENTRINO) [N/m/y/?] n
  Intel Pentium 4 clock modulation (X86_P4_CLOCKMOD) [N/m/y/?] n
  *
  * shared options
  *
*
* CPU Idle
*
CPU idle PM support (CPU_IDLE) [Y/?] y
  Ladder governor (for periodic timer tick) (CPU_IDLE_GOV_LADDER) [N/y/?] n
  Menu governor (for tickless system) (CPU_IDLE_GOV_MENU) [Y/?] y
  Timer events oriented (TEO) governor (for tickless systems) (CPU_IDLE_GOV_TEO) [N/y/?] n
  Haltpoll governor (for virtualized systems) (CPU_IDLE_GOV_HALTPOLL) [N/y/?] (NEW) 
  Halt poll cpuidle driver (HALTPOLL_CPUIDLE) [Y/n/m/?] (NEW) 
*
* Mice
*
Mice (INPUT_MOUSE) [Y/n/?] y
  PS/2 mouse (MOUSE_PS2) [Y/n/m/?] y
    Elantech PS/2 protocol extension (MOUSE_PS2_ELANTECH) [N/y/?] n
    Sentelic Finger Sensing Pad PS/2 protocol extension (MOUSE_PS2_SENTELIC) [N/y/?] n
    eGalax TouchKit PS/2 protocol extension (MOUSE_PS2_TOUCHKIT) [N/y/?] n
    Virtual mouse (vmmouse) (MOUSE_PS2_VMMOUSE) [N/y/?] (NEW) 
  Serial mouse (MOUSE_SERIAL) [N/m/y/?] n
  Apple USB Touchpad support (MOUSE_APPLETOUCH) [N/m/y/?] n
  Apple USB BCM5974 Multitouch trackpad support (MOUSE_BCM5974) [N/m/y/?] n
  Cypress APA I2C Trackpad support (MOUSE_CYAPA) [N/m/y/?] n
  ELAN I2C Touchpad support (MOUSE_ELAN_I2C) [N/m/y/?] n
  DEC VSXXX-AA/GA mouse and VSXXX-AB tablet (MOUSE_VSXXXAA) [N/m/y/?] n
  Synaptics I2C Touchpad support (MOUSE_SYNAPTICS_I2C) [N/m/y/?] n
  Synaptics USB device support (MOUSE_SYNAPTICS_USB) [N/m/y/?] n
*
* PTP clock support
*
PTP clock support (PTP_1588_CLOCK) [Y/n/m/?] y
*
* Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
*
KVM virtual PTP clock (PTP_1588_CLOCK_KVM) [Y/n/m/?] (NEW) 
IDT 82P33xxx PTP clock (PTP_1588_CLOCK_IDT82P33) [N/m/y/?] n
IDT CLOCKMATRIX as PTP clock (PTP_1588_CLOCK_IDTCM) [N/m/y/?] n
VMware virtual PTP clock (PTP_1588_CLOCK_VMW) [N/m/y/?] (NEW) 
OpenCompute TimeCard as PTP clock (PTP_1588_CLOCK_OCP) [N/m/y/?] n
*
* Microsoft Hyper-V guest support
*
Microsoft Hyper-V client drivers (HYPERV) [N/m/y/?] (NEW) 
*
* MOST support
*
MOST support (MOST) [N/m/y/?] (NEW) 
*
* Library routines
*
Generic bitfield packing and unpacking (PACKING) [N/y/?] n
CORDIC algorithm (CORDIC) [N/m/y/?] n
Simple prime number generator for testing (PRIME_NUMBERS) [N/m/y/?] n
CRC-CCITT functions (CRC_CCITT) [Y/?] y
CRC16 functions (CRC16) [Y/?] y
CRC calculation for the T10 Data Integrity Field (CRC_T10DIF) [N/m/y/?] n
CRC ITU-T V.41 functions (CRC_ITU_T) [N/m/y/?] n
CRC32/CRC32c functions (CRC32) [Y/?] y
  CRC32 perform self test on init (CRC32_SELFTEST) [N/m/y/?] n
  CRC32 implementation
  > 1. Slice by 8 bytes (CRC32_SLICEBY8)
    2. Slice by 4 bytes (CRC32_SLICEBY4)
    3. Sarwate's Algorithm (one byte at a time) (CRC32_SARWATE)
    4. Classic Algorithm (one bit at a time) (CRC32_BIT)
  choice[1-4?]: 1
CRC64 functions (CRC64) [N/m/y/?] n
CRC4 functions (CRC4) [N/m/y/?] n
CRC7 functions (CRC7) [N/m/y/?] n
CRC32c (Castagnoli, et al) Cyclic Redundancy-Check (LIBCRC32C) [N/m/y/?] n
CRC8 function (CRC8) [N/m/y/?] n
PRNG perform self test on init (RANDOM32_SELFTEST) [N/y/?] n
XZ decompression support (XZ_DEC) [Y/?] y
XZ decompressor tester (XZ_DEC_TEST) [N/m/y/?] n
Enable debugging of DMA-API usage (DMA_API_DEBUG) [N/y/?] n
Enable benchmarking of streaming DMA mapping (DMA_MAP_BENCHMARK) [N/y/?] n
glob self-test on init (GLOB_SELFTEST) [N/m/y/?] n
IRQ polling library (IRQ_POLL) [N/y/?] n
Select compiled-in fonts (FONTS) [N/y/?] n
stack depot hash size (12 => 4KB, 20 => 1024KB) (STACK_HASH_ORDER) [20] (NEW) 
Test string functions (STRING_SELFTEST) [N/m/y/?] n
*
* Memory Debugging
*
Extend memmap on extra space for more information on page (PAGE_EXTENSION) [N/y/?] n
Debug page memory allocations (DEBUG_PAGEALLOC) [N/y/?] n
Track page owner (PAGE_OWNER) [N/y/?] n
Poison pages after freeing (PAGE_POISONING) [N/y/?] n
Enable tracepoint to track down page reference manipulation (DEBUG_PAGE_REF) [N/y/?] n
Testcase for the marking rodata read-only (DEBUG_RODATA_TEST) [N/y/?] n
Warn on W+X mappings at boot (DEBUG_WX) [N/y/?] n
Export kernel pagetable layout to userspace via debugfs (PTDUMP_DEBUGFS) [N/y/?] n
Debug object operations (DEBUG_OBJECTS) [N/y/?] n
Debug slab memory allocations (DEBUG_SLAB) [N/y/?] (NEW) 
Kernel memory leak detector (DEBUG_KMEMLEAK) [N/y/?] n
Stack utilization instrumentation (DEBUG_STACK_USAGE) [Y/n/?] y
Detect stack corruption on calls to schedule() (SCHED_STACK_END_CHECK) [N/y/?] n
Debug VM (DEBUG_VM) [N/y/?] n
Debug arch page table for semantics compliance (DEBUG_VM_PGTABLE) [N/y/?] n
Debug VM translations (DEBUG_VIRTUAL) [N/y/?] n
Enforce kmap_local temporary mappings (DEBUG_KMAP_LOCAL_FORCE_MAP) [N/y/?] n
*
* KASAN: runtime memory debugger
*
KASAN: runtime memory debugger (KASAN) [Y/n/?] y
  KASAN mode
  > 1. Generic mode (KASAN_GENERIC) (NEW)
  choice[1]: 1
  Instrumentation type
  > 1. Outline instrumentation (KASAN_OUTLINE)
    2. Inline instrumentation (KASAN_INLINE)
  choice[1-2?]: 1
  Enable stack instrumentation (unsafe) (KASAN_STACK_ENABLE) [Y/n/?] y
  Back mappings in vmalloc space with real shadow memory (KASAN_VMALLOC) [N/y/?] n
  KUnit-incompatible tests of KASAN bug detection capabilities (KASAN_MODULE_TEST) [N/m/?] n
DataFlowSanitizer : generalised dynamic data flow analysis (KDFSAN) [Y/n/?] y
kspecem: add checkpointing support (KSPECEM) [Y/n/?] y
  DESCEND  objtool
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
task: [build] mkdir -p ${ROOT}/build
task: [build] cd ${ROOT}/build && cmake ..
-- Using LLVM version 11.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zyz/secure/kasper/kasper/build
task: [build] cd ${ROOT}/build && make -j${NPROC}
make: *** No targets specified and no makefile found.  Stop.
task: Failed to run task "build": exit status 2
Jakob-Koschel commented 1 year ago

I did a fresh clone and tried to reproduce but I didn't run into the same issue.

for me it also looks like this:

-- Build files have been written to: /home/jkl/Developer/kasper/build

for you there is kasper twice in there so it looks like the path could be incorrect there.

Did you make some local changes?

zyz-2333-huaiqian commented 1 year ago

No, I didn't. I just named the folder outside with the name 'kasper'. There are 7 under the folder 'build', is it all right? Maybe it lacks something.

build.ninja
CMakeFiles
compile_commands.json
static CMakeCache.txt
cmake_install.cmake
passes

Jakob-Koschel commented 1 year ago

there should be a Makefile in there.

This is the output I get from task build for the first two commands:

task: [build] mkdir -p ${ROOT}/build
task: [build] cd ${ROOT}/build && cmake ..
-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/jkl/Developer/kasper/kdfsan-llvm-project/build/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/jkl/Developer/kasper/kdfsan-llvm-project/build/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/jkl/Developer/kasper/kdfsan-llvm-project/build/bin/clang
-- Linker detection: GNU ld
-- Using LLVM version 11.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jkl/Developer/kasper/build

Looks like there is quite a bit missing for you. Looks like it might be a cmake issue. Are you sure you installed all the dependencies? I only tried installing it on ubuntu.

zyz-2333-huaiqian commented 1 year ago

maybe I am not. I tried to reproduce it to check all the dependencies and when I run the command "sudo sh -c "$(curl -ssL https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin" I got

go-task/task info checking GitHub for latest tag
go-task/task debug http_download https://github.com/go-task/task/releases/latest
go-task/task crit unable to find '' - use 'latest' or see https://github.com/go-task/task/releases for details

Can I install those dependencies by other way?

Jakob-Koschel commented 1 year ago

Did you run:

sudo apt install build-essential clang-11 lld-11 libelf-dev qemu-system-x86 bison flex golang libssl-dev cmake debootstrap python3-pexpect socat ninja-build ccache

?

I don't think it has anything to do with task you can also just try to run those commands from within the root directory of the repo:

rm -rf build
mkdir -p build
cd build && cmake ..

and see if it makes a difference.

zyz-2333-huaiqian commented 1 year ago

the output of those commands:

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at static/CMakeLists.txt:7 (message):
  $LLVMPREFIX is not defined

-- Configuring incomplete, errors occurred!
See also "/home/zyz/secure/kasper/kasper/build/CMakeFiles/CMakeOutput.log".

I think I lack the LLVM?

Jakob-Koschel commented 1 year ago

Did you run:

task update
task llvm:config llvm:build

already?

Ah sorry but the missing LLVMPREFIX needs to be set before running the commands I send you:

export LLVMPREFIX=$PWD/kdfsan-llvm-project/build
rm -rf build
mkdir -p build
cd build && cmake ..
zyz-2333-huaiqian commented 1 year ago

Oh, it works. I got 'makefile' under the folder 'build'. Thank you!