Bug 2221251
| Summary: | Redundant line in mozilla.if causes problems compiling non-standard modules | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Roger Sewell <roger.sewell> |
| Component: | selinux-policy | Assignee: | Nobody <nobody> |
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 9.2 | CC: | lvrabec, mmalik, zpytela |
| Target Milestone: | rc | Keywords: | Reopened, Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | selinux-policy-38.1.20-1.el9 | Doc Type: | Bug Fix |
| Doc Text: |
Cause: Nsplugin module was removed from SELinux policy, but interface nsplugin_role was still included in mozilla_role interface, which caused syntax error, when using this interface.
Consequence: Redundant line in mozilla.if causes problems when compiling additional selinux modules
Fix: Remove nsplugin_role from mozilla.if
Result: No more syntax errors when compiling selinux modules
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-11-07 08:52:30 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: | |||
| Deadline: | 2023-08-08 | ||
|
Description
Roger Sewell
2023-07-07 16:30:51 UTC
Hi Roger, I tried to reproduce the issue but everything works properly: # rpm -qa selinux-policy* selinux-policy-38.1.11-2.el9_2.3.noarch selinux-policy-targeted-38.1.11-2.el9_2.3.noarch selinux-policy-devel-38.1.11-2.el9_2.3.noarch selinux-policy-doc-38.1.11-2.el9_2.3.noarch # sepolicy generate --init /usr/bin/wget Created the following files: /root/wget-selinux/wget.te # Type Enforcement file /root/wget-selinux/wget.if # Interface file /root/wget-selinux/wget.fc # File Contexts file /root/wget-selinux/wget_selinux.spec # Spec file /root/wget-selinux/wget.sh # Setup Script # rm -rf tmp # make -f /usr/share/selinux/devel/Makefile wget.pp Compiling targeted wget module Creating targeted wget.pp policy package rm tmp/wget.mod tmp/wget.mod.fc # semodule -i wget.pp # semodule -lfull | grep wget 400 wget pp Nikola,
I'm very sorry - on further investigation I now realise I needed to give you another piece of information, namely the contents of the .te file being compiled. After paring it down to the minimum possible that still shows the problem, the following file (whose contents is now of course pointless) demonstrates the bug:
<unconfmoz.te contains:>
policy_module(unconfmoz, 1.1)
gen_require(`
role unconfined_r;
type unconfined_t;
')
mozilla_role(unconfined_r, unconfined_t)
<end of file>
then on doing
make -f /usr/share/selinux/devel/Makefile unconfmoz.pp
I get
Compiling targeted unconfmoz module
unconfmoz.te:9:ERROR 'syntax error' at token 'nsplugin_role' on line 4246:
nsplugin_role(unconfined_r, mozilla_t)
#line 9
/usr/bin/checkmodule: error(s) encountered while parsing configuration
make: *** [/usr/share/selinux/devel/include/Makefile:157: tmp/unconfmoz.mod] Error 1
If, however, I replace the mozilla module with one with the line containing nsplugin_role removed from mozilla.if then it compiles correctly.
(If it's any consolation, your time has not been totally wasted - I had not realised before how useful the sepolicy generate --init command was - so thank you for the education.)
Thanks, Roger.
Hi Roger,
you are right with the nsplugin, we will investigate it.
For the loadable modules is good to use optional policy block:
optional_policy(`
mozilla_role(unconfined_r, unconfined_t)
')
https://selinuxproject.org/page/PolicyStatements
Nikola, Thank you for the further education - appreciated. Roger. 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 (selinux-policy bug fix and enhancement 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/RHBA-2023:6617 |