rust-lang / rust-lang/rust

on eBPF a Rust fn should handle more than 5 args

Open
#123,150 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ABI A-codegen A-LLVM C-bug O-eBPF P-low S-needs-repro T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

By default, eBPF only supports a 5-argument register calling convention. This is the only "standardized" ABI. In practice, compilers support stack-passing calling conventions for further arguments, and Rust is not required to follow a standard ABI for Rust to Rust calls. Nonetheless, because 5 args is the only standard, reputedly 5 args is what LLVM implements and the rest must be implemented by the frontend. We should be supporting argument-passing on the stack for extern "Rust" on eBPF if we're going to bother supporting bpfe{l,b}-unknown-none at all.

I'm opening this in advance of assembling a full repro before I forget it. It is possible this is no longer an issue and we only need an assembly test to verify we can handle 10 args on eBPF. h/t @saleemrashid

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by assembling the promised reproduction for an extern "Rust" function with more than five arguments on the bpfe{l,b}-unknown-none eBPF targets. Inspect the generated assembly and determine whether stack-passed arguments already work; done means either confirming support with an assembly test for ten arguments or identifying the missing frontend behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.