Skip to content

Conversation

@dfr
Copy link
Contributor

@dfr dfr commented May 5, 2025

This uses FreeBSD jails to implement container isolation.

@AkihiroSuda
Copy link
Member

Cc @samuelkarp

@dfr dfr force-pushed the freebsd-spec branch from 8c7900f to e5803c8 Compare May 5, 2025 16:35
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

A few initial (high level) thoughts 👍❤️

@AkihiroSuda AkihiroSuda added this to the v1.3.0 milestone May 6, 2025
@dfr dfr force-pushed the freebsd-spec branch 2 times, most recently from 99dd807 to ee03193 Compare May 23, 2025 15:09
@dfr
Copy link
Contributor Author

dfr commented May 23, 2025

Fixed the type of FreeBSDDevice.Mode and fixed a typo in the json mapping for FreeBSDJail.SysVShm.

@dfr
Copy link
Contributor Author

dfr commented Jun 18, 2025

I took another pass over this today and made a couple of minor changes. I think the only current open question is whether the Mapping from jail(8) config file section is useful or whether it should be removed.

Does anyone else have comments or suggestions for the FreeBSD runtime extension? What should our next steps be to make this acceptable for the runtime spec?

@alice-sowerby
Copy link

@dfr we attended the developer meeting but it was Juneteenth and the attendance was relatively low. They suggested that you ping Tianon and Sam to ask for them to review it. If that doesn't work, we can try to attend the dev call again.

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

I've no specific comments on the FreeBSD part, but I can help to move this forward.

I've left an inline comment

@dfr
Copy link
Contributor Author

dfr commented Jun 20, 2025

I've no specific comments on the FreeBSD part, but I can help to move this forward.

I've left an inline comment

Thanks! I will check out your comment on the PR but my internet connection is flaky at the moment which is slowing me down a bit (hopefully that will be fixed over the weekend).

tianon
tianon previously approved these changes Jun 26, 2025
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

This looks pretty decent to me, although admittedly I'm not super familiar with FreeBSD / jails internals.

If we're not in a hurry to merge, I'd love to wait until @samuelkarp has a chance to review too, but if we've got something urgent that needs this, I think it's probably in a reasonable state (and hopefully he doesn't disagree).

@dfr dfr force-pushed the freebsd-spec branch 2 times, most recently from 051877a to bb9e6b2 Compare June 27, 2025 12:32
Copy link
Member

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

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

I've implemented this for runj in samuelkarp/runj#63, so from my perspective this now LGTM.

@AkihiroSuda
Copy link
Member

Needs rebase

@dfr
Copy link
Contributor Author

dfr commented Oct 17, 2025

Needs rebase

I will take care of that today. I also have small changes to add jail(8)'s interface pseudo-parameter and to add a few fields to the interface schema which were missing.

@dfr dfr force-pushed the freebsd-spec branch 2 times, most recently from e992b1b to 61f918b Compare October 17, 2025 12:06
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin kolyshkin requested a review from tianon October 18, 2025 22:17
@cyphar cyphar modified the milestones: v1.3.0, v1.4.0 (?) Oct 22, 2025
@AkihiroSuda
Copy link
Member

cyphar modified the milestones

@cyphar Aren't we ready to merge this in the spec v1.3.0 ? (which will correspond to runc v1.4.0)

@AkihiroSuda AkihiroSuda mentioned this pull request Oct 22, 2025
11 tasks
@cyphar
Copy link
Member

cyphar commented Oct 23, 2025

Ah okay, I was going off the discussion we had a few weeks ago, I didn't notice that we'd resolved the outstanding issues. I'm okay to merge this then.

@cyphar cyphar modified the milestones: v1.4.0, v1.3.0 Oct 23, 2025
cyphar
cyphar previously requested changes Oct 23, 2025
Comment on lines +36 to +45
* **`ip4`** _(string, OPTIONAL)_ - control the availability of IPv4 addresses.
Set to "inherit" to allow access to host (or parent container) addresses or set to "disable" to stop use of IPv4 entirely. This is typically left unset when **`vnet`** is used (see below).
* **`ip4Addr`** _(array of strings, OPTIONAL)_ - restrict the set of IPv4 addresses which the container can use. These addresses should be in numeric form (e.g. `"10.11.12.13"`). This can be used to allow restricted use of the host network. A common pattern with FreeBSD jails is to add alias addresses to a loopback interface and restrict each jail to a subset of addresses.
* **`ip6`** _(string, OPTIONAL)_ - control the availability of IPv6 addresses.
Set to "inherit" to allow access to host (or parent container) addresses or set to "disable" to stop use of IPv6 entirely. This is typically left unset when **`vnet`** is used (see below).
* **`ip6Addr`** _(array of strings, OPTIONAL)_ - restrict the set of IPv6 addresses which the container can use. These addresses should be in numeric form (e.g. `"fd10::11:12:13"`). This can be used to allow restricted use of the host network. A common pattern with FreeBSD jails is to add alias addresses to a loopback interface and restrict each jail to a subset of addresses.
* **`vnet`** _(string, OPTIONAL)_ - control the vnet used for this container.
The value can be "new" which causes a new vnet to be created for the container or "inherit" which shares the vnet for the parent container (or host if there is no parent).
* **`interface`** _(string, OPTIONAL)_ A network interface to add the container's IP addresses (**`ip4Addr`** and **`ip6Addr`**) to. An alias for each address will be added to the interface when the container is created, and will be removed from the interface after the container is stopped. This is typically used when **`vnet`** is not set.
* **`vnetInterfaces`** _(array of strings, OPTIONAL)_ - a set of network interfaces which are added to the container's vnet during its lifetime.
Copy link
Member

Choose a reason for hiding this comment

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

I get this proposal has already been implemented and so there is fairly limited scope for changes, but it feels like these should be grouped in a network object (and similarly ipv4 and ipv6 should also be objects containing the type and address):

{
  "freebsd": {
    "jail": {
      "network": {
        "ipv4": {
          "type": "new",
          "addr": "10.10.10.1"
        },
        "vnet": "new"
      }
    }
  }
}

or something similar.

Copy link
Contributor

Choose a reason for hiding this comment

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

I respectfully disagree here -- as far as I understand, the layout mirrors that of jail settings, and improving upon it (in this case by encapsulating some options under "network") is IMO not should be a goal here. Direct 1:1 is better in most cases.

Copy link
Member

Choose a reason for hiding this comment

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

The table below implies that "ip4Addr" is a sub-option of "ipv4" in the jail config, we can't really represent that in JSON (well, you can use "ip4.addr" as a key and Go does support that -- we have an example of this in image-spec -- but it can lead to issues with other tools) so I figured that having an object containing both would be closer.

But as I said, given this has already been implemented it's probably a bit too late for this discussion anyway.

Copy link
Member

Choose a reason for hiding this comment

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

As a meta point, I don't think existing PoC code should preclude making changes here, if they make sense, especially as now (before merge/release) would be the ideal time to make them if we need or want to.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The implementations are relatively simple and it won't be a lot of effort to change. I'm weakly against changing the schema but that's mostly due to a concern that we waste too much time getting consensus on a better schema.

Copy link
Member

Choose a reason for hiding this comment

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

I think the version in runj that @samuelkarp pointed to seems quite reasonable to me, and it has the benefit of already being implemented. @kolyshkin / @dfr would you be happy with that version?

If either of you have reservations, I'm okay with taking this PR as-is. Ultimately it's up to FreeBSD runtimes to deal with these configs and if you folks are fine with it then it's really not up to me whether it should be changed.

@kolyshkin kolyshkin requested a review from giuseppe October 24, 2025 01:01
This uses FreeBSD jails to implement container isolation.

Signed-off-by: Doug Rabson <[email protected]>
@cyphar cyphar dismissed their stale review October 25, 2025 15:07

Key issues resolved.

@AkihiroSuda AkihiroSuda requested a review from a team October 25, 2025 16:44
@AkihiroSuda AkihiroSuda merged commit dbf183c into opencontainers:main Oct 28, 2025
5 checks passed
@tianon
Copy link
Member

tianon commented Oct 28, 2025

... merging with open/active discussion and only two approvals on a fairly large addition seems kind of premature? 🤷

@cyphar
Copy link
Member

cyphar commented Oct 28, 2025

I was hoping to get more information about whether the runj approach was acceptable to @dfr but as I said, I don't have a strong opinion on it. I'm a bit more confused why there was a perceived rush to merge this for 1.3 (we want 1.3 for runc 1.4 -- though I also don't think this should be a hard requirement -- but the FreeBSD stuff is not really relevant for that either).

At the end of the day, I'm fine with the merged version.

@dfr
Copy link
Contributor Author

dfr commented Oct 28, 2025

Sorry, I am a little late to this part of the discussion and failed to reply before this was merged.

I have been thinking a lot on the suggested structure which splits out the ip4 and ip6 parameters into sub-objects. I don't think this adds much in readability - in particular, the way it moves the namespace parameters (e.g. vnet=new, ip4=inherit) could be confusing given that the other namespace parameters still live in the jail object.

The underlying jail parameter set has no sub-structure - its just a list of key/value pairs where some of the keys names happen to have "." characters in them, e.g. ip4.addr. This is why I had a single jail object in the runtime-spec proposal which is (mostly) a simple 1-1 mapping, renaming some keys to fit with the style of other parts of runtime-spec.

Personally, I am happy with the merged version as it represents the consensus approach for our working group and has benefitted from this review process. If there are any concerns regarding the open discussion points, perhaps this can be addressed in followup pull requests if there is time before 1.3.

@AkihiroSuda
Copy link
Member

Sorry for the rush, feel free to open follow-up issues (or PRs) for remaining concerns 🙇

@cyphar
Copy link
Member

cyphar commented Oct 28, 2025

@dfr Thanks, in that case I'm fine with just keeping it as-is.

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.