selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libselinux: mark security_context_t typedef as deprecated
@ 2020-04-20 11:46 Christian Göttsche
  2020-04-26 18:14 ` Nicolas Iooss
  2020-04-30 15:03 ` [PATCH v2] " Christian Göttsche
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Göttsche @ 2020-04-20 11:46 UTC (permalink / raw)
  To: selinux

Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.")

Use a wrapper macro, because swig does not accept typedef attributes.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/include/selinux/selinux.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 6a512b38..f88a0363 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -8,13 +8,21 @@
 extern "C" {
 #endif
 
+#ifndef _selinux_deprecated
+#ifdef __GNUC__
+#define _selinux_deprecated __attribute__ ((deprecated))
+#else
+#define _selinux_deprecated
+#endif
+#endif
+
 /* Return 1 if we are running on a SELinux kernel, or 0 otherwise. */
 extern int is_selinux_enabled(void);
 /* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */
 extern int is_selinux_mls_enabled(void);
 
 /* No longer used; here for compatibility with legacy callers. */
-typedef char *security_context_t;
+typedef char *security_context_t _selinux_deprecated;
 
 /* Free the memory allocated for a context by any of the below get* calls. */
 extern void freecon(char * con);
-- 
2.26.1


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

* Re: [PATCH] libselinux: mark security_context_t typedef as deprecated
  2020-04-20 11:46 [PATCH] libselinux: mark security_context_t typedef as deprecated Christian Göttsche
@ 2020-04-26 18:14 ` Nicolas Iooss
  2020-04-27 20:09   ` Christian Göttsche
  2020-04-30 15:03 ` [PATCH v2] " Christian Göttsche
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Iooss @ 2020-04-26 18:14 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: SElinux list

On Mon, Apr 20, 2020 at 1:47 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.")
>
> Use a wrapper macro, because swig does not accept typedef attributes.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

If nobody raises an objection, I will merge the patch tomorrow.

Thanks,
Nicolas

> ---
>  libselinux/include/selinux/selinux.h | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
> index 6a512b38..f88a0363 100644
> --- a/libselinux/include/selinux/selinux.h
> +++ b/libselinux/include/selinux/selinux.h
> @@ -8,13 +8,21 @@
>  extern "C" {
>  #endif
>
> +#ifndef _selinux_deprecated
> +#ifdef __GNUC__
> +#define _selinux_deprecated __attribute__ ((deprecated))
> +#else
> +#define _selinux_deprecated
> +#endif
> +#endif
> +
>  /* Return 1 if we are running on a SELinux kernel, or 0 otherwise. */
>  extern int is_selinux_enabled(void);
>  /* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */
>  extern int is_selinux_mls_enabled(void);
>
>  /* No longer used; here for compatibility with legacy callers. */
> -typedef char *security_context_t;
> +typedef char *security_context_t _selinux_deprecated;
>
>  /* Free the memory allocated for a context by any of the below get* calls. */
>  extern void freecon(char * con);
> --
> 2.26.1
>


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

* Re: [PATCH] libselinux: mark security_context_t typedef as deprecated
  2020-04-26 18:14 ` Nicolas Iooss
@ 2020-04-27 20:09   ` Christian Göttsche
  2020-04-27 20:31     ` William Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Göttsche @ 2020-04-27 20:09 UTC (permalink / raw)
  To: Nicolas Iooss; +Cc: SElinux list

Am So., 26. Apr. 2020 um 20:14 Uhr schrieb Nicolas Iooss
<nicolas.iooss@m4x.org>:
>
> On Mon, Apr 20, 2020 at 1:47 PM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.")
> >
> > Use a wrapper macro, because swig does not accept typedef attributes.
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>
> If nobody raises an objection, I will merge the patch tomorrow.

Maybe this should be delayed after the deprecation patch series from
William Roberts to match the same style;
e.g. this patch uses a helper macro.

I'll prepare an updated patch.

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

* Re: [PATCH] libselinux: mark security_context_t typedef as deprecated
  2020-04-27 20:09   ` Christian Göttsche
@ 2020-04-27 20:31     ` William Roberts
  0 siblings, 0 replies; 7+ messages in thread
From: William Roberts @ 2020-04-27 20:31 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: Nicolas Iooss, SElinux list

On Mon, Apr 27, 2020 at 3:10 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Am So., 26. Apr. 2020 um 20:14 Uhr schrieb Nicolas Iooss
> <nicolas.iooss@m4x.org>:
> >
> > On Mon, Apr 20, 2020 at 1:47 PM Christian Göttsche
> > <cgzones@googlemail.com> wrote:
> > >
> > > Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.")
> > >
> > > Use a wrapper macro, because swig does not accept typedef attributes.
> > >
> > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> >
> > Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> >
> > If nobody raises an objection, I will merge the patch tomorrow.
>
> Maybe this should be delayed after the deprecation patch series from
> William Roberts to match the same style;
> e.g. this patch uses a helper macro.
>
> I'll prepare an updated patch.

I was just about to look at this and suggest the same thing. I didn't
put a macro like this in selinux.h for the simple
reason that I didn't want to make it something considered public API.
I avoided if SWIG, since its really
a gnuc extension that most compilers support, and its inline with the
other extensions that get buy the
SWIG build.

I would nack it for those two reasons.

I just sent V4 of the series, so hopefully that one sticks. If you
wan't you can update the style now and resubmit. As we can merge
it in parallel to my series (there is no hard dependency), so you
don't have to wait for my series to land.

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

* [PATCH v2] libselinux: mark security_context_t typedef as deprecated
  2020-04-20 11:46 [PATCH] libselinux: mark security_context_t typedef as deprecated Christian Göttsche
  2020-04-26 18:14 ` Nicolas Iooss
@ 2020-04-30 15:03 ` Christian Göttsche
  2020-04-30 15:31   ` Roberts, William C
  1 sibling, 1 reply; 7+ messages in thread
From: Christian Göttsche @ 2020-04-30 15:03 UTC (permalink / raw)
  To: selinux

Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.")

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v2: use the common deprecation style

 libselinux/include/selinux/selinux.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index aaf28ffd..c22834e5 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -14,7 +14,11 @@ extern int is_selinux_enabled(void);
 extern int is_selinux_mls_enabled(void);
 
 /* No longer used; here for compatibility with legacy callers. */
-typedef char *security_context_t;
+typedef char *security_context_t
+#ifdef __GNUC__
+__attribute__ ((deprecated))
+#endif
+;
 
 /* Free the memory allocated for a context by any of the below get* calls. */
 extern void freecon(char * con);
-- 
2.26.2


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

* RE: [PATCH v2] libselinux: mark security_context_t typedef as deprecated
  2020-04-30 15:03 ` [PATCH v2] " Christian Göttsche
@ 2020-04-30 15:31   ` Roberts, William C
  2020-05-01 15:48     ` William Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Roberts, William C @ 2020-04-30 15:31 UTC (permalink / raw)
  To: Christian Göttsche, selinux

> -----Original Message-----
> From: selinux-owner@vger.kernel.org [mailto:selinux-owner@vger.kernel.org]
> On Behalf Of Christian Göttsche
> Sent: Thursday, April 30, 2020 10:03 AM
> To: selinux@vger.kernel.org
> Subject: [PATCH v2] libselinux: mark security_context_t typedef as deprecated
> 
> Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of
> security_context_t and fix const declarations.")
> 
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
> v2: use the common deprecation style
> 
>  libselinux/include/selinux/selinux.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libselinux/include/selinux/selinux.h
> b/libselinux/include/selinux/selinux.h
> index aaf28ffd..c22834e5 100644
> --- a/libselinux/include/selinux/selinux.h
> +++ b/libselinux/include/selinux/selinux.h
> @@ -14,7 +14,11 @@ extern int is_selinux_enabled(void);  extern int
> is_selinux_mls_enabled(void);
> 
>  /* No longer used; here for compatibility with legacy callers. */ -typedef char
> *security_context_t;
> +typedef char *security_context_t
> +#ifdef __GNUC__
> +__attribute__ ((deprecated))
> +#endif
> +;
> 
>  /* Free the memory allocated for a context by any of the below get* calls. */
> extern void freecon(char * con);
> --
> 2.26.2

Acked-by: William Roberts <william.c.roberts@intel.com>

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

* Re: [PATCH v2] libselinux: mark security_context_t typedef as deprecated
  2020-04-30 15:31   ` Roberts, William C
@ 2020-05-01 15:48     ` William Roberts
  0 siblings, 0 replies; 7+ messages in thread
From: William Roberts @ 2020-05-01 15:48 UTC (permalink / raw)
  To: Roberts, William C; +Cc: Christian Göttsche, selinux

> > -----Original Message-----
> > From: selinux-owner@vger.kernel.org [mailto:selinux-owner@vger.kernel.org]
> > On Behalf Of Christian Göttsche
> > Sent: Thursday, April 30, 2020 10:03 AM
> > To: selinux@vger.kernel.org
> > Subject: [PATCH v2] libselinux: mark security_context_t typedef as deprecated
> >
> > Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of
> > security_context_t and fix const declarations.")
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> > ---
> > v2: use the common deprecation style
> >
> >  libselinux/include/selinux/selinux.h | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/libselinux/include/selinux/selinux.h
> > b/libselinux/include/selinux/selinux.h
> > index aaf28ffd..c22834e5 100644
> > --- a/libselinux/include/selinux/selinux.h
> > +++ b/libselinux/include/selinux/selinux.h
> > @@ -14,7 +14,11 @@ extern int is_selinux_enabled(void);  extern int
> > is_selinux_mls_enabled(void);
> >
> >  /* No longer used; here for compatibility with legacy callers. */ -typedef char
> > *security_context_t;
> > +typedef char *security_context_t
> > +#ifdef __GNUC__
> > +__attribute__ ((deprecated))
> > +#endif
> > +;
> >
> >  /* Free the memory allocated for a context by any of the below get* calls. */
> > extern void freecon(char * con);
> > --
> > 2.26.2
>
> Acked-by: William Roberts <william.c.roberts@intel.com>

Merged:
https://github.com/SELinuxProject/selinux/pull/233

Thanks

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

end of thread, other threads:[~2020-05-01 15:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 11:46 [PATCH] libselinux: mark security_context_t typedef as deprecated Christian Göttsche
2020-04-26 18:14 ` Nicolas Iooss
2020-04-27 20:09   ` Christian Göttsche
2020-04-27 20:31     ` William Roberts
2020-04-30 15:03 ` [PATCH v2] " Christian Göttsche
2020-04-30 15:31   ` Roberts, William C
2020-05-01 15:48     ` William Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).