Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Fails to decode vpcmov #11

@sir-ragna

Description

@sir-ragna

I'm doing something that might be a bit naïve. I am trying to count each type of instruction of every 64-bit ELF binary on my system to analyze the popularity of instructions. I do this by extracting the .text section and attempting to disassemble all the instructions in them.

Several binaries provide issues such as /bin/go and /bin/john. I managed to isolate a case from the john binary that gives me trouble. Attached you can find the binary and some source code I used to isolate the issue. reproduce_issue.zip

unsigned char buffer[48] =
{
    0x4c, 0x8b, 0x95, 0x40, 0xfe, 0xff, 0xff, /* mov    r10,QWORD PTR [rbp-0x1c0] */
    0xc5, 0x29, 0xef, 0xf2,                   /* vpxor  xmm14,xmm10,xmm2 */
    0x8f, 0xe8, 0x20, 0xa2, 0xc6, 0x30,       /* vpcmov xmm0,xmm11,xmm6,xmm3 */
    0xc4, 0xc1, 0x79, 0x6f, 0x3b,             /* vmovdqa xmm7,XMMWORD PTR [r11] */
};

size_t size = sizeof(buffer);

nmd_x86_instruction instruction;
char formatted_instruction[128];

size_t i = 0;
for (; i < size; i += instruction.length)
{
    if (!nmd_x86_decode(buffer + i, size - i, &instruction, NMD_X86_MODE_64, NMD_X86_DECODER_FLAGS_ALL))
    { 
        fprintf(stderr, "\nISSUE\n\n"); 
        break;
    }

    nmd_x86_format(&instruction, formatted_instruction, NMD_X86_INVALID_RUNTIME_ADDRESS, NMD_X86_FORMAT_FLAGS_HEX);

    printf("%li\t%i %s\n", i, instruction.id, formatted_instruction);
}

Version 33ac3b62c7d1eb28ae6b71d4dd78aa133ef96488 nmd (heads/master)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions