All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] libselinux: Namespacing
@ 2007-05-10 20:12 Stephen Smalley
  2007-05-10 20:31 ` Karl MacMillan
  2007-05-10 22:12 ` James Antill
  0 siblings, 2 replies; 11+ messages in thread
From: Stephen Smalley @ 2007-05-10 20:12 UTC (permalink / raw)
  To: selinux

libselinux presently lacks proper namespacing of its functions.  This
patch is just for comment on an approach to gradually fixing that
problem, starting with just a trivial example for a single function.
The idea is to switch over the real function to being properly
namespaced, provide an alias under the old name in the symbol table for
binary compatibility, and make the old name a macro in the public
headers that expands to the new name so that source rebuilds against the
new library will start using the new name.  Then at some point in the
future, we drop the old name macro from the source API, forcing an
update to external sources to build against newer headers, while leaving
the alias present in the symbol table as long as we need compatibility
with existing binaries.  Thoughts?

Index: policyrep/libselinux/include/selinux/selinux.h
===================================================================
--- policyrep/libselinux/include/selinux/selinux.h	(revision 2435)
+++ policyrep/libselinux/include/selinux/selinux.h	(working copy)
@@ -16,7 +16,8 @@
 	typedef char *security_context_t;
 
 /* Free the memory allocated for a context by any of the below get* calls. */
-	extern void freecon(security_context_t con);
+	extern void selinux_freecon(security_context_t con);
+#define freecon(c) selinux_freecon(c)
 
 /* Free the memory allocated for a context array by security_compute_user. */
 	extern void freeconary(security_context_t * con);
Index: policyrep/libselinux/src/freecon.c
===================================================================
--- policyrep/libselinux/src/freecon.c	(revision 2435)
+++ policyrep/libselinux/src/freecon.c	(working copy)
@@ -3,9 +3,12 @@
 #include <stdlib.h>
 #include <errno.h>
 
-void freecon(security_context_t con)
+void selinux_freecon(security_context_t con)
 {
 	free(con);
 }
 
-hidden_def(freecon)
+asm(".symver selinux_freecon, freecon@@");
+
+hidden_def(selinux_freecon)
+
Index: policyrep/libselinux/src/selinux_internal.h
===================================================================
--- policyrep/libselinux/src/selinux_internal.h	(revision 2435)
+++ policyrep/libselinux/src/selinux_internal.h	(working copy)
@@ -24,7 +24,7 @@
     hidden_proto(security_compute_relabel_raw)
     hidden_proto(is_selinux_enabled)
     hidden_proto(is_selinux_mls_enabled)
-    hidden_proto(freecon)
+    hidden_proto(selinux_freecon)
     hidden_proto(freeconary)
     hidden_proto(getprevcon)
     hidden_proto(getprevcon_raw)

-- 
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-05-31 16:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10 20:12 [RFC][PATCH] libselinux: Namespacing Stephen Smalley
2007-05-10 20:31 ` Karl MacMillan
2007-05-11 12:37   ` Stephen Smalley
2007-05-11 18:37     ` Karl MacMillan
2007-05-29 19:17       ` Eamon Walsh
2007-05-30 14:45         ` Stephen Smalley
2007-05-31 16:27           ` Karl MacMillan
2007-05-10 22:12 ` James Antill
2007-05-11 12:42   ` Stephen Smalley
2007-05-11 12:47     ` Stephen Smalley
2007-05-11 14:39       ` James Antill

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.