Skip to contentSkip to conversation

selinux: allow dontauditx and auditallowx rules to take effect without allowx

PATCH In review Alexander Grund 2 participants 4 messages Aug 8, 2022 – Aug 11, 2022 Stable branch

lore
Share & tools
lore
#0 lore raw

cover selinux: allow dontauditx and auditallowx rules to take effect without allowx

This patch fixes an inconsistency, if not a clear bug, with the extended permissions. To quote from the original discussion [1]:

Quoted 1 line

The behavior of dontauditx and auditallowx appears to be broken making them useless.

[1] https://lore.kernel.org/selinux/[email protected]/T/

bauen1 (1):
selinux: allow dontauditx and auditallowx rules to take effect without allowx

 security/selinux/ss/services.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 selinux: allow dontauditx and auditallowx rules to take effect without allowx

From: bauen1 <[email protected]>

commit 44141f58e14317853698f994ca5c3785a0c230d0 upstream.

This allows for dontauditing very specific ioctls e.g. TCGETS without dontauditing every ioctl or granting additional permissions.

Now either an allowx, dontauditx or auditallowx rules enables checking for extended permissions.

---
 security/selinux/ss/services.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
security/selinux/ss/services.c +1 -3
index 6ca297821d459..c27c3ce76abbc 100644
@@ -610,9 +610,7 @@ void services_compute_xperms_drivers(
 					node->datum.u.xperms->driver);
 	}
 
-	/* If no ioctl commands are allowed, ignore auditallow and auditdeny */
-	if (node->key.specified & AVTAB_XPERMS_ALLOWED)
-		xperms->len = 1;
+	xperms->len = 1;
 }
 
 /*
Signature · 1 line
2.25.1
maintainer
#2 lore raw
In reply to Alexander Grund
Quoted 11 lines · Alexander Grund

This patch fixes an inconsistency, if not a clear bug, with the extended permissions. To quote from the original discussion [1]:

Quoted 1 line

The behavior of dontauditx and auditallowx appears to be broken making them useless.

[1] https://lore.kernel.org/selinux/[email protected]/T/

bauen1 (1):
selinux: allow dontauditx and auditallowx rules to take effect without allowx

 security/selinux/ss/services.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

For obvious reasons, we can't take patches only for 4.9.y that are not also in newer kernel branches. You don't want to upgrade to 4.14.y and have a regression, right?

So this would need to be backported to 4.14.y, 4.19.y, 5.4.y, and 5.10.y before we could consider it.

BUT, as this is something that just never worked, why is it needed at all? Making it work is a "new feature", not really a bugfix for these older kernels as it is not a regression.

I'll drop this from my queue, if you really think it needs to come back, we need backports for all affected kernel branches.

thanks,

greg k-h

#3 lore raw
Quoted 6 lines

So this would need to be backported to 4.14.y, 4.19.y, 5.4.y, and 5.10.y before we could consider it.

BUT, as this is something that just never worked, why is it needed at all? Making it work is a "new feature", not really a bugfix for these older kernels as it is not a regression.

I agree it is not a regression but following the original discussion on this I do think it is a bug worth fixing, see the already quoted:

Quoted 1 line

The behavior of dontauditx and auditallowx appears to be broken making them useless.

At least it is a pitfall for policy writers which can be easily avoided by this small fix.

I don't mind porting this to the other LTS releases if you agree on this judgement. If so, what would the best/simplest way to do so? An own thread with [0/1] & [1/1] mails for each LTS branch or e.g. replying to this thread with a patch for each of the LTS branches?

If you don't agree I won't send those mails which is also fine.

Thanks,
Alex