From: Paul Floyd Date: Fri, 16 Feb 2024 19:58:01 +0000 (+0100) Subject: linux arm regtest: fix memcheck leak-segv-jmp X-Git-Tag: VALGRIND_3_23_0~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=694da83081c4ec13f051482284cd4308b8540c23;p=thirdparty%2Fvalgrind.git linux arm regtest: fix memcheck leak-segv-jmp The hand rolled asm syscall to mprotect was failing. At least it now passes on my rpi. --- diff --git a/memcheck/tests/leak-segv-jmp.c b/memcheck/tests/leak-segv-jmp.c index 97bddaf23..9e4b90a76 100644 --- a/memcheck/tests/leak-segv-jmp.c +++ b/memcheck/tests/leak-segv-jmp.c @@ -98,12 +98,13 @@ asm( ".text\n" ".globl do_syscall_WRK\n" "do_syscall_WRK:\n" -" push {r4, r5, r7}\n" -" ldr r4, [sp, #12]\n" -" ldr r5, [sp, #16]\n" -" ldr r7, [sp, #20]\n" +" push {r7, ip}\n" +" mov r7, r0\n" +" mov r0, r1\n" +" mov r1, r2\n" +" mov r2, r3\n" " svc 0x0\n" -" pop {r4, r5, r7}\n" +" pop {r7, ip}\n" " bx lr\n" ".previous\n" ); diff --git a/memcheck/tests/leak-segv-jmp.stderr.exp b/memcheck/tests/leak-segv-jmp.stderr.exp index b30fd76ac..9b9aad2ae 100644 --- a/memcheck/tests/leak-segv-jmp.stderr.exp +++ b/memcheck/tests/leak-segv-jmp.stderr.exp @@ -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:389) - by 0x........: main (leak-segv-jmp.c:464) + by 0x........: f (leak-segv-jmp.c:390) + by 0x........: main (leak-segv-jmp.c:465) 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:389) - by 0x........: main (leak-segv-jmp.c:464) + by 0x........: f (leak-segv-jmp.c:390) + by 0x........: main (leak-segv-jmp.c:465) 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:389) - by 0x........: main (leak-segv-jmp.c:464) + by 0x........: f (leak-segv-jmp.c:390) + by 0x........: main (leak-segv-jmp.c:465) 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:389) - by 0x........: main (leak-segv-jmp.c:464) + by 0x........: f (leak-segv-jmp.c:390) + by 0x........: main (leak-segv-jmp.c:465) 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:436) - by 0x........: main (leak-segv-jmp.c:464) + by 0x........: f (leak-segv-jmp.c:437) + by 0x........: main (leak-segv-jmp.c:465) LEAK SUMMARY: definitely lost: 1,000 bytes in 1 blocks