binutils/objdump should do the software equivalent of a #UD (emit "(bad)" or whatever is the binutils convention for unrecognized instructions) if f2/f3 prefixes are present before rdrand/rdseed. Intel SDM says so. Binutils disassembles them as if F2/F3 were legal legacy prefixes for these instructions. I demonstrated this with binutils 2.24. I did not check later versions. % objdump -v GNU objdump (GNU Binutils) 2.24 Copyright 2013 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. % cat foo.c int main() { asm volatile(".byte 0xF3, 0x0F, 0xC7, 0xF8"); asm volatile(".byte 0xF3, 0x0F, 0xC7, 0xF0"); return 0; } % gcc foo.c % objdump -D a.out | grep -A10 'main>:' 0000000000400496 <main>: 400496: 55 push rbp 400497: 48 89 e5 mov rbp,rsp 40049a: f3 0f c7 f8 repz rdseed eax 40049e: f3 0f c7 f0 repz rdrand eax 4004a2: b8 00 00 00 00 mov eax,0x0 4004a7: 5d pop rbp 4004a8: c3 ret 4004a9: 0f 1f 80 00 00 00 00 nop DWORD PTR [rax+0x0] 00000000004004b0 <__libc_csu_init>:
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f24bcbaa5a6e30556e2da20bfd78e7823741475a commit f24bcbaa5a6e30556e2da20bfd78e7823741475a Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Apr 15 09:53:13 2015 -0700 Handle invalid prefixes for rdrand and rdseed This patch puts rdrand and rdseed in prefix_table so that invalid prefixes for rdrand and rdseed are handled properly. gas/testsuite/ PR binutils/17898 * gas/i386/prefix.s: Add rdrand/rdseed prefix tests. * gas/i386/prefix.d: Updated. opcodes/ PR binutils/17898 * i386-dis.c (PREFIX_0FC7_REG_6): Renamed to ... (PREFIX_MOD_0_0FC7_REG_6): This. (PREFIX_MOD_3_0FC7_REG_6): New. (PREFIX_MOD_3_0FC7_REG_7): Likewise. (prefix_table): Replace PREFIX_0FC7_REG_6 with PREFIX_MOD_0_0FC7_REG_6. Add PREFIX_MOD_3_0FC7_REG_6 and PREFIX_MOD_3_0FC7_REG_7. (mod_table): Replace PREFIX_0FC7_REG_6 with PREFIX_MOD_0_0FC7_REG_6. Use PREFIX_MOD_3_0FC7_REG_6 and PREFIX_MOD_3_0FC7_REG_7.
Fixed for 2.26.