Bug 134478 - (cli, sti) vex amd64->IR: unhandled instruction bytes: 0xFA 0xC7 0x45 0xFC
Summary: (cli, sti) vex amd64->IR: unhandled instruction bytes: 0xFA 0xC7 0x45 0xFC
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.2.1
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks: 253451
  Show dependency treegraph
 
Reported: 2006-09-21 23:54 UTC by Yousong Mei
Modified: 2010-11-11 19:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yousong Mei 2006-09-21 23:54:08 UTC
valgrind 3.2.1 report "illegal instruction" for code that has CLI/STI.
e.g. with the following code,
int main()
{
   volatile int x;
   asm volatile ("cli");
   x = 0;
   asm volatile ("sti");
   return 0;
}

Valgrind -v generates the following output:-
--14078-- Command line
--14078--    a.out
--14078-- Startup, with flags:
--14078--    -v
--14078-- Contents of /proc/version:
--14078--   Linux version 2.6.16-18_yoda2smp (orbuild@yoran-bldsvr5) (gcc
version 4.0.2 20051125 (Red Hat 4.0.2-8)) #1 SMP PREEMPT Fri May 26 11:33:53 PDT
2006
--14078-- Arch and hwcaps: AMD64, amd64-sse2
--14078-- Valgrind library directory: /opt/or-develtools/lib/valgrind
--14078-- Reading syms from /home/ymei/a.out (0x400000)
--14078-- Reading syms from
/orenv/develtools-fc4-x86_64-ro/lib/valgrind/amd64-linux/memcheck (0x38000000)
--14078--    object doesn't have a symbol table
--14078--    object doesn't have a dynamic symbol table
--14078-- Reading suppressions file: /opt/or-develtools/lib/valgrind/default.supp
--14078-- Reading syms from
/orenv/develtools-fc4-x86_64-ro/lib/valgrind/amd64-linux/vgpreload_core.so
(0x4802000)
--14078--    object doesn't have a symbol table
--14078-- Reading syms from
/orenv/develtools-fc4-x86_64-ro/lib/valgrind/amd64-linux/vgpreload_memcheck.so
(0x4903000)
--14078--    object doesn't have a symbol table
--14078-- REDIR: 0x3DE4C13F90 (index) redirected to 0x4906720 (index)
--14078-- REDIR: 0x3DE4C14140 (strcmp) redirected to 0x49068B0 (strcmp)
--14078-- REDIR: 0x3DE4C14170 (strlen) redirected to 0x49067C0 (strlen)
--14078-- Reading syms from /usr/lib64/libstdc++.so.6.0.7 (0x3DE7500000)
--14078--    object doesn't have a symbol table
--14078-- Reading syms from /lib64/libm-2.3.5.so (0x3DE5100000)
--14078-- Reading syms from /lib64/libgcc_s-4.0.2-20051126.so.1 (0x3DE6D00000)
--14078--    object doesn't have a symbol table
--14078-- Reading syms from /lib64/libc-2.3.5.so (0x3DE4E00000)
--14078-- REDIR: 0x3DE4E72420 (rindex) redirected to 0x49065D0 (rindex)
vex amd64->IR: unhandled instruction bytes: 0xFA 0xC7 0x45 0xFC
==14078== valgrind: Unrecognised instruction at address 0x40051C.
==14078== Your program just tried to execute an instruction that Valgrind
==14078== did not recognise.  There are two possible reasons for this.
==14078== 1. Your program has a bug and erroneously jumped to a non-code
==14078==    location.  If you are running Memcheck and you just saw a
==14078==    warning about a bad jump, it's probably your program's fault.
==14078== 2. The instruction is legitimate but Valgrind doesn't handle it,
==14078==    i.e. it's Valgrind's fault.  If you think this is the case or
==14078==    you are not sure, please let us know and we'll try to fix it.
==14078== Either way, Valgrind will now raise a SIGILL signal which will
==14078== probably kill your program.
==14078== 
==14078== Process terminating with default action of signal 4 (SIGILL): dumping core
==14078==  Illegal opcode at address 0x40051C
==14078==    at 0x40051C: main (in /home/ymei/a.out)
--14078-- REDIR: 0x3DE4E6ABE0 (free) redirected to 0x490575E (free)
--14078-- REDIR: 0x3DE4E733E0 (memset) redirected to 0x4906B00 (memset)
==14078== 
==14078== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 2)
--14078-- supp:    1 strlen-not-intercepted-early-enough-HACK-5
--14078-- supp:    4 dl_relocate_object
==14078== malloc/free: in use at exit: 0 bytes in 0 blocks.
==14078== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==14078== 
==14078== All heap blocks were freed -- no leaks are possible.
--14078--  memcheck: sanity checks: 2 cheap, 1 expensive
--14078--  memcheck: auxmaps: 113 auxmap entries (7232k, 7M) in use
--14078--  memcheck: auxmaps: 423221 searches, 826356 comparisons
--14078--  memcheck: SMs: n_issued      = 19 (304k, 0M)
--14078--  memcheck: SMs: n_deissued    = 0 (0k, 0M)
--14078--  memcheck: SMs: max_noaccess  = 524287 (8388592k, 8191M)
--14078--  memcheck: SMs: max_undefined = 0 (0k, 0M)
--14078--  memcheck: SMs: max_defined   = 138 (2208k, 2M)
--14078--  memcheck: SMs: max_non_DSM   = 19 (304k, 0M)
--14078--  memcheck: max sec V bit nodes:    0 (0k, 0M)
--14078--  memcheck: set_sec_vbits8 calls: 0 (new: 0, updates: 0)
--14078--  memcheck: max shadow mem size:   4448k, 4M
--14078-- translate:            fast SP updates identified: 904 ( 86.5%)
--14078-- translate:   generic_known SP updates identified: 82 (  7.8%)
--14078-- translate: generic_unknown SP updates identified: 59 (  5.6%)
--14078--     tt/tc: 2,904 tt lookups requiring 2,927 probes
--14078--     tt/tc: 2,904 fast-cache updates, 5 flushes
--14078--  transtab: new        1,353 (32,509 -> 615,415; ratio 189:10) [0 scs]
--14078--  transtab: dumped     0 (0 -> ??)
--14078--  transtab: discarded  15 (315 -> ??)
--14078-- scheduler: 255,681 jumps (bb entries).
--14078-- scheduler: 2/1,810 major/minor sched events.
--14078--    sanity: 3 cheap, 1 expensive checks.
--14078--    exectx: 30,011 lists, 5 contexts (avg 0 per list)
--14078--    exectx: 5 searches, 0 full compares (0 per 1000)
--14078--    exectx: 0 cmp2, 10 cmp4, 0 cmpAll
Illegal instruction
Comment 1 Julian Seward 2006-09-22 00:36:43 UTC
What do cli and sti do in user-mode?  I can see the kernel might want
to use them, but in user-mode what are they for?
Comment 2 Jeremy Fitzhardinge 2006-09-22 00:43:21 UTC
It's possible to use them in usermode if the process has used iopl() get 
access to them.  But its pretty rare, and they're pretty much impossible 
to use correctly in general.  The big offender used to be the X server, 
but I don't think it does any more.

You could probably implement them as no-ops without any loss of 
generality.  (But if you did, I bet the next report will be that in/out 
are not implemented.)
Comment 3 Yousong Mei 2006-09-22 00:48:11 UTC
In our case, we try to measure some timing and we do not want to interrupt
to happen when we measure the timing, which will skew the result.

Thanks.

At 03:36 PM 9/21/2006, Julian Seward wrote:
[bugs.kde.org quoted mail]