Skip to contentSkip to conversation

policy: allow all test domains to inherit limits

PATCH In review Ondrej Mosnacek 2 participants 3 messages Aug 4 – Aug 5 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 policy: allow all test domains to inherit limits

Currently the "minimal" test domains aren't allowed to inherit resource limits from other domains. However, that means that their resource limits get reset to at most the init task's limits, which on some distros and platforms (e.g. CentOS Stream 9 / RHEL 9 + ppc64le) isn't enough to run the io_uring tests.

Since the rlimitinh permission isn't tested by the testsuite, it can be safely granted even to the minimal domains, so do just that.

---
 policy/test_policy.if | 1 +
 1 file changed, 1 insertion(+)
policy/test_policy.if +1 -0
index ea15ca6..2a1a575 100644
@@ -42,6 +42,7 @@ interface(`testsuite_domain_type_minimal',`
 	testsuite_domain_type_common($1)
 
 	# minimal set of rules to substitute missing domain_type()
+	allow { domain testsuite_domain } $1:process { rlimitinh };
 	allow $1 proc_t:dir { search };
 	allow $1 proc_t:lnk_file { read };
 	allow $1 self:dir { search };
Signature · 1 line
2.55.0
maintainer
#1 lore raw
Quoted 20 lines · Ondrej Mosnacek

Currently the "minimal" test domains aren't allowed to inherit resource limits from other domains. However, that means that their resource limits get reset to at most the init task's limits, which on some distros and platforms (e.g. CentOS Stream 9 / RHEL 9 + ppc64le) isn't enough to run the io_uring tests.

Since the rlimitinh permission isn't tested by the testsuite, it can be safely granted even to the minimal domains, so do just that.

---
 policy/test_policy.if | 1 +
 1 file changed, 1 insertion(+)
policy/test_policy.if +0 -0
index ea15ca6..2a1a575 100644

policy/test_policy.if interface(`testsuite_domain_type_minimal',` · line 45

Quoted 4 lines
policy/test_policy.if +1 -0
@@ -42,6 +42,7 @@ interface(`testsuite_domain_type_minimal',`
        testsuite_domain_type_common($1)
 
        # minimal set of rules to substitute missing domain_type()
+       allow { domain testsuite_domain } $1:process { rlimitinh };

Why are you allowing it to all "domain"?

Quoted 7 lines
policy/test_policy.if +0 -1
        allow $1 proc_t:dir { search };
        allow $1 proc_t:lnk_file { read };
        allow $1 self:dir { search };
--

2.55.0

#2 lore raw
Quoted 24 lines · Stephen Smalley
Quoted 22 lines · Ondrej Mosnacek

Currently the "minimal" test domains aren't allowed to inherit resource limits from other domains. However, that means that their resource limits get reset to at most the init task's limits, which on some distros and platforms (e.g. CentOS Stream 9 / RHEL 9 + ppc64le) isn't enough to run the io_uring tests.

Since the rlimitinh permission isn't tested by the testsuite, it can be safely granted even to the minimal domains, so do just that.

---
 policy/test_policy.if | 1 +
 1 file changed, 1 insertion(+)
policy/test_policy.if +0 -0
index ea15ca6..2a1a575 100644
@@ -42,6 +42,7 @@ interface(`testsuite_domain_type_minimal',`
        testsuite_domain_type_common($1)
 
Quoted 4 lines

policy/test_policy.if interface(`testsuite_domain_type_minimal',` · line 45

Quoted 2 lines
policy/test_policy.if +1 -0
        # minimal set of rules to substitute missing domain_type()
+       allow { domain testsuite_domain } $1:process { rlimitinh };

Why are you allowing it to all "domain"?

Actually, scratch this patch... I was working under the assumption that all domain_type() generally allows domains to inherit limits from other domains, but that's not true (I saw that io_uring's policy uses testsuite_domain_type_minimal() and automatically assumed that it's the culprit).

I now think that just making sure that the RLIMIT_MEMLOCK soft limit is set to the hard limit specifically in iouring.c is the right way to fix this. Let me do some more research/testing and send a new patch...

Quoted 9 lines
Quoted 8 lines
policy/test_policy.if +0 -1
        allow $1 proc_t:dir { search };
        allow $1 proc_t:lnk_file { read };
        allow $1 self:dir { search };
--

2.55.0

Signature · 3 lines
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.