Trying to build Pegasus on arm64 (Raspberry Pi 3B):
In compile_ctools, I get
[exec] gcc -Wall -O2 -ggdb -std=gnu99 -DLINUX procinfo.c -c -o procinfo.o
[exec] procinfo.c: In function 'procParentTrace':
[exec] procinfo.c:400:28: error: 'PTRACE_GETREGS' undeclared (first use in this function)
[exec] if (ptrace(PTRACE_GETREGS, cpid, NULL, ®s)) {
[exec] ^~~~~~~~~~~~~~
[exec] procinfo.c:400:28: note: each undeclared identifier is reported only once for each function it appears in
[exec] In file included from procinfo.c:33:0:
[exec] syscall.h:29:24: error: 'struct user_regs_struct' has no member named 'rax'
[exec] #define SC_RVAL(r) r.rax
[exec] ^
[exec] procinfo.c:406:38: note: in expansion of macro 'SC_RVAL'
[exec] child->sc_rval = SC_RVAL(regs);
[exec] ^~~~~~~
https://www.edn.com/design/systems-design/4440662/ARM64-vs-ARM32-What-s-different-for-Linux-programmers
provides the information that PTRACE_GETREGS, for arm64, must be emulated
by using PTRACE_GETREGSET:
"
Using GETREGSET is not as simple as using GETREGS, though. For a GETREGS request like this:
ptrace(PTRACE_GETREGS, 0, 0, regs);
GETREGSET would look like this:
struct
my_iovec =
{ regs, sizeof(*regs)};
ptrace(PTRACE_GETREGSET, 0, (void*) NT_PRSTATUS, &my_iovec);
Note, too, that I have said “the closest equivalent GETREGSET request.” Naturally, the AArch64 register set is different from the ARM 32-bit one, but there are more differences between the two beyond the register set.
"
Obviously, your code dives deep into the dark regions, and was perhaps
only written with X86 in mind...
> The background is that we're investigating into processors different
> from X86_64, and part of this investigagtion if to find whether our
> software stack would be available, of course. We might be pioneering
> in the community that uses Pegasus... and willing to accept this
> challenge (but may need help from developers).
... which is completely understandable, with the computing world
consisting of 99% X86, on one hand, but a serious show-stopper on the
other hand for people who want to make use of the remaining 1%.
Is the code really necessary, and would we lose important information
if procinfo would provide less insight?