Bug 530165
| Summary: | valgrind does not understand 'address-size-override loopne' | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Jeff Bastian <jbastian> | ||||||
| Component: | valgrind | Assignee: | Dodji Seketeli <dodji> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | BaseOS QE Security Team <qe-baseos-security> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | medium | ||||||||
| Version: | 5.4 | CC: | dodji, ebachalo, jwest, mnowak, syeghiay, tao | ||||||
| Target Milestone: | rc | Keywords: | Reopened | ||||||
| Target Release: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2010-03-30 08:03:50 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Bug Depends On: | 522330 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
Disassembly of the loop: 4004ed: b9 03 00 00 00 mov $0x3,%ecx 4004f2: 83 c3 01 add $0x1,%ebx 4004f5: 67 e0 fa loopnel 4004f2 <main+0x2e> 4004f8: b8 2a 06 40 00 mov $0x40062a,%eax Created attachment 365579 [details] loopneq.s demo program Note: using 64-bit registers on x86_64 keeps valgrind happy: $ diff loopnel.s loopneq.s 32c32 < movl $3, %ecx --- > movq $3, %rcx 35c35 < loopnel .L3 --- > loopneq .L3 $ gcc -g loopneq.s $ valgrind -q ./a.out start count = 0 end count = 3 I'll add it, but in the testcase it makes absolutely no sense, just bigger code. movl $NNN, %ecx already zero-extends the value to 64-bits, so it is cheaper to just use loopne (== loopneq in 64-bit code). I also reported this upstream: https://bugs.kde.org/show_bug.cgi?id=211371 The support is added in rawhide valgrind (valgrind-3.5.0-amd64-loopnel.patch). An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2010-0272.html |
Created attachment 365575 [details] loopnel.s demo program Description of problem: valgrind does not handle address-size-override prefix with loopne instruction. valgrind gives an error if it encounters this instruction: vex amd64->IR: unhandled instruction bytes: 0x67 0xE0 0xFA 0xB8 0x2A 0x6 According to the source code, valgrind does not support the address-size-override prefix; from valgrind-3.2.1/VEX/priv/guest-amd64/toIR.c case 0xE0: /* LOOPNE disp8: decrement count, jump if count != 0 && ZF==0 */ case 0xE1: /* LOOPE disp8: decrement count, jump if count != 0 && ZF==1 */ case 0xE2: /* LOOP disp8: decrement count, jump if count != 0 */ { /* The docs say this uses rCX as a count depending on the address size override, not the operand one. Since we don't handle address size overrides, I guess that means RCX. */ ... if (have66orF2orF3(pfx) || haveASO(pfx)) goto decode_failure; The haveASO() function checks for the address-size-override prefix (0x67). Please add support for the address-size-override prefix. Version-Release number of selected component (if applicable): valgrind-3.2.1-6.el5.x86_64 How reproducible: every time Steps to Reproduce: 1. install RHEL 5.4 on x86_64 system 2. gcc -g loopnel.s 3. valgrind ./a.out Actual results: vex amd64->IR: unhandled instruction bytes: 0x67 0xE0 0xFA 0xB8 0x2A 0x6 Expected results: valgrind handles the instruction Additional info: