iromise / fans

FANS: Fuzzing Android Native System Services
242 stars 42 forks source link

extract_from_ast error #1

Closed zym-wade closed 3 years ago

zym-wade commented 3 years ago

when execute python extract_from_ast.py, the error happen:

Do you want to remove all of the files and extract again?y/nn Processing file art/runtime/entrypoints/entrypoint_utils.cc b'including device/generic/car/vendorsetup.sh\nincluding device/generic/mini-emulator-arm64/vendorsetup.sh\nincluding device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh\nincluding device/generic/mini-emulator-mips/vendorsetup.sh\nincluding device/generic/mini-emulator-mips64/vendorsetup.sh\nincluding device/generic/mini-emulator-x86/vendorsetup.sh\nincluding device/generic/mini-emulator-x86_64/vendorsetup.sh\nincluding device/generic/uml/vendorsetup.sh\nincluding device/google/bonito/vendorsetup.sh\nincluding device/google/crosshatch/vendorsetup.sh\nincluding device/google/cuttlefish/vendorsetup.sh\nincluding device/google/marlin/vendorsetup.sh\nincluding device/google/muskie/vendorsetup.sh\nincluding device/google/taimen/vendorsetup.sh\nincluding device/linaro/hikey/vendorsetup.sh\nincluding sdk/bash_completion/adb.bash\n\n============================================\nPLATFORM_VERSION_CODENAME=REL\nPLATFORM_VERSION=9\nTARGET_PRODUCT=aosp_taimen\nTARGET_BUILD_VARIANT=userdebug\nTARGET_BUILD_TYPE=release\nTARGET_ARCH=arm64\nTARGET_ARCH_VARIANT=armv8-a\nTARGET_CPU_VARIANT=cortex-a73\nTARGET_2ND_ARCH=arm\nTARGET_2ND_ARCH_VARIANT=armv8-a\nTARGET_2ND_CPU_VARIANT=cortex-a73\nHOST_ARCH=x86_64\nHOST_2ND_ARCH=x86\nHOST_OS=linux\nHOST_OS_EXTRA=Linux-4.15.0-107-generic-x86_64-Ubuntu-18.04.4-LTS\nHOST_CROSS_OS=windows\nHOST_CROSS_ARCH=x86\nHOST_CROSS_2ND_ARCH=x86_64\nHOST_BUILD_TYPE=release\nBUILD_ID=PQ3A.190801.002\nOUT_DIR=out\n============================================\n/bin/bash: line 3: -load: command not found\n' exception meeted.

iromise commented 3 years ago

It seems that the gen_all_related_cc1_cmd.py does not generate the correct cc1 command. You can check the source code to generate the correct cc1 command related with art/runtime/entrypoints/entrypoint_utils.cc.

zym-wade commented 3 years ago

It seems that the gen_all_related_cc1_cmd.py does not generate the correct cc1 command. You can check the source code to generate the correct cc1 command related with art/runtime/entrypoints/entrypoint_utils.cc.

boom, It still doesn't work after trying for a long time, is there any way to debug

iromise commented 3 years ago

You can read the source code and print some information to make sure that you generate the correct cc1 command. Could you please show me the cc1 command related with art/runtime/entrypoints/entrypoint_utils.cc?

zym-wade commented 3 years ago

You can read the source code and print some information to make sure that you generate the correct cc1 command. Could you please show me the cc1 command related with art/runtime/entrypoints/entrypoint_utils.cc?

I looked at cc1_cmd.json and found that the commands are all empty

zym-wade commented 3 years ago

my fans.cfg include this configuration "aosp_clang_location":"/home/liuhy/aosp9_1/prebuilts/clang/host/linux-x86/clang-4691093/bin",It seems different from your configuration, is this correct?

iromise commented 3 years ago

Please read the doc carefully.

  • aosp_clang_location, the location of clang used to compile AOSP, relative to aosp_dir, e.g., prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real for Android 9.0.0_r46.
zym-wade commented 3 years ago

This is the log file , result is always empty

Generate cc1 cmd for frameworks/av/media/libaudioprocessing/AudioMixer.cpp the cmd is /bin/bash -c "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -I . -I system/media/audio_utils/include -I frameworks/av/media/libaudioprocessing/include -I frameworks/av/media/libaudioprocessing -I out/target/product/taimen/obj_arm/SHARED_LIBRARIES/libaudioprocessing_intermediates -I out/target/product/taimen/gen/SHARED_LIBRARIES/libaudioprocessing_intermediates -I libnativehelper/include_jni \$(cat out/target/product/taimen/obj_arm/SHARED_LIBRARIES/libaudioprocessing_intermediates/import_includes) -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -I frameworks/av/include -isystem hardware/qcom/msm8998/kernel-headers -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -c -fomit-frame-pointer -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=\$PWD/= -ffunction-sections -fdata-sections -fno-short-enums -funwind-tables -fstack-protector-strong -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=date-time -Werror=format-security -nostdlibinc -msoft-float -march=armv8-a -mfloat-abi=softfp -mfpu=neon-fp-armv8 -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -D__ARM_FEATURE_LPAE=1 -target arm-linux-androideabi -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -Wsign-promo -Wno-inconsistent-missing-override -Wno-null-dereference -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-thread-safety-negative -Wno-gnu-include-next -fvisibility-inlines-hidden -std=gnu++14 -mthumb -Os -fno-rtti -Werror -Wall -fPIC -D_USING_LIBCXX -DANDROID_STRICT -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/target/product/taimen/obj_arm/SHARED_LIBRARIES/libaudioprocessing_intermediates/AudioMixer.d -o out/target/product/taimen/obj_arm/SHARED_LIBRARIES/libaudioprocessing_intermediates/AudioMixer.o frameworks/av/media/libaudioprocessing/AudioMixer.cpp -v 2>&1 | grep /home/liuhy/aosp9_1/prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real" the result is

iromise commented 3 years ago

Please read the doc carefully.

aosp_clang_location, the location of clang used to compile AOSP, relative to aosp_dir, e.g., prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real for Android 9.0.0_r46.

zym-wade commented 3 years ago

This still doesn’t work and cannot be generated. Is there any way to get the source code of the Native service?

the result is Generate cc1 cmd for system/tools/hidl/CompoundType.cpp the cmd is PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -c -Isystem/tools/hidl -Isystem/tools/hidl -Wa,--noexecstack -fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot -fstack-protector-strong -m64 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=$PWD/= -Isystem/core/base/include -Isystem/core/liblog/include -Isystem/tools/hidl/include_hash -Isystem/tools/hidl/utils/include -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Ilibnativehelper/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include -Ilibnativehelper/include_jni -O0 -g -Wall -Werror -target x86_64-linux-gnu -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin -DANDROID_STRICT -fPIC -D_USING_LIBCXX -std=gnu++1z -Wsign-promo -Wno-inconsistent-missing-override -Wno-null-dereference -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-thread-safety-negative -Wno-gnu-include-next -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8 -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/backward -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/x86_64-linux -nostdinc++ -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/soong/.intermediates/system/tools/hidl/libhidl-gen/linux_glibc_x86_64_shared/obj/system/tools/hidl/CompoundType.o.d -o out/soong/.intermediates/system/tools/hidl/libhidl-gen/linux_glibc_x86_64_shared/obj/system/tools/hidl/CompoundType.o system/tools/hidl/CompoundType.cpp -v 2>&1 | grep /home/liuhy/aosp9_1/prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real

iromise commented 3 years ago

I think that you still have not read the documentation carefully. As the doc says, you should use relative path, not the absolute path. So you can not use /home/liuhy/aosp9_1/prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real, which is an absolute path.

zym-wade commented 3 years ago

Sorry, it's finally possible this time, I was too careless