Skip to content

[BPF] mod32 (0x94) instruction not recognized ! #54252

Open
@perror

Description

@perror

I compiled the following code with bpf-gcc:

int foo (void)
{
  int n = 10, m = 100, k = -1;

  n = 10 * k + ((unsigned) m) % 7;
  k = (n ^ m) >> 2;
  return k;
}

When disassembled with bpf-objdumd if get:

  400068:	bc 01 00 00 00 00 00 00          mov32 %r1,%r0
  400070:	61 a0 f8 ff 00 00 00 00          ldxw %r0,[%fp+-8]
  400078:	94 00 00 00 07 00 00 00          mod32 %r0,7
  400080:	bc 00 00 00 00 00 00 00          mov32 %r0,%r0
  400088:	0c 01 00 00 00 00 00 00          add32 %r1,%r0

But, the exact same opcodes produce the following with llvm-objdump-13 -d:

  524301:	bc 01 00 00 00 00 00 00	w1 = w0
  524302:	61 a0 f8 ff 00 00 00 00	r0 = *(u32 *)(r10 - 8)
  524303:	94 00 00 00 07 00 00 00	<unknown>
  524304:	bc 00 00 00 00 00 00 00	w0 = w0
  524305:	0c 01 00 00 00 00 00 00	w1 += w0

So, it seems that the opcode 0x94 (mod32) is not recognized.

I may be wrong, so do not hesitate to tell me if I am wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions