You are not logged in.

#1 2007-08-16 08:06:54

neok
Member
From: Cyprus
Registered: 2003-12-14
Posts: 190
Website

SOLVED: Valgrind fails with "Illegal instruction" error

Hi

I am trying to use valgrind to profile an app I am developing but it fails after starting with an "Illegal instruction" error message. This happens if I try to profile any other program too so perhaps its valgrind to blame?
<snip>

Thanks herr.jth for finding out that this is a valgrind bug:

(reported) Valgrind bug.

http://bugs.kde.org/show_bug.cgi?id=148447
http://bugs.kde.org/show_bug.cgi?id=147825

The last one matches my experiences with the svn-trunk. I will do some testing with static binaries using dietlibc, but I think this thread can be set to solved. No arch-specific problem, rather one with glibc 2.6 and amd64. Lets wait for a patch

Last edited by neok (2007-08-19 08:41:24)


Regards

Neoklis ... Ham Radio Call: 5B4AZ

Offline

#2 2007-08-18 16:26:42

herr.jth
Member
From: Germany
Registered: 2007-08-18
Posts: 12

Re: SOLVED: Valgrind fails with "Illegal instruction" error

Hi,
well, not actually helpful for you, but I have exactly the same problem on a Intel Core 2 Duo Machine, also running "don`t panic".

Maybe some additional information will be helpful:

bash-3.2$ /lib/libc.so.6
GNU C Library stable release version 2.6.1, by Roland McGrath et al.
Copyright (C) 2007 Free Software Foundation, Inc.

At this moment the most recent one in the arch repository I think.

bash-3.2$ valgrind --version
valgrind-3.2.3

My error-message (though almost the same)

vex amd64->IR: unhandled instruction bytes: 0x66 0x66 0x66 0x66
==1811== valgrind: Unrecognised instruction at address 0x4014571.
==1811== Process terminating with default action of signal 4 (SIGILL)
==1811==  Illegal opcode at address 0x4014571
==1811==    at 0x4014571: memcpy (in /lib/ld-2.6.1.so)
==1811==    by 0x40043AC: dl_main (in /lib/ld-2.6.1.so)
==1811==    by 0x4012827: _dl_sysdep_start (in /lib/ld-2.6.1.so)
==1811==    by 0x4001F20: _dl_start (in /lib/ld-2.6.1.so)
==1811==    by 0x4000A67: (within /lib/ld-2.6.1.so)

and it ends also with "illegal instruction". I left out the other stuff as it is the same like posted before.

What surprises me is this line: vex amd64->IR: unhandled instruction bytes: 0x66 0x66 0x66 0x66

As far as I know, 0x66 is the simple Operand-Size Prefix in an x86 Instruction. I think its highly unlikely (not to say impossible) that this is unhandled by Valgrind. So the error must be somewhere else. What I know is that the current Valgrind has problems with glibc 2.6, but I tried the newest svn-version of Valgrind that quits, too. Altough not with the same error.

svn-Version from August 18th error-message:

bash-3.2$ valgrind /bin/ls
==22437== Memcheck, a memory error detector.
==22437== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==22437== Using LibVEX rev 1775, a library for dynamic binary translation.
==22437== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==22437== Using valgrind-3.3.0.SVN, a dynamic binary instrumentation framework.
==22437== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==22437== For more details, rerun with: -v
==22437== 
--22437-- DWARF2 CFI reader: unhandled DW_OP_ opcode 0x6

It says "unhandled opcode", too. I have really no clue what could cause this behavior and I`am tend to think that this is an Valgrind Bug.

If anyone has an idea what is happening here, let me know ;)

Offline

#3 2007-08-18 21:52:15

herr.jth
Member
From: Germany
Registered: 2007-08-18
Posts: 12

Re: SOLVED: Valgrind fails with "Illegal instruction" error

So, I did some research, and yes, it is a (reported) Valgrind bug.

http://bugs.kde.org/show_bug.cgi?id=148447
http://bugs.kde.org/show_bug.cgi?id=147825

The last one matches my experiences with the svn-trunk. I will do some testing with static binaries using dietlibc, but I think this thread can be set to solved. No arch-specific problem, rather one with glibc 2.6 and amd64. Lets wait for a patch wink

Offline

#4 2007-08-24 06:35:50

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: SOLVED: Valgrind fails with "Illegal instruction" error

fixed in valgrind-3.2.3-2.1

Thanks for the above links. They contained the patch.

Offline

#5 2007-11-30 17:56:20

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: SOLVED: Valgrind fails with "Illegal instruction" error

I still get this error with valgrind 3.2.3-3... Did something broke after 3.2.3-2.1?

Offline

#6 2007-11-30 18:17:55

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: SOLVED: Valgrind fails with "Illegal instruction" error

Work with that patch:

valgrind-3.2.3-unhandled_instruction.patch wrote:

--- VEX/priv/guest-amd64/toIR_orig.c    2007-01-12 18:19:52.000000000 -0500
+++ VEX/priv/guest-amd64/toIR.c 2007-11-30 13:08:16.000000000 -0500
@@ -8334,7 +8334,7 @@
       as many invalid combinations as possible. */
    n_prefixes = 0;
    while (True) {
-      if (n_prefixes > 5) goto decode_failure;
+      if (n_prefixes > 7) goto decode_failure;
       pre = getUChar(delta);
       switch (pre) {
          case 0x66: pfx |= PFX_66; break;

Taken from http://bugs.kde.org/show_bug.cgi?id=148447#c16

Offline

#7 2008-01-05 14:19:51

train
Member
Registered: 2007-03-17
Posts: 38

Re: SOLVED: Valgrind fails with "Illegal instruction" error

Uhm -- can this be applied to the valgrind package in extra?
starting off to get my abs valgrind...

Sorry for the inconvenience...

Offline

#8 2008-01-05 14:57:13

train
Member
Registered: 2007-03-17
Posts: 38

Re: SOLVED: Valgrind fails with "Illegal instruction" error

Tried to get it patched and reinstalled it. The patch worked.  And i am using the new
binary of valgrind. However i still get the error:

New valgrind says:
==24950== Using LibVEX rev 1732, a library for dynamic binary translation.
==24950== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==24950== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==24950== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.

(In the valgrind bugzilla it says that the bug is fixed in libVEX 1777. However, i can't
tell how the dynamic libraries are handled on arch. My valgrind says:
ldd /usr/bin/valgrind
ldd /usr/bin/valgrind
    linux-vdso.so.1 =>  (0x00007fffef7fe000)
    libc.so.6 => /lib/libc.so.6 (0x00002b2dbb509000)
    /lib/ld-linux-x86-64.so.2 (0x00002b2dbb2ed000)

even libvex.a in /usr/lib/valgrind/amd64-linux/libvex.a has been updated.

Offline

#9 2008-01-09 18:56:03

train
Member
Registered: 2007-03-17
Posts: 38

Re: SOLVED: Valgrind fails with "Illegal instruction" error

Okay, with valgrind-3.3.0-1 it works.

Offline

Board footer

Powered by FluxBB