* [PATCH] security: Use macros from compiler.h instead of gcc specific attributes @ 2014-06-11 15:55 Gideon Israel Dsouza 2014-06-11 15:55 ` [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) Gideon Israel Dsouza 0 siblings, 1 reply; 6+ messages in thread From: Gideon Israel Dsouza @ 2014-06-11 15:55 UTC (permalink / raw) To: paul, sds, eparis, akpm Cc: geert, linux-security-module, linux-kernel, Gideon Israel Dsouza NOTE: Please ignore the earlier similar emails. I apologize sincerely for the mistake. To increase compiler portability there is <linux/compiler.h> which provides convenience macros for various gcc constructs. Eg: __weak for __attribute__((weak)). I've taken up the job of cleaning these attributes all over the kernel. Currently my patches for cleanup of all files under /kernel, /block and /mm are already done and in the linux 3.15 tree. In the following patch I've replaced all aforementioned instances under the /security directory in the kernel source. Gideon Israel Dsouza (1): security: Used macros from compiler.h instead of __attribute__((...)) security/selinux/include/security.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) 2014-06-11 15:55 [PATCH] security: Use macros from compiler.h instead of gcc specific attributes Gideon Israel Dsouza @ 2014-06-11 15:55 ` Gideon Israel Dsouza 2014-06-18 18:50 ` Paul Moore 0 siblings, 1 reply; 6+ messages in thread From: Gideon Israel Dsouza @ 2014-06-11 15:55 UTC (permalink / raw) To: paul, sds, eparis, akpm Cc: geert, linux-security-module, linux-kernel, Gideon Israel Dsouza To increase compiler portability there is <linux/compiler.h> which provides convenience macros for various gcc constructs. Eg: __packed for __attribute__((packed)). This patch is part of a large task I've taken to clean the gcc specific attributes and use the the macros instead. Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com> --- security/selinux/include/security.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index ce7852c..ff19bcc 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h @@ -8,6 +8,7 @@ #ifndef _SELINUX_SECURITY_H_ #define _SELINUX_SECURITY_H_ +#include <linux/compiler.h> #include <linux/dcache.h> #include <linux/magic.h> #include <linux/types.h> @@ -220,7 +221,7 @@ struct selinux_kernel_status { /* * The version > 0 supports above members. */ -} __attribute__((packed)); +} __packed; extern void selinux_status_update_setenforce(int enforcing); extern void selinux_status_update_policyload(int seqno); -- 1.9.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) 2014-06-11 15:55 ` [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) Gideon Israel Dsouza @ 2014-06-18 18:50 ` Paul Moore 2014-06-18 20:08 ` Geert Uytterhoeven 0 siblings, 1 reply; 6+ messages in thread From: Paul Moore @ 2014-06-18 18:50 UTC (permalink / raw) To: Gideon Israel Dsouza Cc: sds, eparis, akpm, geert, linux-security-module, linux-kernel On Wednesday, June 11, 2014 09:25:30 PM Gideon Israel Dsouza wrote: > To increase compiler portability there is <linux/compiler.h> which > provides convenience macros for various gcc constructs. Eg: __packed > for __attribute__((packed)). > > This patch is part of a large task I've taken to clean the gcc > specific attributes and use the the macros instead. > > Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com> > --- > security/selinux/include/security.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >From what I can tell this should still work with both the LLVM and Intel compilers, is that correct? > diff --git a/security/selinux/include/security.h > b/security/selinux/include/security.h index ce7852c..ff19bcc 100644 > --- a/security/selinux/include/security.h > +++ b/security/selinux/include/security.h > @@ -8,6 +8,7 @@ > #ifndef _SELINUX_SECURITY_H_ > #define _SELINUX_SECURITY_H_ > > +#include <linux/compiler.h> > #include <linux/dcache.h> > #include <linux/magic.h> > #include <linux/types.h> > @@ -220,7 +221,7 @@ struct selinux_kernel_status { > /* > * The version > 0 supports above members. > */ > -} __attribute__((packed)); > +} __packed; > > extern void selinux_status_update_setenforce(int enforcing); > extern void selinux_status_update_policyload(int seqno); -- paul moore www.paul-moore.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) 2014-06-18 18:50 ` Paul Moore @ 2014-06-18 20:08 ` Geert Uytterhoeven 2014-06-18 20:58 ` Paul Moore 0 siblings, 1 reply; 6+ messages in thread From: Geert Uytterhoeven @ 2014-06-18 20:08 UTC (permalink / raw) To: Paul Moore Cc: Gideon Israel Dsouza, sds, Eric Paris, Andrew Morton, linux-security-module, linux-kernel@vger.kernel.org On Wed, Jun 18, 2014 at 8:50 PM, Paul Moore <paul@paul-moore.com> wrote: > On Wednesday, June 11, 2014 09:25:30 PM Gideon Israel Dsouza wrote: >> To increase compiler portability there is <linux/compiler.h> which >> provides convenience macros for various gcc constructs. Eg: __packed >> for __attribute__((packed)). >> >> This patch is part of a large task I've taken to clean the gcc >> specific attributes and use the the macros instead. >> >> Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com> >> --- >> security/selinux/include/security.h | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) > > From what I can tell this should still work with both the LLVM and Intel > compilers, is that correct? That's the idea of the compiler-agnostic attribute macros. Interestingly, only include/linux/compiler-gcc.h defines __packed. As it's already in heavy use, I can only assume both LLVM and the Intel compilers handle both "__packed" (without a special definition) and the gcc-specific "__attribute__((packed))". Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) 2014-06-18 20:08 ` Geert Uytterhoeven @ 2014-06-18 20:58 ` Paul Moore 2014-06-26 11:45 ` Gideon D'souza 0 siblings, 1 reply; 6+ messages in thread From: Paul Moore @ 2014-06-18 20:58 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Gideon Israel Dsouza, sds, Eric Paris, Andrew Morton, linux-security-module, linux-kernel@vger.kernel.org On Wednesday, June 18, 2014 10:08:13 PM Geert Uytterhoeven wrote: > On Wed, Jun 18, 2014 at 8:50 PM, Paul Moore <paul@paul-moore.com> wrote: > > On Wednesday, June 11, 2014 09:25:30 PM Gideon Israel Dsouza wrote: > >> To increase compiler portability there is <linux/compiler.h> which > >> provides convenience macros for various gcc constructs. Eg: __packed > >> for __attribute__((packed)). > >> > >> This patch is part of a large task I've taken to clean the gcc > >> specific attributes and use the the macros instead. > >> > >> Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com> > >> --- > >> > >> security/selinux/include/security.h | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > > > > From what I can tell this should still work with both the LLVM and Intel > > compilers, is that correct? > > That's the idea of the compiler-agnostic attribute macros. I just wanted to make sure as I personally only really use gcc and don't pretend to be up on all the details regarding other compilers. > Interestingly, only include/linux/compiler-gcc.h defines __packed. >From what I could tell by looking at the code, the other compilers all define __GNUC__ so they get the __packed macro as part of the gcc configuration. I believe the LLVM and Intel compilers would only need to redefine __packed if they wanted/needed a different definition. > As it's already in heavy use, I can only assume both LLVM and the Intel > compilers handle both "__packed" (without a special definition) and the > gcc-specific "__attribute__((packed))". Yep, seems reasonable. I'll go ahead and apply the patch. -- paul moore www.paul-moore.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) 2014-06-18 20:58 ` Paul Moore @ 2014-06-26 11:45 ` Gideon D'souza 0 siblings, 0 replies; 6+ messages in thread From: Gideon D'souza @ 2014-06-26 11:45 UTC (permalink / raw) To: Paul Moore Cc: Geert Uytterhoeven, sds, Eric Paris, Andrew Morton, linux-security-module, linux-kernel@vger.kernel.org Hey Paul and Geert, Sorry I didn't response quick enough, I was out of town on a trip. Just got back. Didn't even think of LLVM honestly but that is an excellent point and I'll try compiling with it. Paul, thanks for applying my patch. Regards, Gideon On Thu, Jun 19, 2014 at 2:28 AM, Paul Moore <paul@paul-moore.com> wrote: > On Wednesday, June 18, 2014 10:08:13 PM Geert Uytterhoeven wrote: >> On Wed, Jun 18, 2014 at 8:50 PM, Paul Moore <paul@paul-moore.com> wrote: >> > On Wednesday, June 11, 2014 09:25:30 PM Gideon Israel Dsouza wrote: >> >> To increase compiler portability there is <linux/compiler.h> which >> >> provides convenience macros for various gcc constructs. Eg: __packed >> >> for __attribute__((packed)). >> >> >> >> This patch is part of a large task I've taken to clean the gcc >> >> specific attributes and use the the macros instead. >> >> >> >> Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com> >> >> --- >> >> >> >> security/selinux/include/security.h | 3 ++- >> >> 1 file changed, 2 insertions(+), 1 deletion(-) >> > >> > From what I can tell this should still work with both the LLVM and Intel >> > compilers, is that correct? >> >> That's the idea of the compiler-agnostic attribute macros. > > I just wanted to make sure as I personally only really use gcc and don't > pretend to be up on all the details regarding other compilers. > >> Interestingly, only include/linux/compiler-gcc.h defines __packed. > > From what I could tell by looking at the code, the other compilers all define > __GNUC__ so they get the __packed macro as part of the gcc configuration. I > believe the LLVM and Intel compilers would only need to redefine __packed if > they wanted/needed a different definition. > >> As it's already in heavy use, I can only assume both LLVM and the Intel >> compilers handle both "__packed" (without a special definition) and the >> gcc-specific "__attribute__((packed))". > > Yep, seems reasonable. I'll go ahead and apply the patch. > > -- > paul moore > www.paul-moore.com > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-26 11:45 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-06-11 15:55 [PATCH] security: Use macros from compiler.h instead of gcc specific attributes Gideon Israel Dsouza 2014-06-11 15:55 ` [PATCH 1/1] security: Used macros from compiler.h instead of __attribute__((...)) Gideon Israel Dsouza 2014-06-18 18:50 ` Paul Moore 2014-06-18 20:08 ` Geert Uytterhoeven 2014-06-18 20:58 ` Paul Moore 2014-06-26 11:45 ` Gideon D'souza
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox