Description of problem: Redundant line in mozilla.if causes problems when compiling additional selinux modules Version-Release number of selected component (if applicable): 38.1.11-2.el9_2.3 How reproducible: Always Steps to Reproduce: 1. Install the above version of selinux-policy, selinux-policy-targeted, selinux-policy-doc, and selinux-policy-devel . 2. Write a simple module additional module called say mymodule.te . 3. From the directory containing mymodule.te, which should not contain any wanted subdirectory called tmp, issue the commands \rm -rf tmp make mymodule.pp Actual results: Syntax error at line nnnn of tmp/.... at token nsplugin_role Expected results: Successful compilation Additional info: I assume that this is because there is no longer a module nsplugin in this current version of selinux. I note also that the line containing nsplugin_role in mozilla.if is optional_policy, and that it compiles fine when the source package is built - but it doesn't when additional modules are compiled using the selinux-devel make system - perhaps this is an additional issue (I'm not sure).
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.
PR: https://github.com/fedora-selinux/selinux-policy/pull/1821