Skip to contentSkip to conversation

external/libselinux

PATCH In review William Roberts 2 participants 3 messages Jul 27, 2012 SELinux security module

lore
Share & tools
lore
#0 lore raw

[PATCH] Allow zygote to spawn non matched apps in permissive mode

Revised based on stephens comments.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw

PATCH 1/1 Allow zygote to spawn non matched apps in permissive mode

This patch will allow non-matched apps in seapp_contexts to still be spawned via the zygote. An error message will be sent to logcat.

Change-Id I9fb5dcfeb384a26e6a01d69bffd2ef14af74c51c
---
 src/android.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
src/android.c +2 -3
index ef27991..50666a0 100644
@@ -526,8 +526,7 @@ int selinux_android_setcontext(uid_t uid,
 		selinux_log(SELINUX_ERROR,
 			    "%s:  No match for app with uid %d, seinfo %s, name %s\n",
 			    __FUNCTION__, uid, seinfo, pkgname);
-		rc = -1;
-		goto out;
+		goto err;
 	}
 
 	ctx_str = context_str(ctx);
@@ -559,7 +558,7 @@ err:
 			    "%s:  Error setting context for app with uid %d, seinfo %s: %s\n",
 			    __FUNCTION__, uid, seinfo, strerror(errno));
 
-	rc = -1;
+	rc = (security_getenforce() == 0) ? 0 : -1;
 	goto out;
 oom:
 	selinux_log(SELINUX_ERROR, "%s:  Out of memory\n", __FUNCTION__);
Signature · 7 lines
1.7.0.4


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw

Re: [PATCH] Allow zygote to spawn non matched apps in permissive mode

Quoted 15 lines · William Roberts

This patch will allow non-matched apps in seapp_contexts to still be spawned via the zygote. An error message will be sent to logcat.

Change-Id I9fb5dcfeb384a26e6a01d69bffd2ef14af74c51c
---
 src/android.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
src/android.c +0 -0
index ef27991..50666a0 100644

src/android.c int selinux_android_setcontext(uid_t uid, · line 529

Quoted 6 lines
src/android.c +1 -2
@@ -526,8 +526,7 @@ int selinux_android_setcontext(uid_t uid,
 		selinux_log(SELINUX_ERROR,
 			    "%s:  No match for app with uid %d, seinfo %s, name %s\n",
 			    __FUNCTION__, uid, seinfo, pkgname);
-		rc = -1;
-		goto out;
+		goto err;

This leads to a double free. That's the other reason for not going to err here.

Quoted 12 lines
src/android.c +1 -1
 	}
 
 	ctx_str = context_str(ctx);
@@ -559,7 +558,7 @@ err:
 			    "%s:  Error setting context for app with uid %d, seinfo %s: %s\n",
 			    __FUNCTION__, uid, seinfo, strerror(errno));
 
-	rc = -1;
+	rc = (security_getenforce() == 0) ? 0 : -1;
 	goto out;
 oom:
 	selinux_log(SELINUX_ERROR, "%s:  Out of memory\n", __FUNCTION__);
Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.