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

bionic-fortify-runtime-asan-test run failed #21

Open
oy456xd opened this issue Mar 8, 2024 · 1 comment
Open

bionic-fortify-runtime-asan-test run failed #21

oy456xd opened this issue Mar 8, 2024 · 1 comment

Comments

@oy456xd
Copy link

oy456xd commented Mar 8, 2024

error site:

AddressSanitizer:DEADLYSIGNAL
=================================================================
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer: CHECK failed: asan_suppressions.cpp:47 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=599)
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.

simplified example (add the following patch in bionic):
error before main
change address: true to false , no error

libclang_rt.asan-loongarch64-android.so ????


1|console:/data # ldd /data/tmp/hello                                          
	linux-vdso.so.1 => [vdso] (0x7ffffc8d2000)
	libclang_rt.asan-loongarch64-android.so => /data/local/bionic-tests/data/bionic-loader-test-libs/libclang_rt.asan-loongarch64-android.so (0x7fffec717000)
	libc++.so => /system/lib64/libc++.so (0x7fffec60a000)
	libc.so => /data/local/bionic-tests/data/bionic-loader-test-libs/libc.so (0x7fffe8206000)
	libm.so => /apex/com.android.runtime/lib64/bionic/libm.so (0x7fffef641000)
	libdl.so => /apex/com.android.runtime/lib64/bionic/libdl.so (0x7fffe89c2000)
	liblog.so => /system/lib64/liblog.so (0x7fffe8980000)
diff --git a/tests/Android.bp b/tests/Android.bp
index 5ece7897e..4ccc1f1cc 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -632,6 +632,21 @@ cc_test {
     srcs: ["clang_fortify_asan.cpp"],
 }
 
+cc_test {
+    name: "hello",
+    defaults: [
+        "bionic_clang_fortify_tests_w_flags",
+    ],
+    cflags: [
+        "-Werror",
+        // "-D_FORTIFY_SOURCE=2",
+    ],
+    sanitize: {
+        address: true,
+    },
+    srcs: ["hello.cpp"],
+}
+
 // Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
 // it can confuse these tools pretty easily. If this builds successfully, then
 // __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly


  ➜ cat tests/hello.cpp                                                                     
#include <stdio.h>
int main() {
    puts("hello \n");
  return 0;
}


@oy456xd
Copy link
Author

oy456xd commented Mar 11, 2024

Segmentation fault before main in

0x7fffc1f14000     0x7fffc1fb7000    0xa3000    0x49000 /data/local/bionic-tests/data/bionic-loader-test-libs/libclang_rt.asan-loongarch64-android.so
(gdb) b main
Breakpoint 1 at 0x55555f7305c4: file bionic/tests/hello.cpp, line 4.
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00007fffc1f4da80 in ?? ()
=> 0x00007fffc1f4da80:	08 11 00 38	ldx.b	$r8,$r8,$r4
(gdb) i proc mappings 
process 949
Mapped address spaces:

          Start Addr           End Addr       Size     Offset objfile
        0x1ffffff000       0x2400000000 0x400001000        0x0 [anon:low shadow]
        0x2400000000       0x2800000000 0x400000000        0x0 [anon:shadow gap]
        0x2800000000       0x4000000000 0x1800000000        0x0 [anon:high shadow]
      0x55555f720000     0x55555f721000     0x1000        0x0 /data/nativetest64/hello/hello
      0x55555f730000     0x55555f731000     0x1000        0x0 /data/nativetest64/hello/hello
      0x55555f740000     0x55555f741000     0x1000        0x0 /data/nativetest64/hello/hello
      0x7fffc132d000     0x7fffc1b2d000   0x800000        0x0 
      0x7fffc1b2d000     0x7fffc1ebb000   0x38e000        0x0 [anon:AddrHashMap]
      0x7fffc1ebb000     0x7fffc1f05000    0x4a000        0x0 /data/local/bionic-tests/data/bionic-loader-test-libs/libclang_rt.asan-loongarch64-android.so
      0x7fffc1f05000     0x7fffc1f14000     0xf000        0x0 
      0x7fffc1f14000     0x7fffc1fb7000    0xa3000    0x49000 /data/local/bionic-tests/data/bionic-loader-test-libs/libclang_rt.asan-loongarch64-android.so
      0x7fffc1fb7000     0x7fffc1fc6000     0xf000        0x0 
      0x7fffc1fc6000     0x7fffc1fca000     0x4000    0xeb000 /data/local/bionic-tests/data/bionic-loader-test-libs/libclang_rt.asan-loongarch64-android.so
      0x7fffc1fca000     0x7fffc1fd9000     0xf000        0x0 
      0x7fffc1fd9000     0x7fffc1fdc000     0x3000    0xee000 /data/local/bionic-tests/data/bionic-loader-test-libs/libclang_rt.asan-loongarch64-android.so
      0x7fffc1fdc000     0x7fffc2192000   0x1b6000        0x0 [anon:.bss]
      0x7fffc2200000     0x7fffc5400000  0x3200000        0x0 
      0x7fffc5470000     0x7fffc54d4000    0x64000        0x0 [anon:linker_alloc]
      0x7fffc54d4000     0x7fffc5516000    0x42000        0x0 /data/local/bionic-tests/data/bionic-loader-test-libs/libc.so
      0x7fffc5516000     0x7fffc5525000     0xf000        0x0 
      0x7fffc5525000     0x7fffc55bd000    0x98000    0x41000 /data/local/bionic-tests/data/bionic-loader-test-libs/libc.so
      0x7fffc55bd000     0x7fffc55cc000     0xf000        0x0 
      0x7fffc55cc000     0x7fffc55d1000     0x5000    0xd8000 /data/local/bionic-tests/data/bionic-loader-test-libs/libc.so

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

1 participant