Bug 2123251

Summary: podman build and podman run read different seccomp.json file in the same environment
Product: Red Hat Enterprise Linux 9 Reporter: Joy Pu <ypu>
Component: podmanAssignee: Tom Sweeney <tsweeney>
Status: CLOSED ERRATA QA Contact: Joy Pu <ypu>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.1CC: bbaude, dwalsh, hhei, jnovy, lsm5, mboddu, mheon, pthomas, tsweeney, umohnani
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-4.3.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:41:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joy Pu 2022-09-01 08:51:26 UTC
Description of problem:

If we install podman and cri-o together in one host. Than podman build and podman run will read different seccomp.json by default. This will cause the behave of podman build and podman run are different for some command.


Version-Release number of selected component (if applicable):
podman-4.2.0-3.el9.x86_64

How reproducible:
100 %


Steps to Reproduce:
1. Install podman and cri-o in your host. So there will be two seccomp file in your system:
/etc/crio/seccomp.json (from cri-o)
 /usr/share/containers/seccomp.json (from container-common)

2. Try to install package from podman run and podman build
For podman build:
$ cat Dockerfile 
FROM registry.fedoraproject.org/fedora:36
RUN dnf -y install systemd dnsmasq iproute iputils && dnf clean all && systemctl enable dnsmasq
$ podman  build --no-cache -t dnsmasq .
STEP 1/2: FROM registry.fedoraproject.org/fedora:36
STEP 2/2: RUN dnf -y install systemd dnsmasq iproute iputils && dnf clean all && systemctl enable dnsmasq
Fedora 36 - x86_64                              0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'fedora':
  - Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-36&arch=x86_64 [getaddrinfo() thread failed to start]
Error: Failed to download metadata for repo 'fedora': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-36&arch=x86_64 [getaddrinfo() thread failed to start]
Error: error building at STEP "RUN dnf -y install systemd dnsmasq iproute iputils && dnf clean all && systemctl enable dnsmasq": error while running runtime: exit status 1

For podman run:
$ podman --log-level debug run -it --rm --name test registry.fedoraproject.org/fedora:36 dnf -y install systemd dnsmasq iproute iputils



Actual results:
podman build read the /etc/crio/seccomp.json and failed to resolve hostname
podman run read /usr/share/containers/seccomp.json and finished succeed. 



Expected results:
podman build should also read /usr/share/containers/seccomp.json as podman run did and finished as expected.

Additional info:

Comment 1 Joy Pu 2022-09-01 08:53:52 UTC
Thanks Huijing found this and add her in the cc list for status update

Comment 2 Tom Sweeney 2022-09-01 17:47:29 UTC
Aditya, can you look at this.  I suspect this is really an issue with Buildah rather than Podman.

Comment 3 Daniel Walsh 2022-09-04 11:25:38 UTC
Fixes in https://github.com/containers/buildah/pull/4219

Comment 4 Tom Sweeney 2022-09-07 14:07:54 UTC
Assigning to Jindrich for any further packaging or BZ needs.

Comment 5 Jindrich Novy 2022-12-01 11:58:13 UTC
Dan, Tom, the https://github.com/containers/buildah/pull/4219 is against buildah - is there a similar PR against podman? I don't see it in the podman code yet. Thanks.

Comment 7 Daniel Walsh 2022-12-04 22:23:37 UTC
Yes you are right we should be reading /usr/share/containers/seccomp.json.

Comment 8 Daniel Walsh 2022-12-04 22:28:13 UTC
Nalin fixed it correctly in 4407875a50dbfa237dde404835278526f68161b4 to get the constant out of containers.conf.

This is in podman 4.3.1

Comment 9 Tom Sweeney 2022-12-06 02:16:07 UTC
Just adding a link to Nalin's fix in the Buildah main branch: https://github.com/containers/buildah/pull/4225

Comment 13 Joy Pu 2022-12-29 08:58:01 UTC
Test with podman-4.3.1-3.el9.x86_64, the build command already read from /usr/share/containers/seccomp.json. So move this bug to verified.
# podman --log-level debug  build --no-cache -t dnsmasq . 2>&1 |grep seccomp.json
time="2022-12-29T03:42:02-05:00" level=debug msg="Resources: &define.CommonBuildOptions{AddHost:[]string{}, OmitHistory:false, CgroupParent:\"\", CPUPeriod:0x0, CPUQuota:0, CPUShares:0x0, CPUSetCPUs:\"\", CPUSetMems:\"\", HTTPProxy:true, IdentityLabel:0x1, Memory:0, DNSSearch:[]string{}, DNSServers:[]string{}, DNSOptions:[]string{}, LabelOpts:[]string(nil), MemorySwap:0, NoHosts:false, OmitTimestamp:false, SeccompProfilePath:\"/usr/share/containers/seccomp.json\", ApparmorProfile:\"\", ShmSize:\"65536k\", Ulimit:[]string{}, Volumes:[]string{}, Secrets:[]string{}, SSHSources:[]string{}, OCIHooksDir:[]string{}}"

Comment 14 Joy Pu 2022-12-29 08:58:46 UTC
More details:
# find / -name "seccomp.json"
/etc/crio/seccomp.json
/usr/share/containers/seccomp.json

Comment 15 Peter Hunt 2023-02-14 15:21:44 UTC
*** Bug 2123246 has been marked as a duplicate of this bug. ***

Comment 17 errata-xmlrpc 2023-05-09 07:41:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: podman security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2282