Commit Graph
318 Commits
Author SHA1 Message Date
J Logan 6d548a0e49 Match Mount default cache/sync to container defaults. (#446)
- Use `cache=auto`, `sync=fsync` as default everywhere.
2025-12-11 19:47:02 -03:00
Danny Canter 7962dae643 Add capabilities support (#444)
Closes https://github.com/apple/containerization/issues/442

This adds capabilities support to LinuxContainer via a new surface in
ContainerizationOS + some C wrappers.
2025-12-11 15:07:17 -05:00
Dmitry Kovba 96d37e2e21 Fix multi-sentence error messages (#443)
Fixes multi-sentence error messages, where they start from a lowercased
letter.
2025-12-09 12:32:09 -08:00
Danny Canter e8aff29be3 Cgroup2Manager: Fix cgroup deletions (#439)
If there's any nested cgroups in the one we made for the container
(commonly seen for systemd images) removeItem didn't seem to be having a
grand time, even though it states it should do recursive removals. Lets
roll our own, and have a small EBUSY/EAGAIN retry loop as well. This
fixes LinuxContainer.stop() for any containers with nested cgs.

Context: https://github.com/apple/container/issues/928
2025-12-09 14:47:38 -03:00
Dmitry Kovba bb0cd39177 Lowercase error messages (#440)
For consistency, all error messages are lowercased.
2025-12-09 05:38:48 -08:00
Kathryn Baldauf d473f89ccb Rename CONTRIBUTORS to MAINTAINERS and update list to current state (#435)
We'd like a way for people to know who they can ping for help on PRs and
issues, but we want to avoid being automatically assigned to PRs via
something like CODEOWNERS. Instead, we've opted to list the maintainers
of the project in a new MAINTAINERS file.

We opted to change from CONTRIBUTORS to MAINTAINERS since we believe
that contributors are already acknowledged via the `Contributors` tab on
GitHub and in the release notes we make for each new release.

In the future, the MAINTAINERS file can be extended to include
additional maintainers and past maintainers can continue to be
recognized for their work.
2025-12-06 17:54:17 -08:00
Danny Canter d0b43df9b5 EXT4: Remove advertising inline data (#438) 2025-12-06 13:45:36 -08:00
Danny Canter 2d27ef6deb LinuxPod: Wire up pid namespace sharing (#434)
In a prior change I'd added a way for vminitd to double as a simple
pause container. This change wires this up by adding a new bool to the
pod config to ask for pid ns sharing.
2025-12-05 10:42:50 -05:00
Danny Canter c45fef7278 Vminitd: Add pause command (#418)
Due to us supporting a pod type now, and pid ns sharing being quite a
common thing for pods, lets add a pause container like command to
vminitd to eventually enable pid ns sharing between containers in our
variant of a pod.

This changes vminitd slightly to have pause and init (default) commands
as it seemed simpler than creating a whole new binary to include in the
guest image.
2025-12-02 15:52:32 -05:00
Danny Canter 5c190dc4a8 Integration: multipleConcurrentProcesses adjustments (#424)
Remove the prints (To me they're just noise) and stop SIGKILL'ing
the init process and just stop the container.
2025-12-02 10:59:13 -05:00
Danny Canter 1254352d68 vminitd: Turn ProcessSupervisor into a class (#433)
Really no reason for this to be an actor, and we're seeing runtime
errors seemingly because of it.
2025-12-02 10:43:14 -05:00
Danny Canter 27947cda9c VirtualMachineInstance: Remove stopListen (#412) 2025-12-01 09:40:20 -08:00
Danny Canter 0e8a779f03 README: Adjust required version numbers (#432)
macOS and Xcode 26 are both released now, no need to still list beta.
2025-12-01 11:15:39 -05:00
GAUTAM RAJU 031cd72e2a Implement pdeathSignal handling in Runc (#431)
Add support for parent death signal (pdeathSignal) to ensure child
processes receive a signal when the parent process dies. This addresses
the FIXME comment in Runc.execute().

## Changes
- Add pdeathSignal field to exec_command_attrs C struct
- Implement prctl(PR_SET_PDEATHSIG) in child process handler (Linux
only)
- Expose pdeathSignal through Command.Attrs Swift API
- Wire up pdeathSignal in Runc.execute() to remove FIXME

## Implementation Details
The implementation uses Linux-specific prctl() to set the parent death
signal, ensuring proper cleanup when parent processes terminate. The
feature is conditionally compiled for Linux only, maintaining
compatibility with other platforms.
2025-12-01 02:35:09 -08:00
Danny Canter 4a8f945f87 vminitd: Add memory threshold monitoring (#427)
Add a small bit of logic to monitor if vminitd goes over a (somewhat
arbitrary) memory threshold. On average, when running one container it
seems to hover around 25MiB, so this is mostly to catch cases where it's
exceeding a limit we don't deem normal.
2025-11-21 14:54:13 -08:00
Raj 35ebe365ba Add calculateOrphanedBlobsSize() to calculate the size of orphaned blobs (#428)
Adds `calculateOrphanedBlobsSize()` to calculate the size of orphaned
blobs, will need this to include them under size and reclaimable space
for images in the `container system df` command so it matches up with
what `container image prune` frees up on disk.
2025-11-21 14:50:28 -08:00
Danny Canter 836b699a91 Wire up experimental OCI runtime support (#416) 2025-11-21 12:16:58 -08:00
Raj 860139bd1a Fix ImageStore.prune() behavior to actually remove images (#420)
- Fixes #417.

Rename `_prune()` to `cleanupOrphanedBlobs()` to clarify what it
actually does, and remove `prune()` method as we'll do all that logic in
container directly.
2025-11-20 15:22:54 -08:00
Danny Canter 14f56e4a53 Scripts: Add a script to find kernel panics (#422)
Adds a simple script to find kernel panics in the integration serial
console logs. We're tracking down one related to Swift's Mutex.
2025-11-20 12:02:57 -08:00
Danny Canter 79d7e398c1 vminitd client: Remove connection backoff (#423)
For the constructor we're using where we pass an already connected
socket, I'm not sure this even does anything, and if it does that's a
bug I'd rather just avoid altogether.

Also gets rid of the unused constructor we have to pass in a UDS.
2025-11-20 12:00:56 -08:00
RahulThennarasu f31d2005b5 ManagedProcess: Capture vmexec stderr and convert to Containerization Error (#411)
Fixes #277

When vmexec fails, it logs to stderr and exits with code 1. Previously,
the error details were lost. This change captures stderr and converts it
into a proper ContainerizationError.

Signed-off-by: Rahul Thennarasu <rahulthennarasu07@gmail.com>
2025-11-19 23:56:09 -08:00
Kathryn Baldauf 86f5051fe6 Fix compiler errors in socket types when building with glibc (#421)
* on glibc, swift expects that the msg_controllen is type Int
* on glibc, socket shutdown options should be an Int32

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-11-19 17:36:38 -08:00
Danny Canter 747ea996c8 vminitd: sync(2) in server error path (#413) 2025-11-17 10:38:10 -08:00
Danny Canter 85a3544750 LinuxContainer: "Harden" stop (#388) 2025-11-16 14:13:41 -08:00
RahulThennarasu 4d47c58a3d Fix: Allow OCI archives without manifest annotations (#397)
Fixes #369

Per the OCI Image Spec, manifest descriptor annotations are optional.
Previously, archives without annotations would fail to import with
"Failed to import image".

**Changes:**
- Modified `getImageReferencefromDescriptor` to return digest-based
references (`untagged@sha256:...`) when annotations are missing
- Removed guard that skipped manifests without annotations
- Added test case with `scratch_no_annotations.tar`

**Testing:**
All 167 tests pass, including new test for images without annotations.
2025-11-15 00:32:15 -03:00
Danny Canter 4c761d50c6 Add new FileHandle option for serial console output (#410)
Taking in a filehandle gives the user quite a bit more freedom on how to
handle boot log output. They can set up a kqueue watch on it and
redirect output somewhere else etc etc. The implementation for this has
us take in a new BootLog type that has two options:

1. .file, which is analogous to what we had prior. Just provide a URL
and a true by default append field.
2. .fileHandle which is the new addition. Can pass any fd that is
writable, and the VMM should write serial console output to it.
2025-11-14 10:40:32 -08:00
Danny Canter b501931267 Integration: Actually run testContainerStopIdempotency (#409)
We (I) forgot to add it :)
2025-11-13 14:37:42 -08:00
Danny Canter c8549315ed LinuxContainer: Keep reference to vended execs (#408)
This change is aimed at making forgetting to call .delete() on a
LinuxProcess less destructive than it can be. Because Virt.framework
invalidates any vsock fds it vended if the vm is stopped, trying to
perform some operations on the grpc client through any of the process
methods could trigger an ebadf, which NIO asserts on. This keeps a
reference to the execs and deletes all of them for you once the
container dies. I still think leaving .delete a public method is useful
as otherwise the stdio fds are left open, but cleanup should occur all
in one place now if you don't care about this.

This additionally:

1. Fixes two of our tests that forgot to delete() an exec.
2. Adds two new tests to verify that process.delete() is now idempotent,
and we don't need to call delete().
2025-11-13 02:13:09 -08:00
Danny Canter 322a724024 VZVirtualMachineInstance: Remove tracking agent conns (#403)
This was added to try and see if it alleviated the infrequent ebadf nio
panics, but they still occur, so back to the drawing board :)
2025-11-12 14:37:04 -08:00
Ihor Dvoretskyi 6b8fe3b43f Update example documentation (#406)
- Added README.md for examples directory to provide an overview and
instructions.
- Updated ctr-example README.md with clearer build and run instructions.
- Improved lab.md with a dynamic command to fetch the latest kernel.

Signed-off-by: Ihor Dvoretskyi <ihor@linux.com>
2025-11-12 14:30:01 -08:00
Raj 3ef0002a46 docs: add guidelines for AI contributions (#407)
Adds AI Contribution guidelines to `CONTRIBUTING.md`.
2025-11-12 14:09:24 -08:00
Dmitry Kovba b94be374ae Set the default PATH and fix the bug in retrieving the PATH value (#383)
- We're already setting the default `HOME` and `TERM`. Setting the
default `PATH` as well seems reasonable.
- This PR also fixes the bug in retrieving the `PATH` value (`PATH=` has
to be removed, and `=` should be allowed in folder names).
2025-11-12 15:48:02 -03:00
J Logan 6bf00ad796 Make socket proxy logging less chatty. (#405)
- Move data transfers to trace level.
- Move shutdown errors to warning.
- Only log listen, connect, and cleanup at info.
2025-11-12 09:45:30 -08:00
Danny Canter 01437a44a2 Vminitd: Sync(2) on shutdown (#400) 2025-11-12 09:39:46 -08:00
Danny Canter bbe9ebd8fa TimeSyncer: Amend some bits (#404) 2025-11-12 09:39:26 -08:00
Danny Canter a31abd73a4 Vminitd: Remove unused method (#401) 2025-11-12 09:39:00 -08:00
Danny Canter 8a9b0deb82 LinuxProcess: Swap from logging in delete (#386)
This changes LinuxProcess to not just log errors but return them.
2025-11-11 14:42:41 -08:00
Danny Canter cfe4fd77cb Socket: Return Int32 and not FileHandle for uds receives (#398)
Gives more flexibility. The caller doesn't need to carry around this
FileHandle object if they don't really need it.
2025-11-10 15:48:06 -08:00
Kathryn Baldauf 055b697037 Update the cp kernel command to not use quotes (#396)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-11-10 14:07:13 -05:00
Kathryn Baldauf 0061af6d81 Update ctr-example (#395)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-11-10 12:11:56 -05:00
Eric Ernst 13e6de0169 Update lab.md (#393) 2025-11-10 11:25:39 -05:00
Eric Ernst 6f2eb093aa Create lab.md (#392) 2025-11-10 10:31:43 -05:00
Aditya Ramani 2e93381de3 Pull initfs from repository when running ctr-example (#391)
Use the initial filesystem image from a remote repository when brining
up the ctr-example
2025-11-09 20:54:59 -08:00
Kathryn Baldauf 2c4c044060 Update ctr-example to 0.13.0 and clean readme (#390)
Update containerization dependency in ctr-example to the latest tag of
containerization. Additionally make README for ctr-example more clear.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-11-09 13:50:00 -08:00
AJ Emory b512617dc4 Updating ctr-example to make setup easier (#389)
- Example Makefile now supports fetch-default-kernel for easier setup
- added 'make all' to build Containerization and ctr-example in one step
- Updated README to add build and run instructions
2025-11-07 18:18:26 -08:00
Danny Canter 4855310dca OCI: Don't umount the rootfs path if it's not a mountpoint (#387)
Given this package is generic, and we use it in the guest where today we
actually umount via an rpc, just skip this if it's not a mountpoint.
2025-11-07 14:25:34 -08:00
Danny Canter 3de29338e1 Integration: Add stdio ingest test (#385)
Add a test to ingest 200MiB of data across stdout/stderr. Useful to test
how fast we can ingest stdio. The timing will always be a tad off as it
times between start and wait returning, and there's quite a lot in the
way.. but it's a good enough metric.
2025-11-07 11:08:01 -08:00
Danny Canter 619354ef74 Don't ignore possible errors from dup(2) (#382)
Everytime we grab a vsock connection we dup the conn and close the
original, otherwise we'd need to carry around the vsock connection type
everywhere as it closes the fd in its destructor. We weren't checking
the return value of dup however, so if it did fail we'd have a useless
filehandle with an fd of -1.
2025-11-06 15:48:02 -08:00
Raj 52ed5b542c Revert "Add filesystem notification (FSNotify) support" (#384)
Reverts apple/containerization#294. This is causing the CI to break
because of concurrency issues with tests. Let's revert while we
investigate.
2025-11-05 15:06:24 -08:00
Raj 80e84a9ce1 Add filesystem notification (FSNotify) support (#294)
Addresses apple/container#141, where containers don't receive filesystem
events on mounted volumes, preventing incremental rebuilds and other
file-watching features. This PR implements the guest-side components for
FSNotify. Host-side implementation in the container repo will complete
the pipeline.

Summary:
- Add gRPC protocol definitions for filesystem event notifications
- Implement guest-side event handler that generates Linux inotify events
- Add CLI testing tool (`cctl fsnotify`) and integration test
infrastructure
2025-11-05 12:20:15 -08:00