Skip to content

Testing ‐‐ tcrypt in Github Action (remotely)

Armando Faz edited this page Oct 19, 2023 · 1 revision

Goal: Run tcrypt in Github Actions (CI).

Intro to UML

The User Mode Linux (UML) is a compilation mode of the kernel that allows to run a Linux image just as another user program.

The strategy to run tcrypt testing suite is as follows:

  1. Compile the kernel setting ARCH=UML.
  2. Create an initramfs image, which contains an init script that is the first program Linux executes by default.
  3. Populate init with calls to modprobe tcrypt <params>. This will run test and benchmarks.
  4. Dump results to a file.

Limitations

There are, however, some limitations when using UML.

  • Since UML is activated as an ARCH type, it can only execute kernel code that is not architecture-specific. For example, AES is implemented with generic code, but with ARCH=x64 it also enables the implementation with AES-NI instructions. So, under UML we can only run modules with generic implementations.

  • Getting cycles (sec=0 or default) is not allowed. The current setup does not forward the cycle counter from "kernel" space to user space. So, we need to pass, for example sec=2, to report timings using opers/sec. This may be an advantage to run more iterations of the algorithm and get more measurement stability.

Setting up a Github Workflow

There is a workflow under .github/workflows/crypto-test-harness.yml which runs the steps mentioned above. The job activates for every new pull request targeting the cf-zeta branch.

The job runs on an Ubuntu image, and produces the output file as a Github Artifact, that can be downloaded for further examination.

In this step, we are interested more in executing the kernel tests for algorithms. The timings reported may suffer alterations as the Github runner could start/stop and reallocate CPU resources for the job. However, timings should be congruent to what is observed locally.