aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-12-01 03:19:41 +0000
committerLexi Winter <ivy@FreeBSD.org>2025-12-01 03:19:41 +0000
commit2e80774d0b20d167bc0a9e2b63dafbfb171c0d22 (patch)
tree25f0138e1af8902b92dacc8cce09b267447c17db /sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go
parentf85f2b2d6e5b7ed869376eb4b180c3a74a5c5da9 (diff)
parent1a30da80670973368b399f2b01fe9c04b91a1273 (diff)
Merge remote-tracking branch 'freebsd/main' into lf/mainlf/main
Diffstat (limited to 'sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go')
-rw-r--r--sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go b/sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go
new file mode 100644
index 000000000000..5f3e7367e198
--- /dev/null
+++ b/sysutils/podman/files/patch-pkg_specgen_generate_oci__freebsd.go
@@ -0,0 +1,70 @@
+pkg/specgen/generate: Fix adding host devices on FreeBSD
+
+This was not working when emulating Linux container images on FreeBSD.
+The code to handle host devices on FreeBSD relies on the container
+having a devfs mount. Unfortunately, the Linux emulation code which adds
+this was happening after the host device handling. This changes the
+logic so that host device management happens after Linux emulation.
+
+Signed-off-by: Doug Rabson <dfr@rabson.org>
+
+--- pkg/specgen/generate/oci_freebsd.go.orig 2025-11-11 13:51:07 UTC
++++ pkg/specgen/generate/oci_freebsd.go
+@@ -50,28 +50,6 @@ func SpecGenToOCI(ctx context.Context, s *specgen.Spec
+ g.AddAnnotation(key, val)
+ }
+
+- // Devices
+- var userDevices []spec.LinuxDevice
+- if !s.IsPrivileged() {
+- // add default devices from containers.conf
+- for _, device := range rtc.Containers.Devices.Get() {
+- if err = DevicesFromPath(&g, device, rtc); err != nil {
+- return nil, err
+- }
+- }
+- if len(compatibleOptions.HostDeviceList) > 0 && len(s.Devices) == 0 {
+- userDevices = compatibleOptions.HostDeviceList
+- } else {
+- userDevices = s.Devices
+- }
+- // add default devices specified by caller
+- for _, device := range userDevices {
+- if err = DevicesFromPath(&g, device.Path, rtc); err != nil {
+- return nil, err
+- }
+- }
+- }
+-
+ g.ClearProcessEnv()
+ for name, val := range s.Env {
+ g.AddProcessEnv(name, val)
+@@ -132,6 +110,28 @@ func SpecGenToOCI(ctx context.Context, s *specgen.Spec
+ },
+ )
+ configSpec.Mounts = mounts
++ }
++
++ // Devices
++ var userDevices []spec.LinuxDevice
++ if !s.IsPrivileged() {
++ // add default devices from containers.conf
++ for _, device := range rtc.Containers.Devices.Get() {
++ if err = DevicesFromPath(&g, device, rtc); err != nil {
++ return nil, err
++ }
++ }
++ if len(compatibleOptions.HostDeviceList) > 0 && len(s.Devices) == 0 {
++ userDevices = compatibleOptions.HostDeviceList
++ } else {
++ userDevices = s.Devices
++ }
++ // add default devices specified by caller
++ for _, device := range userDevices {
++ if err = DevicesFromPath(&g, device.Path, rtc); err != nil {
++ return nil, err
++ }
++ }
+ }
+
+ // BIND MOUNTS