All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compiler-intel: fix wrong compiler barrier() macro
@ 2015-04-29 14:42 Daniel Borkmann
  2015-04-29 14:51 ` Pranith Kumar
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Borkmann @ 2015-04-29 14:42 UTC (permalink / raw)
  To: hpa
  Cc: linux-kernel, Daniel Borkmann, Pranith Kumar, Ingo Molnar,
	mancha security

Cleanup commit 23ebdedc67e ("compiler-intel.h: Remove duplicate
definition") removed the double definition of __memory_barrier()
intrinsics.

However, in doing so, it also removed the preceding #undef barrier,
meaning, the actual barrier() macro from compiler-gcc.h with inline
asm is still in place when __GNUC__ is provided.

Subsequently, barrier() can never be defined as __memory_barrier()
from compiler.h since it already has a definition in place and if
we trust the comment in compiler-intel.h, ecc doesn't support gcc
specific asm statements. I don't have an ecc at hand, so a revert
of that cleanup would be the safest option, imho, as it has been
like this since pre-git times.

Fixes: 73679e508201 ("compiler-intel.h: Remove duplicate definition")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Pranith Kumar <bobby.prani@gmail.com>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: mancha security <mancha1@zoho.com>
---
 include/linux/compiler-intel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index ba147a1..5529c52 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -13,9 +13,12 @@
 /* Intel ECC compiler doesn't support gcc specific asm stmts.
  * It uses intrinsics to do the equivalent things.
  */
+#undef barrier
 #undef RELOC_HIDE
 #undef OPTIMIZER_HIDE_VAR
 
+#define barrier() __memory_barrier()
+
 #define RELOC_HIDE(ptr, off)					\
   ({ unsigned long __ptr;					\
      __ptr = (unsigned long) (ptr);				\
-- 
1.9.3


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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 14:42 [PATCH] compiler-intel: fix wrong compiler barrier() macro Daniel Borkmann
@ 2015-04-29 14:51 ` Pranith Kumar
  2015-04-29 14:59   ` mancha security
  2015-04-29 15:04   ` Daniel Borkmann
  0 siblings, 2 replies; 8+ messages in thread
From: Pranith Kumar @ 2015-04-29 14:51 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: H. Peter Anvin, LKML, Ingo Molnar, mancha security

Hi Daniel,

On Wed, Apr 29, 2015 at 10:42 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> Cleanup commit 23ebdedc67e ("compiler-intel.h: Remove duplicate
> definition") removed the double definition of __memory_barrier()
> intrinsics.
>
> However, in doing so, it also removed the preceding #undef barrier,
> meaning, the actual barrier() macro from compiler-gcc.h with inline
> asm is still in place when __GNUC__ is provided.

When you use the Intel compilers, the barrier() definition will come
from compiler.h and not compiler-gcc.h. That is what the commit
message says in 73679e508201(your commit message has the wrong hash).
I don't understand what problem you are seeing with this, can you
please explain?

Thanks!

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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 14:51 ` Pranith Kumar
@ 2015-04-29 14:59   ` mancha security
  2015-04-29 16:40     ` Pranith Kumar
  2015-04-29 15:04   ` Daniel Borkmann
  1 sibling, 1 reply; 8+ messages in thread
From: mancha security @ 2015-04-29 14:59 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: Daniel Borkmann, H. Peter Anvin, LKML, Ingo Molnar

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

On Wed, Apr 29, 2015 at 10:51:40AM -0400, Pranith Kumar wrote:
> Hi Daniel,
> 
> On Wed, Apr 29, 2015 at 10:42 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> > Cleanup commit 23ebdedc67e ("compiler-intel.h: Remove duplicate
> > definition") removed the double definition of __memory_barrier()
> > intrinsics.
> >
> > However, in doing so, it also removed the preceding #undef barrier,
> > meaning, the actual barrier() macro from compiler-gcc.h with inline
> > asm is still in place when __GNUC__ is provided.
> 
> When you use the Intel compilers, the barrier() definition will come
> from compiler.h and not compiler-gcc.h. That is what the commit
> message says in 73679e508201(your commit message has the wrong hash).
> I don't understand what problem you are seeing with this, can you
> please explain?
> 
> Thanks!

Hi Pranith.

The problem is that ICC defines __GNUC__ so barrier() gets defined
in compiler-gcc.h. Your commit removed an #undef from compiler-intel.h
so compiler.h will never define barrier to __memory_barrier().

--mancha

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 14:51 ` Pranith Kumar
  2015-04-29 14:59   ` mancha security
@ 2015-04-29 15:04   ` Daniel Borkmann
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Borkmann @ 2015-04-29 15:04 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: H. Peter Anvin, LKML, Ingo Molnar, mancha security

On 04/29/2015 04:51 PM, Pranith Kumar wrote:
...
> message says in 73679e508201(your commit message has the wrong hash).

Sorry for that, the Fixes tag actually got it right.

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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 14:59   ` mancha security
@ 2015-04-29 16:40     ` Pranith Kumar
  2015-04-29 16:59       ` Daniel Borkmann
  2015-04-30  5:58       ` mancha security
  0 siblings, 2 replies; 8+ messages in thread
From: Pranith Kumar @ 2015-04-29 16:40 UTC (permalink / raw)
  To: mancha security; +Cc: Daniel Borkmann, H. Peter Anvin, LKML, Ingo Molnar

On Wed, Apr 29, 2015 at 10:59 AM, mancha security <mancha1@zoho.com> wrote:
>
> The problem is that ICC defines __GNUC__ so barrier() gets defined
> in compiler-gcc.h. Your commit removed an #undef from compiler-intel.h
> so compiler.h will never define barrier to __memory_barrier().
>

OK, I see your point. But, ICC has support for GCC inline assembly. So
the change does not seem to be making any difference. We are using our
own asm barrier rather than the inbuilt one provided by ICC.

-- 
Pranith

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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 16:40     ` Pranith Kumar
@ 2015-04-29 16:59       ` Daniel Borkmann
  2015-04-29 17:17         ` Pranith Kumar
  2015-04-30  5:58       ` mancha security
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Borkmann @ 2015-04-29 16:59 UTC (permalink / raw)
  To: Pranith Kumar, mancha security; +Cc: H. Peter Anvin, LKML, Ingo Molnar

On 04/29/2015 06:40 PM, Pranith Kumar wrote:
> On Wed, Apr 29, 2015 at 10:59 AM, mancha security <mancha1@zoho.com> wrote:
>>
>> The problem is that ICC defines __GNUC__ so barrier() gets defined
>> in compiler-gcc.h. Your commit removed an #undef from compiler-intel.h
>> so compiler.h will never define barrier to __memory_barrier().
>
> OK, I see your point. But, ICC has support for GCC inline assembly. So
> the change does not seem to be making any difference. We are using our
> own asm barrier rather than the inbuilt one provided by ICC.

It does make a difference: gcc inline assembly is not supported by
/ecc/, see that it's wrapped within the ifdef __ECC part. I believe,
that should be for ia64 which we have under arch/, no?

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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 16:59       ` Daniel Borkmann
@ 2015-04-29 17:17         ` Pranith Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Pranith Kumar @ 2015-04-29 17:17 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: mancha security, H. Peter Anvin, LKML, Ingo Molnar

On Wed, Apr 29, 2015 at 12:59 PM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 04/29/2015 06:40 PM, Pranith Kumar wrote:
>>
>> On Wed, Apr 29, 2015 at 10:59 AM, mancha security <mancha1@zoho.com>
>> wrote:
>>>
>>>
>>> The problem is that ICC defines __GNUC__ so barrier() gets defined
>>> in compiler-gcc.h. Your commit removed an #undef from compiler-intel.h
>>> so compiler.h will never define barrier to __memory_barrier().
>>
>>
>> OK, I see your point. But, ICC has support for GCC inline assembly. So
>> the change does not seem to be making any difference. We are using our
>> own asm barrier rather than the inbuilt one provided by ICC.
>
>
> It does make a difference: gcc inline assembly is not supported by
> /ecc/, see that it's wrapped within the ifdef __ECC part. I believe,
> that should be for ia64 which we have under arch/, no?

Yes, looks like this breaks building the kernel with ecc compiler on
IA64. Has anyone tried building it with ECC on ia64 lately(or ever)?

Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>

-- 
Pranith

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

* Re: [PATCH] compiler-intel: fix wrong compiler barrier() macro
  2015-04-29 16:40     ` Pranith Kumar
  2015-04-29 16:59       ` Daniel Borkmann
@ 2015-04-30  5:58       ` mancha security
  1 sibling, 0 replies; 8+ messages in thread
From: mancha security @ 2015-04-30  5:58 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: Daniel Borkmann, H. Peter Anvin, LKML, Ingo Molnar

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

On Wed, Apr 29, 2015 at 12:40:15PM -0400, Pranith Kumar wrote:
> On Wed, Apr 29, 2015 at 10:59 AM, mancha security <mancha1@zoho.com>
> wrote:
> >
> > The problem is that ICC defines __GNUC__ so barrier() gets defined
> > in compiler-gcc.h. Your commit removed an #undef from
> > compiler-intel.h so compiler.h will never define barrier to
> > __memory_barrier().
> >
> 
> OK, I see your point. But, ICC has support for GCC inline assembly. So
> the change does not seem to be making any difference. We are using our
> own asm barrier rather than the inbuilt one provided by ICC.
> 
> -- Pranith

Yes, I misspoke earlier and meant to say ECC rather than ICC.

--mancha

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-04-30  5:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 14:42 [PATCH] compiler-intel: fix wrong compiler barrier() macro Daniel Borkmann
2015-04-29 14:51 ` Pranith Kumar
2015-04-29 14:59   ` mancha security
2015-04-29 16:40     ` Pranith Kumar
2015-04-29 16:59       ` Daniel Borkmann
2015-04-29 17:17         ` Pranith Kumar
2015-04-30  5:58       ` mancha security
2015-04-29 15:04   ` Daniel Borkmann

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.