[CRIU] CRIU support for ARM

Alexander Kartashov alekskartashov at parallels.com
Tue Jan 22 03:51:16 EST 2013


Dear colleagues,

This patchset introduces support for the ARM architecture
into the CRIU suite.

There's the list of obstacles I had to overcome to implement
the CRIU support for ARM --- I regret I failed to write this
as a reply to Cyrill's email over a month ago:

* ARM requires dumping/restoring TLS so TLS-related routines
  are added to the parasite, restorer, parasite-syscall.c,
  and cr-restore.c.

* The ARM syscall blob does almost the same as its x86 counterpart:
  it consists of 2 instructions: SVC #0 and UDF #32. The instruction
  UDF #32 is used as a breakpoint in ARM EABI and generates the value
  TRAP_BPKT instead of SI_KERNEL of the field siginfo_t::si_code
  so the macro ARCH_SI_TRAP is used.

* The ARM parasite head is almost the the same as its x86 counterpart
  except it positions the label __export_parasite_stack so that
  the offset can be calculated using a single assembly instruction.

* ARM doesn't support integer division natively so libc implements
  the support for division. Since PIE's can't be linked against libc
  the source (uidiv.S) is extracted from the library and linked
  with parasite and restorer.

* The ARM userspace and syscall calling conventions don't match
  unlike x86: userspace passes only 4 arguments to a function
  via registers --- the rest arguments are passed via stack;
  all syscall parameters are passed via registers so we have
  to use an assembly glue to convert the userspace function
  calling convention to the syscall conventinon while
  doing a syscall. The macros syscall0, syscall5, and syscall6
  are present in the file arch/arm/syscall-common.S for this reason.

* The syscall sys_mmap() isn't implemented in the 32-bit ARM ABI
  so it must be implemented manually. A special notation is introduced
  into the syscall description table to mark such a syscall.

* Some syscalls are ARM-specific and their numbers (eg, sys_set_tls())
  can't be represented in a single ARM instruction so the syscall thunks
  can't be generated automatically in a simple way.

* The ARM syscall table contains syscall numbers for both 32- and
  64-bit ABI so to simplify its parsing and code generation
  the generation script is written in Perl.

* The syscall sys_kcmp() is available only in the x86 kernel.
  Although its number have already been reserved my patch enabling
  it on ARM hasn't been merged to the mainstream nor commented on.

* ARM has an executable VMA mapped above the userspace code
  (something like the VDSO on x86) that can't be dumped nor infected so
  crtools was modified to dump pages only below the TASK_SIZE boundary.

* ARM doesn't employ stack to store a return address so the sigreturn
  frame offset shouldn't take into account the space for storing this
  address.


Known issues:

* The following tests fail for an unknown reason:
  - static/cow01,
  - static/file_fown,
  - static/ipc_namespace,
  - static/shm,
  - transition/ipc.

* The following tests fail because test skipping doesn't work
  properly: if a test is skipped it is reported as failed:
  - static/fpu00,
  - static/fpu01,
  - static/mmx00,
  - static/sse00,
  - static/sse20.
  Moreover, ARM versions of the tests are not yet implemented.

--
Sincerely yours,
Alexander Kartashov



More information about the CRIU mailing list