Skip to content

API musing#4

Draft
reidpr wants to merge 1 commit intodevelopfrom
api-musing
Draft

API musing#4
reidpr wants to merge 1 commit intodevelopfrom
api-musing

Conversation

@reidpr
Copy link
Copy Markdown
Collaborator

@reidpr reidpr commented Mar 27, 2026

This PR introduces the skeleton of a new wrapper command fakeroot, similar to the existing pseudo-cli but with no containerization and process management by the caller. It uses this as a vehicle to propose some API changes which would hopefully simplify things. (Honestly if this were built out well, I think it might be able to replace Debian’s fakeroot(1).)

The most significant proposed change is that the libpseudo API no longer deals with seccomp filters directly for most tasks. Instead, callers add to the config system calls they want to either fake (return 0) or emulate in user space (call a provided callback function). There is also a provision to add a filter fragment if the caller wants to add actual BPF code. libpseudo then compiles this config into a BPF program. This would eliminate the need to write BPF code manually.

The PR may also have a solution for dealing with re-parented children without races.

Caveat 1: I don’t know the existing API well, so take with a grain of salt.

Caveat 2: This only deals with the syscall phase, not any of the other callbacks.

@reidpr reidpr requested a review from elenangreen March 27, 2026 23:39
@reidpr reidpr self-assigned this Mar 27, 2026
@reidpr reidpr changed the base branch from main to develop March 27, 2026 23:42
Comment thread src/fakeroot/fakeroot.c
SPDX-License-Identifier: Apache-2.0 */

/* WARNING: At present, this file is merely Reid’s musings about APIs and is
unlikely to even compile. In porticular, lots of this belongs elsewhere in
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unlikely to even compile. In porticular, lots of this belongs elsewhere in
unlikely to even compile. In particular, lots of this belongs elsewhere in

Comment thread src/fakeroot/fakeroot.c
\n\
There are two root emulation modes (MODE above):\n\
\n\
simple Emulated system calls are intercepted and (fake) success is\n\
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
simple Emulated system calls are intercepted and (fake) success is\n\
stateless Emulated system calls are intercepted and (fake) success is\n\

Comment thread src/fakeroot/fakeroot.c
\n\
This is the “zero-consistency” root emulation described in [2].\n\
\n\
consistent Emulated system calls are interecepted FIXME.\n\
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
consistent Emulated system calls are interecepted FIXME.\n\
stateful (default) Emulated system calls are interecepted FIXME.\n\

Comment thread src/fakeroot/fakeroot.c
that the program tried to set with chown(2). That is, the\n\
calling process sees a fake but consistent owner for the file.\n\
\n\
If not specified, MODE is consistent.\n\
Copy link
Copy Markdown
Collaborator

@j-ogas j-ogas Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If not specified, MODE is consistent.\n\
If not specified, MODE is stateful.\n\

Copy link
Copy Markdown
Collaborator

@j-ogas j-ogas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial suggestion proposes changing "simple" vs "consistent" to state{full,less}, which are is more explicit. Note that {in,}consistent may also work but they are, IMO, visually similar enough to be overlooked frequently(?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants