Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 370 by [email protected]: Kernel compilation error when using KSAN
https://code.google.com/p/address-sanitizer/issues/detail?id=370

What steps will reproduce the problem?
Step 1:
To instrument the kernel we need to use a custom GCC, which I have download https://address-sanitizer.googlecode.com/files/gcc-r203101-snapshot.tar.gz
Step2:
download ksan patched kernel https://github.com/google/kasan
Step3:
Untar the gcc downloaded in step 1 and kernel in step 2
export GCC_KASAN=<path_to_gcc_base_directory>
Step4.
cd <kernel_base_directory>
make CC='$GCC_KASAN/bin/gcc' olddefconfig
make CC='$GCC_KASAN/bin/gcc' menuconfig
Enable ( Generalsetup -> CONFIG_SLAB ) and ( Kernel hacking -> Memory Debugging -> CONFIG_ASAN )
Step5:
make CC='$GCC_KASAN/bin/gcc' -j<no.jobs>

by following above procedure after Step5 I have encountered below Error:
-----------------------------------------------------------------------
0 :) prasanna.k ~/Ksan/work/linux-kasan $ make CC=${GCC_KASAN}/gcc -j20
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/syscalls/../include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_64.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
  CHK     include/config/kernel.release
  WRAP    arch/x86/include/generated/asm/clkdev.h
  WRAP    arch/x86/include/generated/asm/cputime.h
  WRAP    arch/x86/include/generated/asm/early_ioremap.h
  WRAP    arch/x86/include/generated/asm/mcs_spinlock.h
  WRAP    arch/x86/include/generated/asm/scatterlist.h
  UPD     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/asn1_compiler
  CC      scripts/mod/empty.o
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/lex.lex.c
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/devicetable-offsets.s
  SHIPPED scripts/genksyms/keywords.hash.c
  SHIPPED scripts/genksyms/parse.tab.h
  HOSTCC  scripts/selinux/mdp/mdp
cc1: error: invalid parameter ‘asan-use-after-return’
cc1: error: invalid parameter ‘asan-globals’
cc1: error: invalid parameter ‘asan-memintrin’
cc1: error: invalid parameter ‘asan-instrumentation-with-call-threshold’
cc1: error: invalid parameter ‘asan-fixed-shadow-offset’
  SHIPPED scripts/genksyms/parse.tab.c
cc1: error: invalid parameter ‘asan-use-after-return’
cc1: error: invalid parameter ‘asan-globals’
cc1: error: invalid parameter ‘asan-memintrin’
cc1: error: invalid parameter ‘asan-instrumentation-with-call-threshold’
cc1: error: invalid parameter ‘asan-fixed-shadow-offset’
  HOSTCC  scripts/genksyms/lex.lex.o
make[2]: *** [scripts/mod/empty.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/genksyms/parse.tab.o
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTLD  scripts/genksyms/genksyms
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes.  Stop.
-----------------------------------------------------------------------

What is the expected output? What do you see instead?
I expect compiled kernel Image but I have received error in compile time

What version of the product are you using? On what operating system?
I am trying on X64
$ uname -a
Linux ls3 3.13.0-32-generic #57~precise1-Ubuntu SMP Tue Jul 15 03:51:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


Please provide any additional information below.

I have tried compiling a small C program with the compiler downloaded form https://address-sanitizer.googlecode.com/files/gcc-r203101-snapshot.tar.gz

$ gcc --param asan-globals=0 global.c -o global
cc1: error: invalid parameter ‘asan-globals’

I will provide any additional information if required, please give me a hint to solve this error.

Thanks in advance

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to