Research
.
Skip Search Box

SELinux Mailing List

Re: [RFC][PATCH] libselinux: Namespacing

From: James Antill <jantill_at_redhat.com>
Date: Fri, 11 May 2007 10:39:34 -0400


On Fri, 2007-05-11 at 08:47 -0400, Stephen Smalley wrote:
> On Fri, 2007-05-11 at 08:42 -0400, Stephen Smalley wrote:

> > /* 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);
> > +#if SELINUX_COMPAT_API
> > +#define freecon(c) selinux_freecon(c)
> > +#else
> > +#error "freecon replaced by selinux_freecon; please update callers."
> > +#endif
>
> Oops, that won't work. Any way to embed an #error within a #define, so
> that we can trigger the #error only upon encountering a freecon(x)?

 Right, I was confused what you wanted for a minute there :). As for a message when freecon() is used, there's:

#define freecon(x) char freecon_is_replaced_by_selinux_freecon[-1]

..or:

#define freecon(x) selinux_namespace()

 /* in some C file somewhere */

void selinux_namespace(void)
{
  abort();
}
link_warning (selinux_namespace, "if SELINUX_COMPAT_API isn't defined the function you are looking for should be prefixed with \"selinux_\". Please update the callers.")

...where link_warning() is from glibc as:

# define link_warning(symbol, msg) \
  __make_section_unallocated (".gnu.warning." #symbol) \   static const char __evoke_link_warning_##symbol[] \     __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \

  • msg;
-- 
James Antill <jantill@redhat.com>

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

Received on Fri 11 May 2007 - 10:39:38 EDT
 

Date Posted: Jan 15, 2009 | Last Modified: Jan 15, 2009 | Last Reviewed: Jan 15, 2009

 
bottom

National Security Agency / Central Security Service