Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2024 14:06:26 GMT
From:      Doug Rabson <dfr@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 099c6a40f8e9 - main - sysutils/podman: fix nil pointer dereference in 'podman build'
Message-ID:  <202408201406.47KE6Q3o091505@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dfr:

URL: https://cgit.FreeBSD.org/ports/commit/?id=099c6a40f8e9ec305e7725f4ddd85fe9311f51f3

commit 099c6a40f8e9ec305e7725f4ddd85fe9311f51f3
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2024-08-20 10:08:26 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2024-08-20 14:06:04 +0000

    sysutils/podman: fix nil pointer dereference in 'podman build'
    
    This copies over fixes for a similar problem in Buildah - Podman shares
    Buildah code to implement 'podman build'.
---
 sysutils/podman/Makefile                           |  2 +-
 ...or_github.com_containers_buildah_run__common.go | 30 ++++++++++++++++++++++
 ...r_github.com_containers_buildah_run__freebsd.go | 11 ++++++++
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/sysutils/podman/Makefile b/sysutils/podman/Makefile
index fcc8c3511beb..65008f4cac74 100644
--- a/sysutils/podman/Makefile
+++ b/sysutils/podman/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	podman
 DISTVERSIONPREFIX=	v
 DISTVERSION=	5.1.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	sysutils
 
 MAINTAINER=	dfr@FreeBSD.org
diff --git a/sysutils/podman/files/patch-vendor_github.com_containers_buildah_run__common.go b/sysutils/podman/files/patch-vendor_github.com_containers_buildah_run__common.go
new file mode 100644
index 000000000000..869f92f72b7e
--- /dev/null
+++ b/sysutils/podman/files/patch-vendor_github.com_containers_buildah_run__common.go
@@ -0,0 +1,30 @@
+--- vendor/github.com/containers/buildah/run_common.go.orig	2024-08-20 09:45:05 UTC
++++ vendor/github.com/containers/buildah/run_common.go
+@@ -83,12 +83,17 @@ func (b *Builder) addResolvConfEntries(file string, ne
+ 
+ // addResolvConf copies files from host and sets them up to bind mount into container
+ func (b *Builder) addResolvConfEntries(file string, networkNameServer []string,
+-	namespaces []specs.LinuxNamespace, keepHostServers, ipv6 bool) error {
++	spec *specs.Spec, keepHostServers, ipv6 bool) error {
+ 	defaultConfig, err := config.Default()
+ 	if err != nil {
+ 		return fmt.Errorf("failed to get config: %w", err)
+ 	}
+ 
++	var namespaces []specs.LinuxNamespace
++	if spec.Linux != nil {
++		namespaces = spec.Linux.Namespaces
++	}
++
+ 	dnsServers, dnsSearch, dnsOptions := b.CommonBuildOpts.DNSServers, b.CommonBuildOpts.DNSSearch, b.CommonBuildOpts.DNSOptions
+ 	nameservers := make([]string, 0, len(defaultConfig.Containers.DNSServers.Get())+len(dnsServers))
+ 	nameservers = append(nameservers, defaultConfig.Containers.DNSServers.Get()...)
+@@ -1253,7 +1258,7 @@ func (b *Builder) runUsingRuntimeSubproc(isolation def
+ 			}
+ 
+ 			if resolvFile != "" {
+-				err = b.addResolvConfEntries(resolvFile, netResult.dnsServers, spec.Linux.Namespaces, netResult.keepHostResolvers, netResult.ipv6)
++				err = b.addResolvConfEntries(resolvFile, netResult.dnsServers, spec, netResult.keepHostResolvers, netResult.ipv6)
+ 				if err != nil {
+ 					return err
+ 				}
diff --git a/sysutils/podman/files/patch-vendor_github.com_containers_buildah_run__freebsd.go b/sysutils/podman/files/patch-vendor_github.com_containers_buildah_run__freebsd.go
new file mode 100644
index 000000000000..af15e04c5336
--- /dev/null
+++ b/sysutils/podman/files/patch-vendor_github.com_containers_buildah_run__freebsd.go
@@ -0,0 +1,11 @@
+--- vendor/github.com/containers/buildah/run_freebsd.go.orig	2024-08-20 09:45:15 UTC
++++ vendor/github.com/containers/buildah/run_freebsd.go
+@@ -244,7 +244,7 @@ func (b *Builder) Run(command []string, options RunOpt
+ 		// Only add entries here if we do not have to do setup network,
+ 		// if we do we have to do it much later after the network setup.
+ 		if !configureNetwork {
+-			err = b.addResolvConfEntries(resolvFile, nil, nil, false, true)
++			err = b.addResolvConfEntries(resolvFile, nil, spec, false, true)
+ 			if err != nil {
+ 				return err
+ 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408201406.47KE6Q3o091505>