Skip to content

Isolation

When you start an app with appjail run, it does not run as an ordinary process of your session. appjail builds a jail around it: a set of restrictions that the Linux kernel enforces on the app and on every process it starts. This part explains what the jail is made of, layer by layer, and why each layer is there.

The same construction, with less inside it, also holds the steps that come before an app ever runs: the download, the extraction of the AppImage, the verification of an attestation, the conversion of an icon. Those are the helper jails; the jail the app itself runs in is the app jail.

The layers

The layers of the app jail The app runs inside its own namespaces, which show it a read-only system, its tree, a private home and a window. Around them, seccomp and Landlock restrict what the kernel does for it. Grants are the only openings, each through a narrow channel. Kernel restrictions no capabilities · seccomp filter · Landlock scope · no nested namespaces Namespaces (bubblewrap) own mounts, processes, users, hostname, IPC, cgroup and network /usr, /lib, … host system, read-only /app the extracted AppImage, read-only /home/app private home, kept between runs /tmp, /run, /dev empty or minimal, private The app and every process it starts a generated /etc/passwd, a cleared environment, a Wayland socket that offers no privileged interface Grants each through its own channel folders and files network (pasta) D-Bus (filtering proxy) portals audio (private graph) GPU, camera more of the display
The app jail. The grants on the right exist only when the manifest asks for them.

Read from the inside out:

  1. Namespaces give the app its own view of the system: its own mount table, process list, user ids, hostname, inter-process communication and network. What it does not see, it cannot reach by name.
  2. bubblewrap is the program that creates those namespaces without root and fills the new mount table with exactly what the app should see.
  3. The filesystem view is what appjail asks bubblewrap to put there: the read-only system, the app's own tree, a private home, and the folders and files you grant.
  4. seccomp limits which requests the app may make to the kernel at all, because a namespace hides things but every system call still reaches the same kernel.
  5. Landlock closes one gap the namespaces leave open in one configuration: sockets that live in the network namespace rather than in the filesystem.
  6. Process lifetime makes sure the jail ends when the app ends, and that nothing of it keeps running when appjail is stopped.

Why several layers

A namespace decides what a process can see; it does not change what the kernel will do for it. A process that sees nothing can still ask the kernel for a new namespace, load a filter, open a socket of an obscure family or call into a subsystem with a history of privilege-escalation bugs. Each of those requests reaches the same kernel that runs the rest of your session. That is why the namespaces are combined with the removal of every capability, a seccomp filter on system calls, the refusal of nested namespaces, and Landlock: each closes a way around the others.

None of the layers is new. Flatpak builds its sandbox from the same parts, and appjail follows its choices where they apply (the seccomp deny list, the allowed socket families). What differs is what goes in: appjail starts with less (no session bus, no sound, no network, no GPU by default) and checks the openings it makes more closely, because it has to assume that what runs inside was never reviewed by anyone.

Helper jails

The helper jails are built from the same parts, with even less inside:

Helper jail Sees Network
download (also catalogs and pinned tools) the read-only system, /etc/ssl, the downloader, one staging directory a private namespace made by pasta; without pasta the step is refused, unless APPJAIL_ALLOW_HOST_NETWORK=1 gives it the host's, with a warning
attestation check the downloaded file, the attestation bundles, a scratch directory, the pinned gh as the download
extraction the AppImage (read-only) and one work directory none
manifest history (git) appjail's configuration directory none
icon conversion the SVG and an output directory none
D-Bus proxy your session bus socket and a private directory for the filtered one none
private audio graph its own runtime directory and your audio server's socket none

Each helper jail also refuses nested namespaces and loads the same seccomp filter as the app jail, because some of them run code taken from the AppImage (the extraction fallback runs the AppImage's own runtime) and all of them parse untrusted data.

References