The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Tuesday, September 08, 2015

I don't think anybody actually uses this instruction

Odd.

The runtime code for DynASM looks a bit … odd, and I was curious what Valgrind had to say about it.

[spc]lucy:~/source/jit>valgrind ./calc
==15664== Memcheck, a memory error detector.
==15664== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==15664== Using LibVEX rev 1575, a library for dynamic binary translation.
==15664== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==15664== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
==15664== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==15664== For more details, rerun with: -v
==15664== 
x = 1 - 0
vex x86->IR: unhandled instruction bytes: 0xCE 0x66 0xA3 0xCE
==15664== Your program just tried to execute an instruction that Valgrind
==15664== did not recognise.  There are two possible reasons for this.
==15664== 1. Your program has a bug and erroneously jumped to a non-code
==15664==    location.  If you are running Memcheck and you just saw a
==15664==    warning about a bad jump, it's probably your program's fault.
==15664== 2. The instruction is legitimate but Valgrind doesn't handle it,
==15664==    i.e. it's Valgrind's fault.  If you think this is the case or
==15664==    you are not sure, please let us know.
==15664== Either way, Valgrind will now raise a SIGILL signal which will
==15664== probably kill your program.
==15664== Use of uninitialised value of size 4
==15664==    at 0xBC945C: _itoa_word (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBCCA09: vfprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBE5ACA: vsprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBD2DEA: sprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0x804ACA3: crashreport_hexdump (crashreport.c:154)
==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
==15664==    by 0x804A9DD: main (calc.dasc:472)
==15664== 
==15664== Conditional jump or move depends on uninitialised value(s)
==15664==    at 0xBC9462: _itoa_word (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBCCA09: vfprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBE5ACA: vsprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBD2DEA: sprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0x804ACA3: crashreport_hexdump (crashreport.c:154)
==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
==15664==    by 0x804A9DD: main (calc.dasc:472)
==15664== 
==15664== Use of uninitialised value of size 4
==15664==    at 0xBC9474: _itoa_word (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBCCA09: vfprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBE5ACA: vsprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xBD2DEA: sprintf (in /lib/tls/libc-2.3.4.so)
==15664==    by 0x804ACA3: crashreport_hexdump (crashreport.c:154)
==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
==15664==    by 0x804A9DD: main (calc.dasc:472)
==15664== 
==15664== Use of uninitialised value of size 4
==15664==    at 0x804ACC0: crashreport_hexdump (crashreport.c:155)
==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
==15664==    by 0x804A9DD: main (calc.dasc:472)
  not in syscall (0xB0044ADC - 0xB0044B31)

valgrind: m_syswrap/syswrap-main.c:606 (vgPlain_client_syscall): Assertion 'sci->status.what == SsIdle' failed.
==15664==    at 0xB000E029: report_and_quit (m_libcassert.c:122)
==15664==    by 0xB000E1C2: vgPlain_assert_fail (m_libcassert.c:185)
==15664==    by 0xB003AEA6: vgPlain_client_syscall (syswrap-main.c:606)
==15664==    by 0xB002C826: handle_syscall (scheduler.c:623)
==15664==    by 0xB002CAED: vgPlain_scheduler (scheduler.c:726)
==15664==    by 0xB0014568: final_tidyup (m_main.c:2716)
==15664==    by 0xB00141C9: shutdown_actions_NORETURN (m_main.c:2578)
==15664==    by 0xB003C2D5: run_a_thread_NORETURN (syswrap-linux.c:139)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==15664==    at 0xD080B5: pthread_once (in /lib/tls/libpthread-2.3.4.so)
==15664==    by 0xC9BB76: free_mem (in /lib/tls/libc-2.3.4.so)
==15664==    by 0xC9B811: __libc_freeres (in /lib/tls/libc-2.3.4.so)
==15664==    by 0x4000336: _vgw_freeres (vg_preloaded.c:62)
==15664==    by 0xBB78C4: raise (in /lib/tls/libc-2.3.4.so)
==15664==    by 0x804B3E7: crashreport_handler (crashreport.c:495)
==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
==15664==    by 0x804A9DD: main (calc.dasc:472)


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.

[spc]lucy:~/source/jit>

Really Valgrind? You don't support the INTO opcode? Wow …

Obligatory Picture

[It's the most wonderful time of the year!]

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2019 by Sean Conner. All Rights Reserved.