summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-06-11unschroot: add a pid 1 that reaps zombiesHelmut Grohne
While sbuild --chroot-mode=unshare opted for installing dumb-init, we'll keep the environment minimal and have a dumb-init written in perl-base, which happens to be essential still. Unfortunately, we cannot wait for our target process from our main process as the target process is a child of our perl init. Therefore our perl init must forward the exit code.
2024-06-11unschroot: synchronize reparentingHelmut Grohne
Before this change, it could happen that we'd call prctl_set_child_subreaper before our parent actually died. Thus we'd quickly get the death signal. The additional synchronization point ensures that our previous parent process has been waited for (and thus we are reparented) before installing the death signal.
2024-06-11unschroot: report "Type unshare" for our sessionsHelmut Grohne
Any existing type would be an invalid promise. While sbuild parses the type, it also currently throws its value away and does not base any decisions on it. With the new value, it could recognize unschroot and opt into new features.
2024-06-11unschroot: tweak --info outputHelmut Grohne
* Tag sessions as "Session Purged". This causes sbuild to skip uninstalling build-depends and other cleanup. * Always emit "Aliases" even when empty as we get a warning from sbuild otherwise.
2024-06-11unschroot: fix internal option conflictHelmut Grohne
Fixes: a1cc59818088 ("add example "unschroot.py"")
2024-06-08add example "unschroot.py"Helmut Grohne
While this mostly provides the schroot API and adds its own semantics around ~/.cache/unschroot, please do not consider examples a stable interface but a room for experimentation and incompatible changes.
2024-05-28tests/test_simple.py: support coverage generationHelmut Grohne
Two tests were failing pytest --cov, because they would sandbox themselves in a way that writing the coverage db would be impossible. Change them such that they retain access to the coverage database.
2024-05-28support sendfile in async_copyfdHelmut Grohne
2024-05-27add IDAllocation.reserve methodHelmut Grohne
Allow reserving a particular range instead of allocating a suitable large range of an IDAllocation. This is useful when a directory hierarchy defines the allocation and we merely want to verify it to be assigned.
2024-05-25examples/chrootfuse.py: fix file descriptor leakHelmut Grohne
Fixes: f01c7690de8e ("add example chrootfuse2fs.py")
2024-05-25add a FileDescriptor typeHelmut Grohne
It serves two main purposes. For one thing, it allows telling bare integers and file descriptors apart on a typing level similar to a NewType. For another it adds common methods to a file descriptor and enables closing it via a context manager.
2024-05-20add an asyncio waitid(P_PIDFD, ...) helperHelmut Grohne
2024-05-20test splice path of async_copyfdHelmut Grohne
2024-05-20add function async_copyfdHelmut Grohne
It is a bit like an async version of shutil.copyfileobj but for bare file descriptors and has an optimized version for pipes.
2024-05-20Revert "add a splice syscall wrapper"Helmut Grohne
os.splice from Python >= 3.10 is good enough. This reverts commit 056c1f964f55adedc17f8d7bddef1f48c73852c7.
2024-05-20syscalls: use >= 3.10 support for eventfds in os moduleHelmut Grohne
2024-05-18examples/netnsslirp.py: simplify termination of slirp4netnsHelmut Grohne
2024-05-17add a splice syscall wrapperHelmut Grohne
2024-05-17add prctl_set_child_subreaperHelmut Grohne
2024-05-17populate_dev: also create std{in,out,err} symlinksHelmut Grohne
When booting systemd, it'll create these symlinks, but when doing an application container, nothing does this and we risk creating regular files there.
2024-05-10Revert "examples/chroottar.py: harden against tars with high uids"Helmut Grohne
This reverts commit a169f51420795a212c3226f455e783ab8ac5cf47. We really deal with two user namespaces. The initial/parent process maps the target id range plus the current user id. The child process that executes the workload only maps the target id range without the current user id. The child opens the tar file while it still is in the initial namespace, then unshares and once it only has the subid range mapped, it performs the extraction. No clamping is necessary at this point. The parent process maps additionally maps the current id in order to write the tar file.
2024-05-09add linuxnamespaces.tarinfo.XAttrTarFileHelmut Grohne
This is a mixin subclass for TarFile that enables it to restore and apply linux extended attributes as PAX headers in the SCHILY.xattr.* format. As a consequence, this enables us to process tar archives containing file system capabilities.
2024-05-09add linuxnamespaces.tarutilsHelmut Grohne
Move the generic tar utilities from the chroottar.py example into a linuxnamespaces module as dealing with tar archives is a fairly common thing when dealing with namespaces.
2024-05-07mount: allow data argument to be a listHelmut Grohne
2024-05-06chroottar.py: don't raise NotImplementedError for misuseHelmut Grohne
The mode actually can only have these three distinct literals. While more complex modes can get passed to TarFile.open, they're decomposed there and only of these three is passed to the compressor openers.
2024-05-06syscalls: allow logging of syscallsHelmut Grohne
2024-05-06chroottar.py: implement Tarfile.zstopen for fileobjHelmut Grohne
zstandard.open actually consumes file objects. Hence there is little benefit in not implementing the passing of a fileobj even though we don't use it here.
2024-05-06examples/cgroup.py: use the assigned cgroupHelmut Grohne
Fixes: b0874c6086f1 ("lift the dbus functionality from the cgroup example")
2024-04-23lift the dbus functionality from the cgroup exampleHelmut Grohne
2024-04-19examples/cgroup.py: support jeepney as an alternative to ravelHelmut Grohne
2024-04-19examples/cgroup.py: use asyncio.runHelmut Grohne
2024-04-19examples/cgroup.py: do not fail when ravel is unavailableHelmut Grohne
2024-04-18examples/cgroup.py: we should pass Delegate=trueHelmut Grohne
2024-04-18examples/cgroup.py: extract a context manager waiting for systemd jobsHelmut Grohne
2024-04-04avoid hard coding the soname of the libcHelmut Grohne
Passing None as name also yields libc functions.
2024-04-04add method AtLocation.as_emptypath for cloning a locationHelmut Grohne
2024-04-04add an example for unsharing a PID namespaceHelmut Grohne
2024-04-04add syscall wrapper for prctl(PR_SET_PDEATHSIG, ...)Helmut Grohne
2024-04-04add function populate_procHelmut Grohne
2024-04-04document security implications of populate_* functionsHelmut Grohne
2024-04-03declare pytest-forked dependency that is in use alreadyHelmut Grohne
2024-04-03tests: avoid need for a type annotationHelmut Grohne
mypy wants type annotations for every def. As we only call another function, we may pass it to the decorator directly and shut up mypy.
2024-04-03add basic tests for AtLocationHelmut Grohne
2024-04-03AtLocation.walk: add support for AT_EMPTY_PATHHelmut Grohne
2024-04-03AtLocation.walk: emit nofllow flag when follow_symlinks=FalseHelmut Grohne
2024-04-03AtLocation.readlink: require AT_SYMLINK_NOFOLLOWHelmut Grohne
It does not make sense to read a link after having followed it.
2024-04-02improve AtLocation.join semanticsHelmut Grohne
Also allow joining an AtLocation. When doing that note that any kind of absolute location object (absolute path without fd and any location with an fd) results in just that latter location just like os.path.join returns the latter path when it is absolute. Fixes: 034f732a1af4 ("initial checkin")
2024-04-02a few formatting and typo fixesHelmut Grohne
2024-04-02add documentation regarding resource management of AtLocationsHelmut Grohne
2024-04-02fix logic error in AtLocation.statHelmut Grohne
Fixes: 1c265b6e11c3 ("add os.stat wrapper AtLocation.stat")