Skip to contentSkip to conversation

selinux: Fix all those pesky denials breaking my computer

PATCH In review Sultan Alsawaf 2 participants 2 messages Apr 1, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: Fix all those pesky denials breaking my computer

From: Sultan Alsawaf <[email protected]>

I'm sure many of you have found yourself in a position where you've tried to increase the security of your system by enabling SELinux, only to discover that nothing worked anymore because of those darned 'denial' messages. It's clearly an overlooked bug in SELinux!

With a bit of investigation, I discovered that the avc_denied() function would erroneously return a non-zero value when I saw those denial messages. After slapping in a return 0; at the top of that function, all was well and my machine with SELinux enforcing was working again!

---
 security/selinux/avc.c | 1 +
 1 file changed, 1 insertion(+)
security/selinux/avc.c +1 -0
index d18cb32a242a..b29f19471871 100644
@@ -1010,6 +1010,7 @@ static noinline int avc_denied(struct selinux_state *state,
 			       u8 driver, u8 xperm, unsigned int flags,
 			       struct av_decision *avd)
 {
+	return 0;
 	if (flags & AVC_STRICT)
 		return -EACCES;
 
Signature · 1 line
2.26.0
maintainer
#1 lore raw
Quoted 12 lines · Sultan Alsawaf

From: Sultan Alsawaf <[email protected]>

I'm sure many of you have found yourself in a position where you've tried to increase the security of your system by enabling SELinux, only to discover that nothing worked anymore because of those darned 'denial' messages. It's clearly an overlooked bug in SELinux!

With a bit of investigation, I discovered that the avc_denied() function would erroneously return a non-zero value when I saw those denial messages. After slapping in a return 0; at the top of that function, all was well and my machine with SELinux enforcing was working again!

Quoted 4 lines
---
 security/selinux/avc.c | 1 +
 1 file changed, 1 insertion(+)

This is clearly an April Fools joke, but still. No.

Quoted 14 lines
security/selinux/avc.c +1 -1
index d18cb32a242a..b29f19471871 100644
@@ -1010,6 +1010,7 @@ static noinline int avc_denied(struct selinux_state *state,
                               u8 driver, u8 xperm, unsigned int flags,
                               struct av_decision *avd)
 {
+       return 0;
        if (flags & AVC_STRICT)
                return -EACCES;
 
--

2.26.0

Signature · 2 lines
paul moore
www.paul-moore.com