[Question] How to read values in floating point registers from bpf

Grant Seltzer Richman grantseltzer at gmail.com
Fri Mar 3 10:59:35 PST 2023


Hi everyone, this is my first time posting on this list, and I'm brand
new to arm, so I apologize if my question is out of scope.

I'm looking to read the contents of floating point registers on arm64
(linux vm on m1 apple silicon) from a bpf program. The bpf program has
access to the `pt_regs` and `task_struct` for the attached process.
The program is triggered via uprobe, and is attached to the function
entry of a function which takes a single float64 parameter.

I see via disassembly that the routine accesses the parameter from D0,
but I can't seem to access the D set of registers. Nor the S registers
for 32 bit. The X registers seem to be what are loaded in the
`pt_regs` struct.

I see that ptrace has an option for getting floating point registers,
so I'm wondering if given the task_struct or pt_regs I should be able
to get these values from bpf?

Thanks so much in advance for any information you can provide!

Cheers,
Grant Seltzer



More information about the linux-arm-kernel mailing list