]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add arm64 do_syscall_WRK implementation to memcheck/tests/leak-segv-jmp.
authorMark Wielaard <mark@klomp.org>
Sun, 7 Apr 2019 20:27:52 +0000 (22:27 +0200)
committerMark Wielaard <mark@klomp.org>
Sun, 7 Apr 2019 20:27:52 +0000 (22:27 +0200)
On arm64-linux memcheck/tests/leak-segv-jmp would fail because there
was no do_syscall_WRK implementation for that architecture. Implement
and adjust line numbers in .exp file to make it PASS.

memcheck/tests/leak-segv-jmp.c
memcheck/tests/leak-segv-jmp.stderr.exp

index 2a175c68b6c4a9793b8f49d463d8bb0a70bb466e..58c5559d876d8739495a788a25f3e4f97a4c1820 100644 (file)
@@ -108,6 +108,24 @@ asm(
 ".previous\n"
 );
 
+#elif defined(VGP_arm64_linux)
+extern UWord do_syscall_WRK (
+          UWord a1, UWord a2, UWord a3,
+          UWord a4, UWord a5, UWord a6,
+          UWord syscall_no
+       );
+asm(
+".text\n"
+".globl do_syscall_WRK\n"
+"do_syscall_WRK:\n"
+"        mov x8, x6\n"
+"        mov x6, 0\n"
+"        mov x7, 0\n"
+"        svc 0\n"
+"        ret\n"
+".previous\n"
+);
+
 #elif defined(VGP_s390x_linux)
 UWord do_syscall_WRK (
    UWord syscall_no,
@@ -238,6 +256,10 @@ static void non_simd_mprotect (long tid, void* addr, long len)
                                     &err);
    if (err)
       mprotect_result = -1;
+#elif defined(VGP_arm64_linux)
+   mprotect_result = do_syscall_WRK((UWord) addr, len, PROT_NONE,
+                                    0, 0, 0,
+                                    __NR_mprotect);
 #else
    mprotect_result = do_syscall_WRK(__NR_mprotect,
                                     (UWord) addr, len, PROT_NONE,
index 18e60dba11fd30e70c56a6754e9d520f99f09378..bc3d11d268f7c5e403d22f64820d3db53c915f5c 100644 (file)
@@ -14,8 +14,8 @@ To see them, rerun with: --leak-check=full --show-leak-kinds=all
 expecting a leak
 1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: f (leak-segv-jmp.c:271)
-   by 0x........: main (leak-segv-jmp.c:346)
+   by 0x........: f (leak-segv-jmp.c:293)
+   by 0x........: main (leak-segv-jmp.c:368)
 
 LEAK SUMMARY:
    definitely lost: 1,000 bytes in 1 blocks
@@ -30,8 +30,8 @@ mprotect result 0
 expecting a leak again
 1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: f (leak-segv-jmp.c:271)
-   by 0x........: main (leak-segv-jmp.c:346)
+   by 0x........: f (leak-segv-jmp.c:293)
+   by 0x........: main (leak-segv-jmp.c:368)
 
 LEAK SUMMARY:
    definitely lost: 1,000 bytes in 1 blocks
@@ -46,8 +46,8 @@ full mprotect result 0
 expecting a leak again after full mprotect
 1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: f (leak-segv-jmp.c:271)
-   by 0x........: main (leak-segv-jmp.c:346)
+   by 0x........: f (leak-segv-jmp.c:293)
+   by 0x........: main (leak-segv-jmp.c:368)
 
 LEAK SUMMARY:
    definitely lost: 1,000 bytes in 1 blocks
@@ -62,13 +62,13 @@ mprotect result 0
 expecting heuristic not to crash after full mprotect
 1,000 bytes in 1 blocks are definitely lost in loss record ... of ...
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: f (leak-segv-jmp.c:271)
-   by 0x........: main (leak-segv-jmp.c:346)
+   by 0x........: f (leak-segv-jmp.c:293)
+   by 0x........: main (leak-segv-jmp.c:368)
 
 200,000 bytes in 1 blocks are possibly lost in loss record ... of ...
    at 0x........: calloc (vg_replace_malloc.c:...)
-   by 0x........: f (leak-segv-jmp.c:318)
-   by 0x........: main (leak-segv-jmp.c:346)
+   by 0x........: f (leak-segv-jmp.c:340)
+   by 0x........: main (leak-segv-jmp.c:368)
 
 LEAK SUMMARY:
    definitely lost: 1,000 bytes in 1 blocks