ietf-wg-bpf / ebpf-docs

eBPF Standard Documentation
40 stars 5 forks source link

Clarifying questions regarding stack pointer alignment #19

Open hawkinsw opened 1 year ago

hawkinsw commented 1 year ago

Hello! Thank you for all the work that you are doing to specify eBPF! I love the technology and think that standardization will only help it grow. @alan-jowett and I have been collaborating on adding support for local calls to the ubpf project and hit some roadblocks regarding the alignment of the stack point.

The current document seems to be silent on the topic and I wondered whether there was an opportunity for clarification:

  1. What can the eBPF program author assume about the alignment of the stack pointer when the eBPF program starts ([1])?
  2. Are there requirements for the eBPF program regarding the alignment of the stack pointer before
    • local calls
    • platform-specific/agnostic helper function calls?
  3. If so, who (the runtime or the eBPF program author) is responsible for guaranteeing that alignment?

Obviously different hardware and ABIs specify requirements on stack alignment at various points during program execution (e.g., 3.2.2 in [2] and D1.3.10 in [3]) so the response may be as simple as ... "Figure it out yourself" but I thought I would ask.

If you think that there are useful additions/changes to be made to the document, I am happy to help draft those to save you some time.

Thanks again for everything! Will

[1] https://htmlpreview.github.io/?https://raw.githubusercontent.com/ebpffoundation/ebpf-docs/pdf/draft-thaler-bpf-isa.html#section-2-5 [2] https://refspecs.linuxbase.org/elf/x86_64-abi-0.98.pdf [3] https://developer.arm.com/documentation/ddi0487/ja/?lang=en