Package: valgrind
Version: 1:3.0.1-2
Severity: important

Valgrind crashes when executing the cpuid instruction.

This means valgrind can't be used to test programs that use for example
/usr/lib/i686/cmov/libcrypto.so.0.9.8 from libssl0.9.8, since it calls the
OPENSSL_ia32_cpuid function that executes cpuid.

Version 1:2.4.0-3 of valgrind doesn't have this problem.

Disabling /usr/lib/i686/cmov/libcrypto.so.0.9.8 by renaming it can be used
as a work-around.

I'm including a test program and the output when running it in valgrind.

/Mikael

-- System Information:
Debian Release: testing/unstable
  APT prefers stable
  APT policy: (871, 'stable'), (50, 'testing'), (30, 'unstable'), (10, 
'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-vserver-k7
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)

Versions of packages valgrind depends on:
ii  libc6                         2.3.5-7    GNU C Library: Shared libraries an

Versions of packages valgrind recommends:
ii  gdb                           6.3-6      The GNU Debugger

-- no debconf information
#include <stdio.h>
#include <string.h>

static void cpuid(int operation)
{
    unsigned int eax;
    union {
	char str[13];
	struct {
	    unsigned int ebx, edx, ecx;
	} regs;
    } u;

    memset(&u, 0, sizeof(u));

    __asm__("cpuid"
	    : "=a" (eax),
	      "=b" (u.regs.ebx),
	      "=c" (u.regs.ecx),
	      "=d" (u.regs.edx)
	    : "0" (operation));

    printf("Cpuid %d %08x %08x %08x %08x %s\n",
	   operation, eax, u.regs.ebx, u.regs.ecx, u.regs.edx, u.str);
}

int main()
{
    cpuid(0);

    return 0;
}
==23961== Memcheck, a memory error detector.
==23961== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==23961== Using LibVEX rev 1367, a library for dynamic binary translation.
==23961== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==23961== Using valgrind-3.0.1-Debian, a dynamic binary instrumentation 
framework.
==23961== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==23961== For more details, rerun with: -v
==23961== 
--23961-- DWARF2 CFI reader: unhandled CFI instruction 0:50
--23961-- DWARF2 CFI reader: unhandled CFI instruction 0:50

vex: priv/host-x86/hdefs.c:2315 (emit_X86Instr): Assertion `0' failed.
vex storage:  P 512,  T total 45149176 (1423758),  T curr 146820 (4423)

valgrind: the 'impossible' happened:
   LibVEX called failure_exit().
==23961==    at 0xB0016962: vgPlain_core_panic_at (m_libcassert.c:181)
==23961==    by 0xB0016961: panic (m_libcassert.c:177)
==23961==    by 0xB001697F: vgPlain_core_panic_at (m_libcassert.c:182)
==23961==    by 0xB0016990: vgPlain_core_panic (m_libcassert.c:187)
==23961==    by 0xB002388C: failure_exit (m_translate.c:360)
==23961==    by 0xB00573B6: vex_assert_fail (vex_util.c:163)
==23961==    by 0xB005B8AD: emit_X86Instr (hdefs.c:2315)
==23961==    by 0xB0056FF5: LibVEX_Translate (vex_main.c:574)
==23961==    by 0xB0023E11: vgPlain_translate (m_translate.c:585)
==23961==    by 0xB0038EE6: handle_tt_miss (scheduler.c:566)
==23961==    by 0xB0039212: vgPlain_scheduler (scheduler.c:680)
==23961==    by 0xB004F431: vgModuleLocal_thread_wrapper (syswrap-linux.c:80)
==23961==    by 0xB004B99E: run_a_thread_NORETURN (syswrap-x86-linux.c:150)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==23961==    at 0x8048398: cpuid (test-cpuid.c:5)
==23961==    by 0x1B936EBF: __libc_start_main (in /lib/tls/libc-2.3.5.so)
==23961==    by 0x8048300: ??? (start.S:119)


Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what Linux distro you are using.  Thanks.

Reply via email to