Skip to contentSkip to conversation

libselinux: Provide new labeling backend

PATCH rpcraig 4 participants 7 messages Apr 9, 2012 SELinux security module

lore
Share & tools
lore

rpcraig

author
#0 lore raw

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Quoted 1 line

From 1116054b1b9f6ab51f197613fa2a6e0d739e6ec8 Mon Sep 17 00:00:00 2001

From: rpcraig <[email protected]>
Date: Fri, 6 Apr 2012 15:54:29 -0400
Subject: [PATCH] New Android property labeling backend

---
 libselinux/include/selinux/label.h      |    2 +
 libselinux/src/label.c                  |    1 +
 libselinux/src/label_android_property.c |  296 +++++++++++++++++++++++++++++++
 libselinux/src/label_internal.h         |    2 +
 4 files changed, 301 insertions(+), 0 deletions(-)
 create mode 100644 libselinux/src/label_android_property.c
libselinux/include/selinux/label.h +2 -0
index 1a54307..8263f32 100644
@@ -31,6 +31,8 @@ struct selabel_handle;
 #define SELABEL_CTX_X		2
 /* db objects */
 #define SELABEL_CTX_DB		3
+/* Android property service contexts */
+#define SELABEL_CTX_ANDROID_PROP 4
 
 /*
  * Available options
libselinux/src/label.c +1 -0
index a9e0853..0a5bc39 100644
@@ -24,6 +24,7 @@ static selabel_initfunc initfuncs[] = {
 	&selabel_media_init,
 	&selabel_x_init,
 	&selabel_db_init,
+	&selabel_property_init,
 };
 
 static void selabel_subs_fini(struct selabel_sub *ptr)
libselinux/src/label_android_property.c new file +296 -0

296 lines not on this page · raw message

libselinux/src/label_internal.h +2 -0
index 79d5495..435ecf2 100644
@@ -25,6 +25,8 @@ int selabel_x_init(struct selabel_handle *rec, struct selinux_opt *opts,
 		   unsigned nopts) hidden;
 int selabel_db_init(struct selabel_handle *rec,
 		    struct selinux_opt *opts, unsigned nopts) hidden;
+int selabel_property_init(struct selabel_handle *rec,
+			  struct selinux_opt *opts, unsigned nopts) hidden;
 
 /*
  * Labeling internal structures
Signature · 1 line
1.7.5.4
Reviewed-by
#1 lore raw
Quoted 2 lines · rpcraig

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Eric, you may want to run scripts/Lindent on src/label_android_property.c afterward to fix up some whitespace issues.

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.
#2 lore raw
In reply to rpcraig
Quoted 2 lines · rpcraig

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Does this apply to the main selinux repo or the android repo? It appears to be the selinux repo but I don't understand what the purpose is since Android uses a different libselinux at runtime.

--
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.

#3 lore raw

I belive sds would like me to grab his libselinux android patches from 2/23 and get them into the main repo. I'm hoping to get to the this afternoon.

-Eric

Quoted 10 lines · Joshua Brindle
Quoted 3 lines · rpcraig

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Does this apply to the main selinux repo or the android repo? It appears to be the selinux repo but I don't understand what the purpose is since Android uses a different libselinux at runtime.

Quoted 5 lines

--
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.

--
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.

#5 lore raw
In reply to Joshua Brindle
Quoted 7 lines · Joshua Brindle
Quoted 2 lines · rpcraig

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Does this apply to the main selinux repo or the android repo? It appears to be the selinux repo but I don't understand what the purpose is since Android uses a different libselinux at runtime.

The patch is for the main selinux repo; this backend is already part of the Android libselinux. I suggested that it would be a good idea to add it to the upstream libselinux at least to avoid a conflict in the future with the selabel indices, and possibly with an eye toward an eventual reunification of the two libselinuxes down the road.

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.
#4 lore raw
In reply to Eric Paris

I'm an idiot, that patch is libsepol, not libselinux. Anyway, back
to your regularly scheduled program.

Quoted 4 lines · Eric Paris

I belive sds would like me to grab his libselinux android patches from 2/23 and get them into the main repo.  I'm hoping to get to the this afternoon.

Quoted 18 lines

-Eric

Quoted 15 lines · Joshua Brindle
Quoted 3 lines · rpcraig

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Does this apply to the main selinux repo or the android repo? It appears to be the selinux repo but I don't understand what the purpose is since Android uses a different libselinux at runtime.

--
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.

--
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.

#6 lore raw
In reply to Stephen Smalley
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Joshua Brindle
Quoted 2 lines · rpcraig

I have attached a patch which provides a new labeling backend directed at the Android property service keys.

Does this apply to the main selinux repo or the android repo? It appears to be the selinux repo but I don't understand what the purpose is since Android uses a different libselinux at runtime.

Quoted 6 lines

The patch is for the main selinux repo; this backend is already part of the Android libselinux. I suggested that it would be a good idea to add it to the upstream libselinux at least to avoid a conflict in the future with the selabel indices, and possibly with an eye toward an eventual reunification of the two libselinuxes down the road.

Fair enough.

--
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.