odigos-io/opentelemetry-go-instrumentation

Support for aarch64

anjuls opened this issue · 3 comments

I am trying to run on Mac M1 processor and it doesn't seem to work.

We are familiar with this issue, only amd64 is supported right now.
Supporting arm is something we plan to implement very soon, will update here once it's ready.
Thanks for opening an issue.

Hey @edeNFed, would you be able to share if there is progress being made or if there's any way to contribute towards the implementation of arm support?

Hi @noBlubb
Not yet, we are currently focused on implementing context propagation which should be finished in about 2-3 weeks.
The next item on the roadmap after that is supporting ARM.
If you would like to start working on it I'll be more than happy to assist.
Basically, the parts that I think will need to be changed for ARM support are:

  1. Registers order:
    https://github.com/keyval-dev/opentelemetry-go-instrumentation/blob/4755ac2402b24f75638eb5cd8978632ba11dea02/include/arguments.h#L8-L30
    The current order matches the x86 architecture ABI. There should be a similar method with the order of the registers that match ARM.
  2. Detection of return addresses:
    https://github.com/keyval-dev/opentelemetry-go-instrumentation/blob/eb6994ebf2f56fa8d504baee56388dc7a341a14c/pkg/process/analyze.go#L136-L143
    As you can see it uses x86asm package when parsing instructions, this should have a version that is suitable for ARM.
  3. We should probably detect the architecture in userspace (probably in injector.go by calling runtime.GOARCH) similar to what we do with is_registers_abi and inject it into the BPF program. After that, we will be able to call the ARM implementations of the previous sections by looking at the injected value, something like:
if (cpu_arch == ARM) {
   get_argument_by_reg_arm()
} else if (cpu_arch == X86) {
   get_argument_by_reg_x86()
}

Let me know if you have more questions 😄