Using valgrind with gcc to compile the Linux kernel on an arm64 platform. Added KBUILD_CFLAGS += $(call cc-option,-wrapper valgrind,) to the kernel Makefile at line 785 valgrind crashes early into the compile process: ARM64 front end: load_store disInstr(arm64): unhandled instruction 0x69400662 disInstr(arm64): 0110'1001 0100'0000 0000'0110 0110'0010 ==15174== valgrind: Unrecognised instruction at address 0x674de8. Using sections C4.4.14 and C6.6.82 of the Arm v8 Architecture Reference Manual, this instruction is decoded to a load/store register pair (offset) instruction, specifically LDPSW - signed offset variant. As this issue occurs 100% of the time, it makes valgrind useless for my scenario. Full logs in additional information. Reproducible: Always ubuntu@ubuntu:~/test1/linux-4.5.0$ make -j24 deb-pkg CHK include/config/kernel.release make clean CLEAN .tmp_versions TAR linux-4.5.0.tar.gz make KBUILD_SRC= CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/bin2c CHK include/generated/utsrelease.h HOSTCC scripts/kallsyms HOSTCC scripts/pnmtologo HOSTCC scripts/conmakehash CC scripts/mod/empty.o HOSTCC scripts/dtc/dtc.o HOSTCC scripts/recordmcount HOSTCC scripts/dtc/flattree.o HOSTCC scripts/mod/mk_elfconfig HOSTCC scripts/sortextable ==15140== Memcheck, a memory error detector ==15140== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==15140== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==15140== Command: /usr/lib/gcc/aarch64-linux-gnu/5/cc1 -quiet -nostdinc -nostdinc -I ./arch/arm64/include -I arch/arm64/include/generated/uapi -I arch/arm64/include/generated -I include -I ./arch/arm64/include/uapi -I arch/arm64/include/generated/uapi -I ./include/uapi -I include/generated/uapi -imultiarch aarch64-linux-gnu -D __KERNEL__ -D CONFIG_AS_LSE=1 -D CC_HAVE_ASM_GOTO -D KBUILD_STR(s)=#s -D KBUILD_BASENAME=KBUILD_STR(empty) -D KBUILD_MODNAME=KBUILD_STR(empty) -isystem /usr/lib/gcc/aarch64-linux-gnu/5/include -isystem /usr/lib/gcc/aarch64-linux-gnu/5/include -include ./include/linux/kconfig.h -MD scripts/mod/.empty.o.d scripts/mod/empty.c -quiet -dumpbase empty.c -mlittle-endian -mgeneral-regs-only -mpc-relative-literal-loads -mabi=lp64 -auxbase-strip scripts/mod/empty.o -g -O2 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration -Wno-format-security -Wframe-larger-than=2048 -Wno-unused-but-set-variable -Wdeclaration-after-statement -Wno-pointer-sign -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -std=gnu90 -p -fno-strict-aliasing -fno-common -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -fno-strict-overflow -fconserve-stack --param allow-store-data-races=0 -o /tmp/ccL90QUa.s ==15140== CC scripts/mod/devicetable-offsets.s ==15174== Memcheck, a memory error detector ==15174== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==15174== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==15174== Command: /usr/lib/gcc/aarch64-linux-gnu/5/cc1 -quiet -nostdinc -nostdinc -I ./arch/arm64/include -I arch/arm64/include/generated/uapi -I arch/arm64/include/generated -I include -I ./arch/arm64/include/uapi -I arch/arm64/include/generated/uapi -I ./include/uapi -I include/generated/uapi -imultiarch aarch64-linux-gnu -D __KERNEL__ -D CONFIG_AS_LSE=1 -D CC_HAVE_ASM_GOTO -D KBUILD_STR(s)=#s -D KBUILD_BASENAME=KBUILD_STR(devicetable_offsets) -D KBUILD_MODNAME=KBUILD_STR(devicetable_offsets) -isystem /usr/lib/gcc/aarch64-linux-gnu/5/include -isystem /usr/lib/gcc/aarch64-linux-gnu/5/include -include ./include/linux/kconfig.h -MD scripts/mod/.devicetable-offsets.s.d scripts/mod/devicetable-offsets.c -quiet -dumpbase devicetable-offsets.c -mlittle-endian -mgeneral-regs-only -mpc-relative-literal-loads -mabi=lp64 -auxbase-strip scripts/mod/devicetable-offsets.s -g -O2 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration -Wno-format-security -Wframe-larger-than=2048 -Wno-unused-but-set-variable -Wdeclaration-after-statement -Wno-pointer-sign -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -std=gnu90 -p -fno-strict-aliasing -fno-common -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -fno-strict-overflow -fconserve-stack -fverbose-asm -o scripts/mod/devicetable-offsets.s --param allow-store-data-races=0 ==15174== HOSTCC scripts/dtc/fstree.o HOSTCC scripts/dtc/data.o HOSTCC scripts/dtc/livetree.o HOSTCC scripts/dtc/treesource.o HOSTCC scripts/dtc/srcpos.o HOSTCC scripts/dtc/checks.o HOSTCC scripts/dtc/util.o HOSTCC scripts/dtc/dtc-lexer.lex.o HOSTCC scripts/dtc/dtc-parser.tab.o CHK include/generated/timeconst.h CC kernel/bounds.s ==15803== Memcheck, a memory error detector ==15803== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==15803== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==15803== Command: /usr/lib/gcc/aarch64-linux-gnu/5/cc1 -quiet -nostdinc -nostdinc -I ./arch/arm64/include -I arch/arm64/include/generated/uapi -I arch/arm64/include/generated -I include -I ./arch/arm64/include/uapi -I arch/arm64/include/generated/uapi -I ./include/uapi -I include/generated/uapi -imultiarch aarch64-linux-gnu -D __KERNEL__ -D CONFIG_AS_LSE=1 -D CC_HAVE_ASM_GOTO -D KBUILD_STR(s)=#s -D KBUILD_BASENAME=KBUILD_STR(bounds) -D KBUILD_MODNAME=KBUILD_STR(bounds) -isystem /usr/lib/gcc/aarch64-linux-gnu/5/include -isystem /usr/lib/gcc/aarch64-linux-gnu/5/include -include ./include/linux/kconfig.h -MD kernel/.bounds.s.d kernel/bounds.c -quiet -dumpbase bounds.c -mlittle-endian -mgeneral-regs-only -mpc-relative-literal-loads -mabi=lp64 -auxbase-strip kernel/bounds.s -g -O2 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration -Wno-format-security -Wframe-larger-than=2048 -Wno-unused-but-set-variable -Wdeclaration-after-statement -Wno-pointer-sign -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -std=gnu90 -p -fno-strict-aliasing -fno-common -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -fno-strict-overflow -fconserve-stack -fverbose-asm -o kernel/bounds.s --param allow-store-data-races=0 ==15803== HOSTLD scripts/dtc/dtc ==15140== ==15140== HEAP SUMMARY: ==15140== in use at exit: 496,989 bytes in 2,019 blocks ==15140== total heap usage: 3,458 allocs, 1,439 frees, 1,881,464 bytes allocated ==15140== ==15140== LEAK SUMMARY: ==15140== definitely lost: 0 bytes in 0 blocks ==15140== indirectly lost: 0 bytes in 0 blocks ==15140== possibly lost: 8,032 bytes in 1 blocks ==15140== still reachable: 488,957 bytes in 2,018 blocks ==15140== suppressed: 0 bytes in 0 blocks ==15140== Rerun with --leak-check=full to see details of leaked memory ==15140== ==15140== For counts of detected and suppressed errors, rerun with: -v ==15140== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==15843== Memcheck, a memory error detector ==15843== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==15843== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==15843== Command: as -I ./arch/arm64/include -I arch/arm64/include/generated/uapi -I arch/arm64/include/generated -I include -I ./arch/arm64/include/uapi -I arch/arm64/include/generated/uapi -I ./include/uapi -I include/generated/uapi -EL -mabi=lp64 -o scripts/mod/empty.o /tmp/ccL90QUa.s ==15843== ==15843== ==15843== HEAP SUMMARY: ==15843== in use at exit: 9,632,499 bytes in 1,335 blocks ==15843== total heap usage: 1,536 allocs, 201 frees, 10,421,877 bytes allocated ==15843== ==15843== LEAK SUMMARY: ==15843== definitely lost: 871 bytes in 16 blocks ==15843== indirectly lost: 0 bytes in 0 blocks ==15843== possibly lost: 0 bytes in 0 blocks ==15843== still reachable: 9,631,628 bytes in 1,319 blocks ==15843== suppressed: 0 bytes in 0 blocks ==15843== Rerun with --leak-check=full to see details of leaked memory ==15843== ==15843== For counts of detected and suppressed errors, rerun with: -v ==15843== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/sumversion.o ARM64 front end: load_store disInstr(arm64): unhandled instruction 0x69400662 disInstr(arm64): 0110'1001 0100'0000 0000'0110 0110'0010 ==15174== valgrind: Unrecognised instruction at address 0x674de8. ==15174== at 0x674DE8: mark_irreducible_loops() (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x846E03: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x84773F: loop_optimizer_init(unsigned int) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0xA3110B: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x8C7453: execute_one_pass(opt_pass*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x8C7823: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x8C7837: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x8C7887: execute_pass_list(function*, opt_pass*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x8C6197: do_per_function_toporder(void (*)(function*, void*), void*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x8C7EC3: execute_ipa_pass_list(opt_pass*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x69295B: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== by 0x694137: symbol_table::finalize_compilation_unit() (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15174== Your program just tried to execute an instruction that Valgrind ==15174== did not recognise. There are two possible reasons for this. ==15174== 1. Your program has a bug and erroneously jumped to a non-code ==15174== location. If you are running Memcheck and you just saw a ==15174== warning about a bad jump, it's probably your program's fault. ==15174== 2. The instruction is legitimate but Valgrind doesn't handle it, ==15174== i.e. it's Valgrind's fault. If you think this is the case or ==15174== you are not sure, please let us know and we'll try to fix it. ==15174== Either way, Valgrind will now raise a SIGILL signal which will ==15174== probably kill your program. scripts/mod/devicetable-offsets.c: In function ‘main’: scripts/mod/devicetable-offsets.c:206:1: internal compiler error: Illegal instruction } ^ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. ==15174== ==15174== HEAP SUMMARY: ==15174== in use at exit: 687,982 bytes in 2,688 blocks ==15174== total heap usage: 15,259 allocs, 12,571 frees, 19,200,450 bytes allocated ==15174== ==15174== LEAK SUMMARY: ==15174== definitely lost: 366 bytes in 7 blocks ==15174== indirectly lost: 0 bytes in 0 blocks ==15174== possibly lost: 38,616 bytes in 4 blocks ==15174== still reachable: 649,000 bytes in 2,677 blocks ==15174== of which reachable via heuristic: ==15174== newarray : 1,288 bytes in 1 blocks ==15174== suppressed: 0 bytes in 0 blocks ==15174== Rerun with --leak-check=full to see details of leaked memory ==15174== ==15174== For counts of detected and suppressed errors, rerun with: -v ==15174== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) scripts/Makefile.build:153: recipe for target 'scripts/mod/devicetable-offsets.s' failed make[4]: *** [scripts/mod/devicetable-offsets.s] Error 1 make[4]: *** Waiting for unfinished jobs.... scripts/Makefile.build:407: recipe for target 'scripts/mod' failed make[3]: *** [scripts/mod] Error 2 Makefile:551: recipe for target 'scripts' failed make[2]: *** [scripts] Error 2 make[2]: *** Waiting for unfinished jobs.... ARM64 front end: load_store disInstr(arm64): unhandled instruction 0x69400662 disInstr(arm64): 0110'1001 0100'0000 0000'0110 0110'0010 ==15803== valgrind: Unrecognised instruction at address 0x674de8. ==15803== at 0x674DE8: mark_irreducible_loops() (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x846E03: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x84773F: loop_optimizer_init(unsigned int) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0xA3110B: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x8C7453: execute_one_pass(opt_pass*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x8C7823: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x8C7837: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x8C7887: execute_pass_list(function*, opt_pass*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x8C6197: do_per_function_toporder(void (*)(function*, void*), void*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x8C7EC3: execute_ipa_pass_list(opt_pass*) (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x69295B: ??? (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== by 0x694137: symbol_table::finalize_compilation_unit() (in /usr/lib/gcc/aarch64-linux-gnu/5/cc1) ==15803== Your program just tried to execute an instruction that Valgrind ==15803== did not recognise. There are two possible reasons for this. ==15803== 1. Your program has a bug and erroneously jumped to a non-code ==15803== location. If you are running Memcheck and you just saw a ==15803== warning about a bad jump, it's probably your program's fault. ==15803== 2. The instruction is legitimate but Valgrind doesn't handle it, ==15803== i.e. it's Valgrind's fault. If you think this is the case or ==15803== you are not sure, please let us know and we'll try to fix it. ==15803== Either way, Valgrind will now raise a SIGILL signal which will ==15803== probably kill your program. kernel/bounds.c: In function ‘foo’: kernel/bounds.c:25:1: internal compiler error: Illegal instruction } ^ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. ==15803== ==15803== HEAP SUMMARY: ==15803== in use at exit: 703,418 bytes in 2,917 blocks ==15803== total heap usage: 9,755 allocs, 6,838 frees, 10,476,723 bytes allocated ==15803== ==15803== LEAK SUMMARY: ==15803== definitely lost: 529 bytes in 10 blocks ==15803== indirectly lost: 0 bytes in 0 blocks ==15803== possibly lost: 59,616 bytes in 4 blocks ==15803== still reachable: 643,273 bytes in 2,903 blocks ==15803== of which reachable via heuristic: ==15803== newarray : 1,288 bytes in 1 blocks ==15803== suppressed: 0 bytes in 0 blocks ==15803== Rerun with --leak-check=full to see details of leaked memory ==15803== ==15803== For counts of detected and suppressed errors, rerun with: -v ==15803== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Kbuild:44: recipe for target 'kernel/bounds.s' failed make[3]: *** [kernel/bounds.s] Error 1 Makefile:995: recipe for target 'prepare0' failed make[2]: *** [prepare0] Error 2 scripts/package/Makefile:91: recipe for target 'deb-pkg' failed make[1]: *** [deb-pkg] Error 2 Makefile:1240: recipe for target 'deb-pkg' failed make: *** [deb-pkg] Error 2 ubuntu@ubuntu:~/test1/linux-4.5.0$
This has been fixed in the trunk now. *** This bug has been marked as a duplicate of bug 360425 ***