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

how can build module with hwasan on android 10 #1290

Open
64Teenage opened this issue Aug 7, 2020 · 3 comments
Open

how can build module with hwasan on android 10 #1290

64Teenage opened this issue Aug 7, 2020 · 3 comments

Comments

@64Teenage
Copy link

64Teenage commented Aug 7, 2020

i build module with hwasan following steps by:

  1. build with flags: SANITIZE_TARGET:=hwaddress
  2. push so file to device

but, i got this:
#00 pc 000000000001bf1c /system/lib64/libclang_rt.hwasan-aarch64-android.so (__hwasan::GetCurrentThread()+12) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de)
#1 pc 000000000001817c /system/lib64/libclang_rt.hwasan-aarch64-android.so (__hwasan::HwasanAllocate(__sanitizer::StackTrace*, unsigned long, unsigned long, bool)+112) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de)
#2 pc 00000000000180e4 /system/lib64/libclang_rt.hwasan-aarch64-android.so (__hwasan::hwasan_malloc(unsigned long, __sanitizer::StackTrace*)+24) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de)
#3 pc 000000000001e7d4 /system/lib64/libclang_rt.hwasan-aarch64-android.so (operator new(unsigned long)+108) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de)
#4 pc 0000000000016974 /system/lib64/libutils.so (android::add_sysprop_change_callback(void (*)(), int)+72) (BuildId: f7c8a354465b908ebfc4497b6d157cac)
#5 pc 0000000000052358 /apex/com.android.runtime/bin/linker64 (_dl__ZL10call_arrayIPFviPPcS1_EEvPKcPT_mbS5+276) (BuildId: 279f245e502d159f7b7a3163a10fa120)
#6 pc 0000000000052574 /apex/com.android.runtime/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+376) (BuildId: 279f245e502d159f7b7a3163a10fa120)
#7 pc 0000000000052480 /apex/com.android.runtime/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+132) (BuildId: 279f245e502d159f7b7a3163a10fa120)
#8 pc 000000000003cc34 /apex/com.android.runtime/bin/linker64 (__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv+2416) (BuildId: 279f245e502d159f7b7a3163a10fa120)
#9 pc 0000000000038160 /apex/com.android.runtime/bin/linker64 (__loader_dlopen+68) (BuildId: 279f245e502d159f7b7a3163a10fa120)
#10 pc 0000000000001020 /apex/com.android.runtime/lib64/bionic/libdl.so (dlopen+12) (BuildId: eaf850ad282e2aa45253983f09c5a3aa)

the libclang_rt.hwasan-aarch64-android.so is provided by android by default
what does it means?

  1. the default so file itsef has bugs?
  2. something must compiler with hwasan too?
@eugenis
Copy link
Contributor

eugenis commented Aug 7, 2020 via email

@64Teenage
Copy link
Author

This means that malloc was called before hwasan was initialized. Hwasan is initialized in _hwasan_init, which is called from the first constructor of any hwasan-instrumented library. It looks like libutils.so is not built with hwasan, as well as libc. Is the device image built with hwasan? See https://source.android.com/devices/tech/debug/hwasan#using-hwasan

On Thu, Aug 6, 2020 at 8:22 PM QihuaHuang @.> wrote: i build module with hwasan following steps by: 1. build with flags: SANITIZE_TARGET:=hwaddress 2. push so file to device but, i got this: #00 pc 000000000001bf1c /system/lib64/ libclang_rt.hwasan-aarch64-android.so (__hwasan::GetCurrentThread()+12) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de) #1 <#1> pc 000000000001817c /system/lib64/libclang_rt.hwasan-aarch64-android.so (__hwasan::HwasanAllocate(__sanitizer::StackTrace, unsigned long, unsigned long, bool)+112) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de) #2 <#2> pc 00000000000180e4 /system/lib64/libclang_rt.hwasan-aarch64-android.so (__hwasan::hwasan_malloc(unsigned long, __sanitizer::StackTrace)+24) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de) #3 <#3> pc 000000000001e7d4 /system/lib64/libclang_rt.hwasan-aarch64-android.so (operator new(unsigned long)+108) (BuildId: 5305c60a4101a2cd88c0fd38fb489a997d1c67de) #4 <#4> pc 0000000000016974 /system/lib64/libutils.so (android::add_sysprop_change_callback(void ()(), int)+72) (BuildId: f7c8a354465b908ebfc4497b6d157cac) #5 <#5> pc 0000000000052358 /apex/com.android.runtime/bin/linker64 (
dl__ZL10call_arrayIPFviPPcS1_EEvPKcPT_mbS5+276) (BuildId: 279f245e502d159f7b7a3163a10fa120) #6 <#6> pc 0000000000052574 /apex/com.android.runtime/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+376) (BuildId: 279f245e502d159f7b7a3163a10fa120) #7 <#7> pc 0000000000052480 /apex/com.android.runtime/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+132) (BuildId: 279f245e502d159f7b7a3163a10fa120) #8 <#8> pc 000000000003cc34 /apex/com.android.runtime/bin/linker64 (__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv+2416) (BuildId: 279f245e502d159f7b7a3163a10fa120) #9 <#9> pc 0000000000038160 /apex/com.android.runtime/bin/linker64 (__loader_dlopen+68) (BuildId: 279f245e502d159f7b7a3163a10fa120) #10 <#10> pc 0000000000001020 /apex/com.android.runtime/lib64/bionic/libdl.so (dlopen+12) (BuildId: eaf850ad282e2aa45253983f09c5a3aa) the libclang_rt.hwasan-aarch64-android.so is provided by android by default what does it means? 1. the default so file has bugs? 2. something must comiple with hwasan too? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#1290>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADG4SQVKTBEJEBC2HPGPCTR7NXN7ANCNFSM4PXGRTXQ .

if the device image built with hwasan, then it can't bootup. my platfom is qcom

@eugenis
Copy link
Contributor

eugenis commented Aug 11, 2020 via email

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

2 participants