Bug 2313040 - snapd-selinux breaks selinux-policy-targeted/container-selinux
Summary: snapd-selinux breaks selinux-policy-targeted/container-selinux
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: snapd
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Zygmunt Krynicki
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-09-18 06:51 UTC by Pavel Raiskup
Modified: 2025-12-16 17:10 UTC (History)
16 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-12-16 17:10:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Pavel Raiskup 2024-09-18 06:51:51 UTC
type=AVC msg=audit(1726210659.521:22786): avc: denied { read write } for pid=1122774 comm="bash" path="/dev/pts/0" dev="devpts" ino=3 scontext=system_u:system_r:container_t:s0:c539,c854 tcontext=system_u:object_r:container_file_t:s0:c539,c854 tclass=chr_file permissive=0

AVC with '/bin/echo' command:

type=AVC msg=audit(1726210760.204:22810): avc: denied { read write } for pid=1123360 comm="echo" path="/dev/pts/0" dev="devpts" ino=3 scontext=system_u:system_r:container_t:s0:c142,c697 tcontext=system_u:object_r:container_file_t:s0:c142,c697 tclass=chr_file permissive=0

$ rpm -q container-selinux selinux-policy-targeted
container-selinux-2.233.0-1.fc41.noarch
selinux-policy-targeted-41.17-1.fc41.noarch


Reproducible: Always

Comment 1 Pavel Raiskup 2024-09-18 06:56:03 UTC
For

  podman run --rm -ti quay.io/centos/centos:stream9

Audit2allow gives me this:
#============= container_t ==============
allow container_t container_file_t:chr_file { read write };
allow container_t data_home_t:file read;

The `podman run --privileged` doesn't suffer from this problem.

Comment 2 Lokesh Mandvekar 2024-09-18 10:44:10 UTC
@praiskup is this on a fresh f41 instance? Also, did you notice it on any other releases of Fedora? FWIW, I don't see any issues on my rawhide env. I'll try to reproduce this on a testing-farm instance.

Comment 3 Daniel Walsh 2024-09-18 16:09:58 UTC
This is allowed, I have a feeling something with container-selinux did not install correctly.

sudo dnf -y reinstall container-selinux

Comment 4 Pavel Raiskup 2024-09-19 04:42:38 UTC
> @praiskup is this on a fresh f41 instance?

No, this is a box that I upgraded from F40.

> did you notice it on any other releases of Fedora?

Good point, no.  This started with the upgrade to F41.

> sudo dnf -y reinstall container-selinux

Doesn't help :-( tried several times, as mentioned here:
https://bodhi.fedoraproject.org/updates/FEDORA-2024-52c1264778

Comment 5 Pavel Raiskup 2024-09-19 05:05:20 UTC
# sesearch --allow | grep container_file_t
allow container_file_t devpts_t:filesystem associate;
allow container_file_t root_t:filesystem associate;
allow svirt_sandbox_domain container_file_t:blk_file { append getattr ioctl lock open read setattr write };
allow svirt_sandbox_domain container_file_t:dir { add_name create execmod ioctl link lock read relabelfrom relabelto remove_name rename reparent rmdir setattr unlink watch watch_reads write };
allow svirt_sandbox_domain container_file_t:fifo_file { append create getattr ioctl link lock open read rename setattr unlink write };
allow svirt_sandbox_domain container_file_t:file { append create execmod execute execute_no_trans getattr ioctl link lock map open read relabelfrom relabelto rename setattr unlink watch watch_reads write };
allow svirt_sandbox_domain container_file_t:filesystem remount;
allow svirt_sandbox_domain container_file_t:lnk_file { append create getattr ioctl link lock read rename setattr unlink watch watch_reads write };
allow svirt_sandbox_domain container_file_t:sock_file { append create getattr ioctl link lock open read rename setattr unlink write };
allow system_dbusd_t container_file_t:dir { ioctl lock read };
allow virsh_t container_file_t:chr_file { create link open rename setattr unlink };
allow virsh_t container_file_t:dir { add_name create getattr ioctl link lock open read remove_name rename reparent rmdir search setattr unlink watch watch_reads write };
allow virsh_t container_file_t:fifo_file { append create getattr ioctl link lock open read rename setattr unlink write };
allow virsh_t container_file_t:file { append create getattr ioctl link lock open read rename setattr unlink watch watch_reads write };
allow virsh_t container_file_t:lnk_file { append create getattr ioctl link lock read rename setattr unlink watch watch_reads write };
allow virsh_t container_file_t:sock_file { append create getattr ioctl link lock open read rename setattr unlink write };

Comment 6 Pavel Raiskup 2024-09-19 05:25:56 UTC
Dnf5 log claims this whenever I try to reinstall selinux-policy-targeted/container-selinux:

2024-09-19T05:24:11+0000 [2433857] INFO RPM callback start post-install scriptlet "container-selinux-2:2.233.0-1.fc41.noarch"
2024-09-19T05:24:15+0000 [2433857] INFO [scriptlet] Failed to resolve typeattributeset statement at /var/lib/selinux/targeted/tmp/modules/200/snappy/cil:223
2024-09-19T05:24:15+0000 [2433857] INFO [scriptlet] Failed to resolve AST
2024-09-19T05:24:15+0000 [2433857] INFO [scriptlet] semodule:  Failed!

I tried to get the latest selinux-policy update:

$ koji-tool install -R selinux-policy-41.18-1.fc41

But no help, still the same problem.  Is this a selinux-policy problem, then?

Comment 7 Pavel Raiskup 2024-09-19 05:32:57 UTC
Ok, removing snapd package helped.

Comment 8 Pavel Raiskup 2024-09-19 05:33:37 UTC
Namely `dnf remove snapd-selinux-2.65.1-0.fc41.noarch` (and all the deps).

Comment 9 Zdenek Pytela 2024-09-19 12:09:59 UTC
Please rebuild with the latest selinux-policy.
Additionally, always ensure that calling interfaces from other non-base modules are in the optional block, e.g.

348 # or on some systems same dbus API may be provided by timedatex
349 # RHEL7: there is no timedatex.if
350 ifndef(`distro_rhel7',`
351   timedatex_dbus_chat(snappy_t)
352 ')

see #L430 for the correct usage.

It is also the case of miscfiles, logging, gnome, userdom, mandb.

Comment 10 Zdenek Pytela 2024-09-19 12:16:55 UTC
I haven't mentioned 1 important bit: remove references to timedatex which is not shipped any longer, either unconditionally for all releases, or keep it present for rhel 8 only.

Not having the interface in an optional block makes the whole module invalid.

Comment 11 Adam Williamson 2025-12-02 01:17:23 UTC
This message is a reminder that Fedora Linux 41 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 41 on 2025-12-15.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '41'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 41 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 12 Samyak Jain (RedHat) 2025-12-16 17:10:44 UTC
Fedora Linux 41 entered end-of-life (EOL) status on 2025-12-15.

Fedora Linux 41 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.