You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hiya @bolinfest. Thanks for the great blog post and this repository. I've found your section on annotated byte code to be quite helpful in understanding disassembled eBPF programs. I have a question about the stx instructions/two's complement 16-bit offset, and was hoping you might be able to provide some insight. For example, in https://github.com/bolinfest/rust-ebpf-demo#instruction-2 you mention mention the 0x7b or stxdw [dst+off], src, instruction which does a wide store (8 bytes) is passed an offset of -24 and is expected. Why is -24 expected in this case?
While I understand we're subtracting an offset from the frame pointer to allocate space on the stack, it's not clear to me how the offset is calculated. For example a more simple eBPF which only prints the single character a yields the following bytecode.
In this case instruction 0: 0xb7 stores imm in r0 and then instruction 1: 0x6b performs a stxh [dst+off], src (2 bytes) at an address -4 bytes relative to the stack pointer, yet our value is only 2 bytes wide.
The text was updated successfully, but these errors were encountered:
Hiya @bolinfest. Thanks for the great blog post and this repository. I've found your section on annotated byte code to be quite helpful in understanding disassembled eBPF programs. I have a question about the stx instructions/two's complement 16-bit offset, and was hoping you might be able to provide some insight. For example, in https://github.com/bolinfest/rust-ebpf-demo#instruction-2 you mention mention the
0x7b
orstxdw [dst+off], src,
instruction which does a wide store (8 bytes) is passed an offset of-24
and isexpected
. Why is-24
expected in this case?While I understand we're subtracting an offset from the frame pointer to allocate space on the stack, it's not clear to me how the offset is calculated. For example a more simple eBPF which only prints the single character
a
yields the following bytecode.In this case instruction 0:
0xb7
stores imm in r0 and then instruction 1:0x6b
performs astxh [dst+off], src
(2 bytes) at an address -4 bytes relative to the stack pointer, yet our value is only 2 bytes wide.The text was updated successfully, but these errors were encountered: