Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors occur when building Linux kernel with Infer. #1456

Open
tluio opened this issue Jun 17, 2021 · 5 comments
Open

Errors occur when building Linux kernel with Infer. #1456

tluio opened this issue Jun 17, 2021 · 5 comments

Comments

@tluio
Copy link

tluio commented Jun 17, 2021

I want to use Infer to compile some drivers in Linux kernel but some errors occured.

infer version: v1.1.0-cd9b64bd4
operating system: ubuntu 18.04
Linux kernel built with Infer: linux-5.4 and linux-5.6 (errors are the same for these two versions)
command: infer run --racerd-only -- make drivers/net/ethernet/intel/e100.o
I also tried 'infer run --racerd-only --keep-going -- make drivers/net/ethernet/intel/e100.o' as suggested, but errors are the same.

output:
Capturing in make/cc mode...
CALL scripts/checksyscalls.sh
clang-11: warning: optimization flag '-falign-jumps=1' is not supported [-Wignored-optimization-argument]
clang-11: warning: optimization flag '-falign-loops=1' is not supported [-Wignored-optimization-argument]
clang-11: warning: optimization flag '-fmerge-constants' is not supported [-Wignored-optimization-argument]
error: unknown warning option '-Wno-format-truncation' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-format-overflow'; did you mean '-Wno-shift-overflow'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-stringop-truncation'; did you mean '-Wno-string-conversion'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Werror=designated-init'; did you mean '-Werror=deprecated-copy'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-packed-not-aligned'; did you mean '-Wno-over-aligned'? [-Werror,-Wunknown-warning-option]
Error: the following clang command did not run successfully:
/usr/local/lib/infer/infer/bin/../../facebook-clang-plugins/clang/install/bin/clang
@/home/ssr/OS/linux/linux-5.4/infer-out/tmp/clang_command_.tmp.d5279c.txt
++Contents of '/home/ssr/OS/linux/linux-5.4/infer-out/tmp/clang_command_.tmp.d5279c.txt':
'-Wp,-MD,./.missing-syscalls.d' '-nostdinc' '-isystem'
'/usr/local/lib/infer/facebook-clang-plugins/clang/install/lib/clang/11.1.0/include'
'-I./arch/x86/include' '-I./arch/x86/include/generated' '-I./include'
'-I./arch/x86/include/uapi' '-I./arch/x86/include/generated/uapi'
'-I./include/uapi' '-I./include/generated/uapi' '-include'
'./include/linux/kconfig.h' '-include' './include/linux/compiler_types.h'
'-D__KERNEL__' '-Qunused-arguments' '-Wall' '-Wundef'
'-Werror=strict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing'
'-fno-common' '-fshort-wchar' '-fno-PIE'
'-Werror=implicit-function-declaration' '-Werror=implicit-int'
'-Wno-format-security' '-std=gnu89' '-no-integrated-as'
'-Werror=unknown-warning-option' '-mno-sse' '-mno-mmx' '-mno-sse2'
'-mno-3dnow' '-mno-avx' '-m64' '-falign-jumps=1' '-falign-loops=1'
'-mno-80387' '-mstack-alignment=8' '-mtune=generic' '-mno-red-zone'
'-mcmodel=kernel' '-DCONFIG_AS_CFI=1' '-DCONFIG_AS_CFI_SIGNAL_FRAME=1'
'-DCONFIG_AS_CFI_SECTIONS=1' '-DCONFIG_AS_SSSE3=1' '-DCONFIG_AS_AVX=1'
'-DCONFIG_AS_AVX2=1' '-DCONFIG_AS_AVX512=1' '-DCONFIG_AS_SHA1_NI=1'
'-DCONFIG_AS_SHA256_NI=1' '-Wno-sign-compare'
'-fno-asynchronous-unwind-tables' '-mretpoline-external-thunk'
'-fno-delete-null-pointer-checks' '-Wno-frame-address'
'-Wno-format-truncation' '-Wno-format-overflow'
'-Wno-address-of-packed-member' '-O2' '--param=allow-store-data-races=0'
'-Wframe-larger-than=2048' '-fno-stack-protector'
'-Wno-format-invalid-specifier' '-Wno-gnu' '-Wno-tautological-compare'
'-mno-global-merge' '-Wno-unused-const-variable' '-fomit-frame-pointer'
'-Wdeclaration-after-statement' '-Wvla' '-Wno-pointer-sign'
'-Wno-stringop-truncation' '-fno-strict-overflow'
'-fno-merge-all-constants' '-fmerge-constants' '-fno-stack-check'
'-Werror=date-time' '-Werror=incompatible-pointer-types'
'-Werror=designated-init' '-fmacro-prefix-map=./=' '-fcf-protection=none'
'-Wno-packed-not-aligned' '-Wno-initializer-overrides' '-Wno-format'
'-Wno-sign-compare' '-Wno-format-zero-length'
'-DKBUILD_BASENAME="missing_syscalls"'
'-DKBUILD_MODNAME="missing_syscalls"' '-E' '-x' 'c' '-'

make[1]: *** [Kbuild:48: missing-syscalls] Error 1
make: *** [Makefile:1112: prepare0] Error 2
External Error: *** capture command failed:
*** make drivers/net/ethernet/intel/e100.o
*** exited with code 2

Error backtrace:
Raised at Stdlib__scanf.bad_input in file "scanf.ml" (inlined), line 444, characters 18-40
Called from Stdlib__scanf.scanf_bad_input in file "scanf.ml", line 1164, characters 4-75
Called from IBase__Utils.get_available_memory_MB.scan_for_expected_output in file "src/base/Utils.ml", line 447, characters 10-86
Re-raised at IBase__Die.raise_error.do_raise in file "src/base/Die.ml", line 26, characters 8-56
Called from Integration__Driver.capture in file "src/integration/Driver.ml", line 127, characters 6-40
Called from IBase__Utils.timeit in file "src/base/Utils.ml", line 429, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml", line 79, characters 29-44
Called from Backend__GCStats.log_f in file "src/backend/GCStats.ml", line 90, characters 10-14
Called from Dune__exe__Infer.run in file "src/infer.ml", line 20, characters 2-36
Called from IBase__Utils.timeit in file "src/base/Utils.ml", line 429, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml", line 79, characters 29-44
Called from Dune__exe__Infer.run in file "src/infer.ml", line 25, characters 22-94

@davidhin
Copy link

Did you manage to figure out a solution?

@tluio
Copy link
Author

tluio commented Jul 19, 2021

Did you manage to figure out a solution?

Sorry, I haven’t solved this problem yet.

@jvillard
Copy link
Contributor

jvillard commented Aug 6, 2021

Infer uses clang to parse C code and I am not sure how well the Linux kernel builds with clang these days. You can skip unknown options by passing the --clang-blacklisted-flags and --clang-blacklisted-flags-with-arg options to infer, eg infer --clang-blacklisted-flags '-falign-jumps=1' --clang-blacklisted-flags '-Wno-format-truncation' (etc.) -- make.

Note that RacerD doesn't detect any races on C code because it relies on a class-based analysis on C++: https://fbinfer.com/docs/next/all-issue-types#lock_consistency_violation

@ryao
Copy link

ryao commented Nov 23, 2022

I am not sure how well the Linux kernel builds with clang these days.

There is CI infrastructure meant to answer that question:

https://clangbuiltlinux.github.io/

@master-q
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants