Skip to contentSkip to conversation

package/refpolicy: enable refpolicy's xdg module when systemd is enabled

PATCH In review Romain Naour 3 participants 6 messages Oct 31, 2021 – Nov 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/refpolicy: enable refpolicy's xdg module when systemd is enabled

policy/modules/system/systemd.te requires xdg module enabled [1] otherwise refpolicy fail to build:

policy/modules/system/systemd.te:288:ERROR 'attribute xdg_config_type is not declared' at token ';' on line 508447:

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470

[1] https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288

Cc Antoine Tenart <[email protected]>
---
 package/refpolicy/refpolicy.mk | 1 +
 1 file changed, 1 insertion(+)
package/refpolicy/refpolicy.mk +1 -0
index 975c3b584c..b1d101e311 100644
@@ -69,6 +69,7 @@ REFPOLICY_MODULES = \
 	sysnetwork \
 	unconfined \
 	userdomain \
+	$(if $(BR2_PACKAGE_SYSTEMD),xdg) \
 	$(PACKAGES_SELINUX_MODULES) \
 	$(call qstrip,$(BR2_REFPOLICY_EXTRA_MODULES)) \
 	$(foreach d,$(REFPOLICY_EXTRA_MODULES_DIRS),\
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello;

Shouldn’t this go in systemd.mk?

Adam
________________________________
Da: buildroot <[email protected]> per conto di Romain Naour <[email protected]>
Inviato: Sunday, October 31, 2021 3:42:07 PM
A: [email protected] <[email protected]>
Cc: Romain Naour <[email protected]>; Antoine Tenart <[email protected]>
Oggetto: [Buildroot] [PATCH] package/refpolicy: enable refpolicy's xdg module when systemd is enabled

policy/modules/system/systemd.te requires xdg module enabled [1] otherwise refpolicy fail to build:

policy/modules/system/systemd.te:288:ERROR 'attribute xdg_config_type is not declared' at token ';' on line 508447:

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470

[1] https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288

Cc Antoine Tenart <[email protected]>
---
 package/refpolicy/refpolicy.mk | 1 +
 1 file changed, 1 insertion(+)
package/refpolicy/refpolicy.mk +1 -0
index 975c3b584c..b1d101e311 100644
@@ -69,6 +69,7 @@ REFPOLICY_MODULES = \
         sysnetwork \
         unconfined \
         userdomain \
+       $(if $(BR2_PACKAGE_SYSTEMD),xdg) \
         $(PACKAGES_SELINUX_MODULES) \
         $(call qstrip,$(BR2_REFPOLICY_EXTRA_MODULES)) \
         $(foreach d,$(REFPOLICY_EXTRA_MODULES_DIRS),\

--
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Adam,

Le 01/11/2021 à 07:10, ratbert90 a écrit :

Quoted 3 lines

Hello;

Shouldn’t this go in systemd.mk?

I'm not sure to understand, what do you mean?

It's about a refpolicy module not selinux module (SYSTEMD_SELINUX_MODULES).

Another way to fix the issue is to add xdp to BR2_REFPOLICY_EXTRA_MODULES in the test config... but I don't think it's the right fix.

Best regards,
Romain

Quoted 53 lines

Adam
--------------------------------------------------------------------------------
*Da:* buildroot <[email protected]> per conto di Romain Naour <[email protected]>
*Inviato:* Sunday, October 31, 2021 3:42:07 PM
*A:* [email protected] <[email protected]>
*Cc:* Romain Naour <[email protected]>; Antoine Tenart <[email protected]> *Oggetto:* [Buildroot] [PATCH] package/refpolicy: enable refpolicy's xdg module when systemd is enabled

policy/modules/system/systemd.te requires xdg module enabled [1] otherwise refpolicy fail to build:

policy/modules/system/systemd.te:288:ERROR 'attribute xdg_config_type is not declared' at token ';' on line 508447:

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468
<https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468>
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470
<https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470>

[1]
https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288
<https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288>

Cc Antoine Tenart <[email protected]>

---
 package/refpolicy/refpolicy.mk | 1 +

 1 file changed, 1 insertion(+)
package/refpolicy/refpolicy.mk +1 -0
index 975c3b584c..b1d101e311 100644
@@ -69,6 +69,7 @@ REFPOLICY_MODULES = \
          sysnetwork \
          unconfined \
          userdomain \
+       $(if $(BR2_PACKAGE_SYSTEMD),xdg) \
          $(PACKAGES_SELINUX_MODULES) \
          $(call qstrip,$(BR2_REFPOLICY_EXTRA_MODULES)) \
          $(foreach d,$(REFPOLICY_EXTRA_MODULES_DIRS),\
Signature · 7 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
<https://lists.buildroot.org/mailman/listinfo/buildroot>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hey Romain;

Sorry for the late reply!

Quoted 11 lines · Romain Naour

Hello Adam,

Quoted 3 lines · Le 01/11/2021 à 07:10, ratbert90 a écrit :

Hello;

Shouldn’t this go in systemd.mk?

I'm not sure to understand, what do you mean?

It's about a refpolicy module not selinux module (SYSTEMD_SELINUX_MODULES).

Refpolicy modules are SELinux modules!

I just tested by adding xdg to SYSTEMD_SELINUX_MODULES which does indeed fix the issue.

Adam

Quoted 56 lines

Another way to fix the issue is to add xdp to BR2_REFPOLICY_EXTRA_MODULES in the test config... but I don't think it's the right fix.

Best regards,
Romain

Quoted 48 lines

Adam
--------------------------------------------------------------------------------
*Da:* buildroot <[email protected]> per conto di Romain Naour <[email protected]>
*Inviato:* Sunday, October 31, 2021 3:42:07 PM
*A:* [email protected] <[email protected]>
*Cc:* Romain Naour <[email protected]>; Antoine Tenart <[email protected]> *Oggetto:* [Buildroot] [PATCH] package/refpolicy: enable refpolicy's xdg module when systemd is enabled

policy/modules/system/systemd.te requires xdg module enabled [1] otherwise refpolicy fail to build:

policy/modules/system/systemd.te:288:ERROR 'attribute xdg_config_type is not declared' at token ';' on line 508447:

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468
<https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468>
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470
<https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470>

[1]
https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288
<https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288>

Cc Antoine Tenart <[email protected]>
---
 package/refpolicy/refpolicy.mk | 1 +
 1 file changed, 1 insertion(+)
package/refpolicy/refpolicy.mk +1 -1
index 975c3b584c..b1d101e311 100644
@@ -69,6 +69,7 @@ REFPOLICY_MODULES = \
         sysnetwork \
         unconfined \
         userdomain \
+       $(if $(BR2_PACKAGE_SYSTEMD),xdg) \
         $(PACKAGES_SELINUX_MODULES) \
         $(call qstrip,$(BR2_REFPOLICY_EXTRA_MODULES)) \
         $(foreach d,$(REFPOLICY_EXTRA_MODULES_DIRS),\
--

2.31.1

Quoted 6 lines
Quoted 5 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
<https://lists.buildroot.org/mailman/listinfo/buildroot>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hello Adam,

Le 02/11/2021 à 18:26, Adam Duskett a écrit :

Quoted 14 lines

Hey Romain;

Sorry for the late reply!

Quoted 8 lines · Romain Naour

Hello Adam,

Quoted 3 lines · Le 01/11/2021 à 07:10, ratbert90 a écrit :

Hello;

Shouldn’t this go in systemd.mk?

Quoted 8 lines
Quoted 3 lines

I'm not sure to understand, what do you mean?

It's about a refpolicy module not selinux module (SYSTEMD_SELINUX_MODULES).

Refpolicy modules are SELinux modules!

I just tested by adding xdg to SYSTEMD_SELINUX_MODULES which does indeed fix the issue.

ok but it's not clear to me if we need to add xdg to SYSTEMD_SELINUX_MODULES or REFPOLICY_MODULES.

Best regards,
Romain

Quoted 64 lines

Adam

Quoted 62 lines

Another way to fix the issue is to add xdp to BR2_REFPOLICY_EXTRA_MODULES in the test config... but I don't think it's the right fix.

Best regards,
Romain

Quoted 53 lines

Adam
--------------------------------------------------------------------------------
*Da:* buildroot <[email protected]> per conto di Romain Naour <[email protected]>
*Inviato:* Sunday, October 31, 2021 3:42:07 PM
*A:* [email protected] <[email protected]>
*Cc:* Romain Naour <[email protected]>; Antoine Tenart <[email protected]> *Oggetto:* [Buildroot] [PATCH] package/refpolicy: enable refpolicy's xdg module when systemd is enabled

policy/modules/system/systemd.te requires xdg module enabled [1] otherwise refpolicy fail to build:

policy/modules/system/systemd.te:288:ERROR 'attribute xdg_config_type is not declared' at token ';' on line 508447:

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468
<https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552468>
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470
<https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552470>

[1]
https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288
<https://github.com/SELinuxProject/refpolicy/blob/RELEASE_2_20210908/policy/modules/system/systemd.te#L288>

Cc Antoine Tenart <[email protected]>
---
 package/refpolicy/refpolicy.mk | 1 +
 1 file changed, 1 insertion(+)
package/refpolicy/refpolicy.mk +1 -1
index 975c3b584c..b1d101e311 100644
@@ -69,6 +69,7 @@ REFPOLICY_MODULES = \
         sysnetwork \
         unconfined \
         userdomain \
+       $(if $(BR2_PACKAGE_SYSTEMD),xdg) \
         $(PACKAGES_SELINUX_MODULES) \
         $(call qstrip,$(BR2_REFPOLICY_EXTRA_MODULES)) \
         $(foreach d,$(REFPOLICY_EXTRA_MODULES_DIRS),\
--

2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
<https://lists.buildroot.org/mailman/listinfo/buildroot>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Hello,

Quoted 5 lines · On Wed, 3 Nov 2021 22:06:43 +0100 Romain Naour <[email protected]> wrote:
Quoted 2 lines

I just tested by adding xdg to SYSTEMD_SELINUX_MODULES which does indeed fix the issue.

ok but it's not clear to me if we need to add xdg to SYSTEMD_SELINUX_MODULES or REFPOLICY_MODULES.

Clearly to SYSTEMD_SELINUX_MODULES. The idea of REFPOLICY_MODULES is to list:

(1) Mandatory refpolicy modules

(2) refpolicy modules needed by other Buildroot packages, i.e.

     $(PACKAGES_SELINUX_MODULES)

(3) refpolicy modules explicitly enabled by the user through the BR2_REFPOLICY_EXTRA_MODULES option

(4) additional SELinux policy modules provided directly within a package directory, in package/<foo>/selinux/

In our case, it's the systemd refpolicy module that needs xdg, so systemd.mk should be patched:

-SYSTEMD_SELINUX_MODULES = systemd udev
+SYSTEMD_SELINUX_MODULES = systemd udev xdg

Could you send an updated patch ?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot