Wednesday, March 24, 2021

[PATCH] fix valgrind abort

Hi ports,

The valgrind was aborted after updated Pert to 5.32.1 as below:

$ sysctl -n kern.version
OpenBSD 6.9-beta (GENERIC.MP) #428: Wed Mar 24 11:12:16 MDT 2021
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

$ /usr/bin/perl --version

This is perl 5, version 32, subversion 1 (v5.32.1) built for amd64-openbsd
</snip>

$ cd /usr/ports/devel/valgrind
$ doas make install
$ valgrind /bin/ls
Abort trap
$

Because, Perl 5.32.1 has changed the way hexadecimal string are
handled as below:

Perl 5.30.3: "0x1234" + 0x1000 -> 0x2234
Perl 5.32.1: "0x1234" + 0x1000 -> 0x1000

Perl 5.32.1 does not consider anything after 'x' to be a number, but
only the first '0' is consider to be a number.

I made the following patch.

ok? comments?
--
ASOU Masato

Index: devel/valgrind/patches/patch-coregrind_link_tool_exe_openbsd_in
===================================================================
RCS file: /cvs/ports/devel/valgrind/patches/patch-coregrind_link_tool_exe_openbsd_in,v
retrieving revision 1.5
diff -u -p -r1.5 patch-coregrind_link_tool_exe_openbsd_in
--- devel/valgrind/patches/patch-coregrind_link_tool_exe_openbsd_in 5 Oct 2020 01:45:58 -0000 1.5
+++ devel/valgrind/patches/patch-coregrind_link_tool_exe_openbsd_in 25 Mar 2021 00:27:19 -0000
@@ -10,7 +10,7 @@
+# strip command rewrite offset and align in ELF file. Therefor, when valgrind
+# launch memcheck-amd64-openbsd, an Abort trap occurs in the execvp() system
+# call.
-+my $cmd = sprintf "$cc -static -nopie -Wl,--strip-all -Wl,-Ttext=0x%x", "$ala + 0x1000";
++my $cmd = sprintf "$cc -static -nopie -Wl,--strip-all -Wl,-Ttext=0x%x", hex($ala) + 0x1000;

-# so, build up the complete command here:
-# 'cc' -static -Ttext='ala' 'restargs'

No comments:

Post a Comment