Bug 1526191 - RFC: Trim down types in /usr{,lib/share}
Summary: RFC: Trim down types in /usr{,lib/share}
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 28
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2017-12-14 21:49 UTC by Colin Walters
Modified: 2019-05-29 00:00 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-05-29 00:00:43 UTC
Type: Bug

Attachments (Terms of Use)

Description Colin Walters 2017-12-14 21:49:20 UTC
See https://github.com/projectatomic/rpm-ostree/pull/959#issuecomment-325780234

Basically we have the kernel/initramfs in multiple locations for ostree based systems for historical reasons, and due to the fact that these have separate labels, they end up duplicated on disk.  And since the initramfs is 60MB, that's not a small cost to pay.

# ostree --repo=repo-build ls -X fedora/26/x86_64/atomic-host /usr/lib/modules/4.12.8-300.fc26.x86_64/vmlinuz /boot/vmlinuz-4.12.8-300.fc26.x86_64-c28965ed30a8c8d597f21dd47f854147a94720ed821aff6be56af3a4c7d82393 /usr/lib/ostree-boot/vmlinuz-4.12.8-300.fc26.x86_64-c28965ed30a8c8d597f21dd47f854147a94720ed821aff6be56af3a4c7d82393
-00755 0 0 7373400 { [(b'security.selinux', b'system_u:object_r:modules_object_t:s0')] } /usr/lib/modules/4.12.8-300.fc26.x86_64/vmlinuz
-00755 0 0 7373400 { [(b'security.selinux', b'system_u:object_r:boot_t:s0')] } /boot/vmlinuz-4.12.8-300.fc26.x86_64-c28965ed30a8c8d597f21dd47f854147a94720ed821aff6be56af3a4c7d82393
-00755 0 0 7373400 { [(b'security.selinux', b'system_u:object_r:lib_t:s0')] } /usr/lib/ostree-boot/vmlinuz-4.12.8-300.fc26.x86_64-c28965ed30a8c8d597f21dd47f854147a94720ed821aff6be56af3a4c7d82393

I am going to kill at least one of these, but the problem is going to come up again; for example we just introduced a new place for the RPM database:

But I only belatedly realized that has the exact same problem:

ostree --repo=repo ls -X fedora/27/x86_64/atomic-host /usr/lib/sysimage/rpm-ostree-base-db/Packages  /usr/share/rpm/Packages
-00644 0 0 21901312 { [(b'security.selinux', b'system_u:object_r:lib_t:s0')] } /usr/lib/sysimage/rpm-ostree-base-db/Packages
-00644 0 0 21901312 { [(b'security.selinux', b'system_u:object_r:rpm_var_lib_t:s0')] } /usr/share/rpm/Packages

Soo...here's my strawman: Replace everything in /usr/lib{,64} and /usr/share with usr_t.  On ostree-managed systems everything underneath there is all read-only.  (So basically the only thing we *really* need to keep is exec transitions in /usr/bin)

Alternatively, we could try to whack-a-mole this.  Say proactively label both rpmdb locations as plain old usr_t ?

Comment 1 Colin Walters 2017-12-14 21:54:07 UTC
Also https://pagure.io/fedora-atomic/issue/94

Comment 2 Lukas Vrabec 2017-12-19 13:36:37 UTC

Sorry but I'm not sure what is issue here. You requesting replace everything in /usr/lib{64} to have usr_t context?

Comment 3 Colin Walters 2017-12-19 14:58:55 UTC
I think there's a wide spectrum of options here; unifying /usr/lib{,64} and /usr/share for example would be a "big hammer" solution.

In the short term though I'd say we should try a smaller fix of making /usr/lib/sysimage/rpm-ostree-base-db and /usr/share/rpm the same type; lib_t is ok, so is usr_t.  I don't like having it be rpm_var_lib_t as the data isn't actually "variable" any more than shared libraries are.

Comment 6 Fedora End Of Life 2018-02-20 15:26:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 7 Ben Cotton 2019-05-02 19:35:30 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. 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 Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Ben Cotton 2019-05-29 00:00:43 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 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 please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

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.