https://bugs.kde.org/show_bug.cgi?id=415757

            Bug ID: 415757
           Summary: vex x86->IR: unhandled instruction bytes: 0x66 0xF
                    0xCE 0x4F
           Product: valgrind
           Version: 3.15 SVN
          Platform: Archlinux Packages
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: vex
          Assignee: jsew...@acm.org
          Reporter: alexhenri...@gmail.com
  Target Milestone: ---

Created attachment 124817
  --> https://bugs.kde.org/attachment.cgi?id=124817&action=edit
16-bit bswap test case

Steps to reproduce (on Arch Linux):

1. If ~/.wine exists, delete it.

2. Clone Wine with `git clone git://source.winehq.org/git/wine.git`

3. Compile a 32-bit-only version of Wine by running `./configure && make -j8`

4. Download the Leawo Blu-ray Player installer from
https://www.leawo.com/blu-ray-player/

5. Run `./wine blurayplayer_setup.exe` and click through the setup wizard. On
the last screen, uncheck "Launch Leawo Blu-Ray Player".

6. Run `valgrind --trace-children=yes ./wine 'C:\Program Files\Leawo\Blu-ray
Player\Leawo Blu-ray Player.exe'`

The program exits almost immediately with the following error:

vex x86->IR: unhandled instruction bytes: 0x66 0xF 0xCE 0x4F
==84194== valgrind: Unrecognised instruction at address 0xd272c9a.
==84194==    at 0xD272C9A: ???
==84194== Your program just tried to execute an instruction that Valgrind
==84194== did not recognise.  There are two possible reasons for this.
==84194== 1. Your program has a bug and erroneously jumped to a non-code
==84194==    location.  If you are running Memcheck and you just saw a
==84194==    warning about a bad jump, it's probably your program's fault.
==84194== 2. The instruction is legitimate but Valgrind doesn't handle it,
==84194==    i.e. it's Valgrind's fault.  If you think this is the case or
==84194==    you are not sure, please let us know and we'll try to fix it.
==84194== Either way, Valgrind will now raise a SIGILL signal which will
==84194== probably kill your program.
==84194== valgrind: Unrecognised instruction at address 0xd272c9a.
==84194==    at 0xD272C9A: ???
==84194== Your program just tried to execute an instruction that Valgrind
==84194== did not recognise.  There are two possible reasons for this.
==84194== 1. Your program has a bug and erroneously jumped to a non-code
==84194==    location.  If you are running Memcheck and you just saw a
==84194==    warning about a bad jump, it's probably your program's fault.
==84194== 2. The instruction is legitimate but Valgrind doesn't handle it,
==84194==    i.e. it's Valgrind's fault.  If you think this is the case or
==84194==    you are not sure, please let us know and we'll try to fix it.
==84194== Either way, Valgrind will now raise a SIGILL signal which will
==84194== probably kill your program.
0009:err:seh:segv_handler Got unexpected trap 0
0009:err:module:LdrInitializeThunk "panda.dll" failed to initialize, aborting
0009:err:module:LdrInitializeThunk Initializing dlls for L"C:\\Program
Files\\Leawo\\Blu-ray Player\\Leawo Blu-ray Player.exe" failed, status c000001d

The unrecognized instruction comes from closed-source Leawo code. 0F CE is
BSWAP and 66 is the 16-bit instruction prefix. According to the Intel and AMD
documentation, the result of a 16-bit BSWAP is undefined.[1][2] However, on all
Intel and AMD CPUs (since the 486 when BSWAP was added), a 16-bit BSWAP returns
the value 0.[3] The attached test program from Doug Johnson confirms this.
Because there is software in the wild that depends on this behavior, I think
Valgrind should return 0 as well.

[1]
https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf#page=214
[2] https://www.amd.com/system/files/TechDocs/24594.pdf#page=153
[3] https://gynvael.coldwind.pl/?id=268

$ sha256sum blurayplayer_setup.exe 
8b7eef385ba336b0a44fc6295c0f6e3d869555d9eb8c262f470cad2028ba7d4d

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to