Powered by Linux
[BUG] segfault when analysing powerpc kernel code — Semantic Matching Tool

[BUG] segfault when analysing powerpc kernel code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hit the following when attempting to build and check linux-next 20160422 with ARCH=powerpc, pseries_le_defconfig, x86->ppc64le gcc 4.8.3 crosscompiler. The dubious warnings are interesting, but I'm mostly concerned with the segfault at the end.

This was with smatch master, but occurs with 1.60 as well.

Unfortunately I don't have much time to look into this, but let me know if there's anything else I can provide.

Please Cc on replies.

Andrew

--------------------------------------------------------------------

ajd@ajd:~/code/linux$ ppclemake CHECK="valgrind ~/software/smatch/smatch -p=kernel" C=1
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
<stdin>:1310:2: warning: #warning syscall preadv2 not implemented [-Wcpp]
<stdin>:1313:2: warning: #warning syscall pwritev2 not implemented [-Wcpp]
  CHK     include/generated/compile.h
  CALL    arch/powerpc/kernel/systbl_chk.sh
  CALL    arch/powerpc/kernel/prom_init_check.sh
  CHECK   arch/powerpc/lib/xor_vmx.c
==8834== Memcheck, a memory error detector
==8834== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==8834== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==8834== Command: /home/ajd/software/smatch/smatch -p=kernel -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise -Wno-return-void -m64 -D__powerpc__ -D__powerpc64__ -nostdinc -isystem /home/ajd/crosstools/le-gcc-4.8.3-libc/bin/../lib/gcc/powerpc64le-linux-gnu/4.8.3/include -Wp,-MD,arch/powerpc/lib/.xor_vmx.o.d -nostdinc -isystem /home/ajd/crosstools/le-gcc-4.8.3-libc/bin/../lib/gcc/powerpc64le-linux-gnu/4.8.3/include -I./arch/powerpc/include -Iarch/powerpc/include/generated/uapi -Iarch/powerpc/include/generated -Iinclude -I./arch/powerpc/include/uapi -Iarch/powerpc/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Iarch/powerpc -DHAVE_AS_ATHIGH=1 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -msoft-float -pipe -Iarch/powerpc -mtraceback=no -mabi=elfv2 -mcmodel=medium -mno-pointers-to-nested-functions -mcpu=power7 -mno-altivec -mno-vsx -mno-spe -mspe=no -funit-at-a-time -fno-dwarf2-cfi-asm -mno-string -Wa,-maltivec -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -Werror -maltivec -mabi=altivec -DKBUILD_BASENAME="xor_vmx" -DKBUILD_MODNAME="xor_vmx" arch/powerpc/lib/xor_vmx.c
==8834==
/home/ajd/crosstools/le-gcc-4.8.3-libc/bin/../lib/gcc/powerpc64le-linux-gnu/4.8.3/include/altivec.h:34:2: error: Use the "-maltivec" flag to enable PowerPC AltiVec support
arch/powerpc/lib/xor_vmx.c:27:16: error: Expected ; at end of declaration
arch/powerpc/lib/xor_vmx.c:27:16: error: got signed
arch/powerpc/lib/xor_vmx.c:60:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:60:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:60:9: error: got v1_in
arch/powerpc/lib/xor_vmx.c:60:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:60:9: error: got v1_0
arch/powerpc/lib/xor_vmx.c:61:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:61:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:61:9: error: got v2_in
arch/powerpc/lib/xor_vmx.c:61:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:61:9: error: got v2_0
arch/powerpc/lib/xor_vmx.c:62:9: error: mixing declarations and code
arch/powerpc/lib/xor_vmx.c:85:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:85:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:85:9: error: got v1_in
arch/powerpc/lib/xor_vmx.c:85:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:85:9: error: got v1_0
arch/powerpc/lib/xor_vmx.c:86:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:86:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:86:9: error: got v2_in
arch/powerpc/lib/xor_vmx.c:86:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:86:9: error: got v2_0
arch/powerpc/lib/xor_vmx.c:87:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:87:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:87:9: error: got v3_in
arch/powerpc/lib/xor_vmx.c:87:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:87:9: error: got v3_0
arch/powerpc/lib/xor_vmx.c:88:9: error: mixing declarations and code
arch/powerpc/lib/xor_vmx.c:115:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:115:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:115:9: error: got v1_in
arch/powerpc/lib/xor_vmx.c:115:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:115:9: error: got v1_0
arch/powerpc/lib/xor_vmx.c:116:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:116:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:116:9: error: got v2_in
arch/powerpc/lib/xor_vmx.c:116:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:116:9: error: got v2_0
arch/powerpc/lib/xor_vmx.c:117:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:117:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:117:9: error: got v3_in
arch/powerpc/lib/xor_vmx.c:117:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:117:9: error: got v3_0
arch/powerpc/lib/xor_vmx.c:118:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:118:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:118:9: error: got v4_in
arch/powerpc/lib/xor_vmx.c:118:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:118:9: error: got v4_0
arch/powerpc/lib/xor_vmx.c:119:9: error: mixing declarations and code
arch/powerpc/lib/xor_vmx.c:149:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:149:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:149:9: error: got v1_in
arch/powerpc/lib/xor_vmx.c:149:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:149:9: error: got v1_0
arch/powerpc/lib/xor_vmx.c:150:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:150:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:150:9: error: got v2_in
arch/powerpc/lib/xor_vmx.c:150:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:150:9: error: got v2_0
arch/powerpc/lib/xor_vmx.c:151:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:151:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:151:9: error: got v3_in
arch/powerpc/lib/xor_vmx.c:151:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:151:9: error: got v3_0
arch/powerpc/lib/xor_vmx.c:152:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:152:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:152:9: error: got v4_in
arch/powerpc/lib/xor_vmx.c:152:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:152:9: error: got v4_0
arch/powerpc/lib/xor_vmx.c:153:9: error: No right hand side of '*'-expression
arch/powerpc/lib/xor_vmx.c:153:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:153:9: error: got v5_in
arch/powerpc/lib/xor_vmx.c:153:9: error: Expected ; at end of statement
arch/powerpc/lib/xor_vmx.c:153:9: error: got v5_0
arch/powerpc/lib/xor_vmx.c:154:9: error: mixing declarations and code
arch/powerpc/lib/xor_vmx.c:60 xor_altivec_2() warn: statement has no effect 3 arch/powerpc/lib/xor_vmx.c:61 xor_altivec_2() warn: statement has no effect 3
arch/powerpc/lib/xor_vmx.c:62:47: error: undefined identifier 'unative_t'
==8834== Invalid read of size 1
==8834==    at 0x42660C: get_sym_type (symbol.h:396)
==8834==    by 0x42660C: handle_sizeof (smatch_math.c:859)
==8834==    by 0x42660C: _get_rl (smatch_math.c:993)
==8834==    by 0x425AA5: handle_binop_rl (smatch_math.c:507)
==8834==    by 0x425AA5: _get_rl (smatch_math.c:983)
==8834==    by 0x425A88: handle_binop_rl (smatch_math.c:505)
==8834==    by 0x425A88: _get_rl (smatch_math.c:983)
==8834==    by 0x427A1E: get_hard_max (smatch_math.c:1139)
==8834==    by 0x44215B: is_capped (smatch_capped.c:75)
==8834==    by 0x44237C: match_assign (smatch_capped.c:172)
==8834==    by 0x41AEB5: pass_sym_list_to_client (smatch_hooks.c:212)
==8834==    by 0x41AEB5: __pass_to_client (smatch_hooks.c:232)
==8834==    by 0x404B02: __split_expr (smatch_flow.c:385)
==8834==    by 0x406953: fake_assign_expr (smatch_flow.c:1343)
==8834==    by 0x406953: do_initializer_stuff (smatch_flow.c:1362)
==8834==    by 0x406953: split_declaration (smatch_flow.c:1372)
==8834==    by 0x403EA4: __split_stmt (smatch_flow.c:937)
==8834==    by 0x403E54: split_compound (smatch_flow.c:886)
==8834==    by 0x403E54: __split_stmt (smatch_flow.c:949)
==8834==    by 0x405654: split_function (smatch_flow.c:1454)
==8834==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==8834==
==8834==
==8834== Process terminating with default action of signal 11 (SIGSEGV)
==8834==  Access not within mapped region at address 0x0
==8834==    at 0x42660C: get_sym_type (symbol.h:396)
==8834==    by 0x42660C: handle_sizeof (smatch_math.c:859)
==8834==    by 0x42660C: _get_rl (smatch_math.c:993)
==8834==    by 0x425AA5: handle_binop_rl (smatch_math.c:507)
==8834==    by 0x425AA5: _get_rl (smatch_math.c:983)
==8834==    by 0x425A88: handle_binop_rl (smatch_math.c:505)
==8834==    by 0x425A88: _get_rl (smatch_math.c:983)
==8834==    by 0x427A1E: get_hard_max (smatch_math.c:1139)
==8834==    by 0x44215B: is_capped (smatch_capped.c:75)
==8834==    by 0x44237C: match_assign (smatch_capped.c:172)
==8834==    by 0x41AEB5: pass_sym_list_to_client (smatch_hooks.c:212)
==8834==    by 0x41AEB5: __pass_to_client (smatch_hooks.c:232)
==8834==    by 0x404B02: __split_expr (smatch_flow.c:385)
==8834==    by 0x406953: fake_assign_expr (smatch_flow.c:1343)
==8834==    by 0x406953: do_initializer_stuff (smatch_flow.c:1362)
==8834==    by 0x406953: split_declaration (smatch_flow.c:1372)
==8834==    by 0x403EA4: __split_stmt (smatch_flow.c:937)
==8834==    by 0x403E54: split_compound (smatch_flow.c:886)
==8834==    by 0x403E54: __split_stmt (smatch_flow.c:949)
==8834==    by 0x405654: split_function (smatch_flow.c:1454)
==8834==  If you believe this happened as a result of a stack
==8834==  overflow in your program's main thread (unlikely but
==8834==  possible), you can try to increase the size of the
==8834==  main thread stack using the --main-stacksize= flag.
==8834==  The main thread stack size used in this run was 8388608.
==8834==
==8834== HEAP SUMMARY:
==8834==     in use at exit: 626,976 bytes in 13,816 blocks
==8834== total heap usage: 16,721 allocs, 2,905 frees, 1,349,133 bytes allocated
==8834==
==8834== LEAK SUMMARY:
==8834==    definitely lost: 559 bytes in 21 blocks
==8834==    indirectly lost: 416 bytes in 13 blocks
==8834==      possibly lost: 103,864 bytes in 258 blocks
==8834==    still reachable: 522,137 bytes in 13,524 blocks
==8834==         suppressed: 0 bytes in 0 blocks
==8834== Rerun with --leak-check=full to see details of leaked memory
==8834==
==8834== For counts of detected and suppressed errors, rerun with: -v
==8834== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault
scripts/Makefile.build:289: recipe for target 'arch/powerpc/lib/xor_vmx.o' failed
make[1]: *** [arch/powerpc/lib/xor_vmx.o] Error 139
Makefile:977: recipe for target 'arch/powerpc/lib' failed
make: *** [arch/powerpc/lib] Error 2

--
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@xxxxxxxxxxx  IBM Australia Limited

--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux