Uploaded image for project: 'Pegasus'
  1. Pegasus
  2. PM-1275

kickstart build fails on arm64

XMLWordPrintable

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major Major
    • 4.9.0, 4.8.3
    • Affects Version/s: 4.9.0, 4.8.2
    • Component/s: None
    • None

      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, &regs)) {
      [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

      { void* buf; size_t len; }

      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?

            Assignee:
            rynge Mats Rynge
            Reporter:
            rynge Mats Rynge
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: