Skip to content

The allow-list tells a thread from a new process under clone3 #28

Closed

Description

@sodre

Parent

#22

What to build

Decide, and then build, how the worker sandbox's allow-list treats clone3.

clone3 takes its flags in a structure, which a seccomp filter cannot read. The allow-list from #22 allows it outright, because the C library starts threads with it. So a compromised grant worker can start a new process wherever clone3 exists. clone, whose flags are an argument, is already allowed for threads only.

A process started this way inherits every base layer and can signal only the original grant worker. Under the namespace sandbox it stays inside bubblewrap's process namespace. Under the filter sandbox (#23) it would outlive the supervisor's kill of the grant worker and keep the stream descriptors it inherited.

The usual answer is to return ENOSYS for clone3, as Docker's default profile does, so the C library falls back to clone. That is a call outside the allow-list that does not kill, which ADR 0001 decision 5 rules out ("A system call outside the allow-list kills the grant worker"), so it needs a new ADR that supersedes that decision for this one call. The other answer is to keep clone3 and record why a second process is acceptable.

Acceptance criteria

  • An ADR records the decision for clone3: answered with ENOSYS, or allowed with the reason a new process is acceptable
  • If ENOSYS: a confined grant worker cannot start a new process by clone3, shown by the containment test with a raw clone3 call without CLONE_THREAD, and its threads still work
  • The containment test and the runtime test pass on x86-64 and arm64

Decided in: review of #22 (Spec, round 2, finding 26; Security, rounds 1 and 2); ADR 0001
Live step at merge: none

Metadata

Metadata

Assignees

Labels

origin:reviewOpened from a code review findingtriage:ready-for-agentFully specified, ready for an AFK agent

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions