Re: armhf: illegal hardware instruction

John Reiser <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
track down Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928224
which is 3 years old:
-----
Installed libc6 version: libc6-dgb:armhf 2.28-8

valgrind /bin/true

==12463== Memcheck, a memory error detector
==12463== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==12463== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      index
valgrind:  in an object with soname matching:   ld-linux-armhf.so.3
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-armhf.so.3
-----

Using valgrind 3.19.0 on Debian/sid :
% dpkg --print-architecture
armhf
% cat /proc/cpuinfo | grep vfpv3 | head -1
Features        : half thumb fastmult vfp edsp thumbee vfpv3 tls idiva
idivt vfpd32 lpae
> % ./memcheck/memcheck-arm-linux
> zsh: illegal hardware instruction  ./memcheck/memcheck-arm-linux
> 
> Just in case that help, here is the gdb output (*)
> 
> Let me know if you need more output.
> 
> (*)
> % gdb ./memcheck/memcheck-arm-linux
> GNU gdb (Debian 12.1-2) 12.1

> (gdb) r
> Starting program: /home/malat/valgrind-3.19.0/memcheck/memcheck-arm-linux
> 
> Program received signal SIGILL, Illegal instruction.
> vgPlain_am_startup (sp_at_startup=3204445840) at
> m_aspacemgr/aspacemgr-linux.c:1626
> 1626       init_nsegment(&seg);
> (gdb) bt full
> #0  vgPlain_am_startup (sp_at_startup=3204445840) at
> m_aspacemgr/aspacemgr-linux.c:1626
>          seg = {kind = 0, start = 0, end = 0, smode = SmLower, dev = 0,
> ino = 0, offset = 5378467285696512, mode = 3204445844, fnIdx =
> -1090521456, hasR = 0 '\000', hasW = 0 '\000', hasX = 38 '&',
>            hasT = 88 'X', isCH = 164 '\244'}
>          suggested_clstack_end = <optimized out>
>          __PRETTY_FUNCTION__ = "vgPlain_am_startup"


I tried to reproduce the reported behavior of valgrind-3.19.0 on my system :
----- /proc/cpuinfo
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 51.20
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4
-----
$ uname -a
Linux f33arm32 5.9.14-200.fc33.armv7hl #1 SMP Fri Dec 11 15:02:36 UTC 2020 armv7l armv7l armv7l GNU/Linux
$ ldd /bin/date
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6f6a000)
	libc.so.6 => /lib/libc.so.6 (0xb6e14000)
	/lib/ld-linux-armhf.so.3 (0xb6fbe000)

So the name of ld-linux contains 'armhf', although the Linux kernel is 'armv7l'.
The Features line of /proc/cpuinfo is not quite equivalent:
Mathieu's: half thumb fastmult vfp edsp thumbee vfpv3 tls       idiva idivt vfpd32 lpae
mine:      half thumb fastmult vfp edsp neon    vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

Re-building the software:
-----
$ wget https://sourceware.org/pub/valgrind/valgrind-3.19.0.tar.bz2
$ tar xf valgrind-3.19.0.tar.bz2
$ cd valgrind-3.19.0
$ ./configure
$ make -j4
$ file ./memcheck/memcheck-arm-linux
./memcheck/memcheck-arm-linux: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, BuildID[sha1]=2880b8ee178c482a9de58e83b161a0b38ca008ff, with debug_info, not stripped
$ ./memcheck/memcheck-arm-linux
valgrind: You cannot run './memcheck/memcheck-arm-linux' directly.
valgrind: You should use $prefix/bin/valgrind.
$ sudo make install
$ /usr/local/bin/valgrind --version
valgrind-3.19.0
$ /usr/local/bin/valgrind /bin/date
==14541== Memcheck, a memory error detector
==14541== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==14541== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==14541== Command: /bin/date
==14541==
Tue Jun 28 07:40:14 AM PDT 2022
==14541==
==14541== HEAP SUMMARY:
==14541==     in use at exit: 0 bytes in 0 blocks
==14541==   total heap usage: 427 allocs, 427 frees, 30,017 bytes allocated
==14541==
==14541== All heap blocks were freed -- no leaks are possible
==14541==
==14541== For lists of detected and suppressed errors, rerun with: -s
==14541== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
$
-----

So, valgrind-3.19.0 works for me.  I cannot reproduce the original bad behavior, nor the SIGILL,
on my hardware running 5.9.14-200.fc33.armv7hl.

If you believe that my Fedora33 environment is not close enough to your Debian/sid,
then please give the URL of a raw image for RaspberryPi Model 3 V1.2 that I can install
on a 32GB SDHC card.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.