Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1477995348.2236.14.camel@cvidal.org>
Date: Tue, 01 Nov 2016 11:15:48 +0100
From: Colin Vidal <colin@...dal.org>
To: kernel-hardening@...ts.openwall.com
Cc: keescook@...omium.org, arnd@...db.de, tglx@...utronix.de,
 mingo@...hat.com,  h.peter.anvin@...el.com, Elena Reshetova
 <elena.reshetova@...el.com>, Hans Liljestrand <ishkamiel@...il.com>, David
 Windsor <dwindsor@...il.com>
Subject: Re: [RFC v3 PATCH 01/13] Add architecture
 independent hardened atomic base

<snip>
>  arch/alpha/include/asm/local.h             |   2 +
>  arch/m32r/include/asm/local.h              |   2 +
>  arch/mips/include/asm/local.h              |   2 +
>  arch/powerpc/include/asm/local.h           |   2 +
>  arch/x86/include/asm/local.h               |   2 +
<snip>
>  include/asm-generic/local.h                |  20 +++
>  include/asm-generic/local_wrap.h           |  89 ++++++++++
<snip>
> diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
> index 9ceb03b..e1c81c3 100644
> --- a/include/asm-generic/local.h
> +++ b/include/asm-generic/local.h
> @@ -4,6 +4,7 @@
>  #include <linux/percpu.h>
>  #include <linux/atomic.h>
>  #include <asm/types.h>
> +#include <asm-generic/local_wrap.h>

That brake build for any architecture that uses asm-generic/local.h
(like ARM v6/v7): asm-generic/local_wrap.h contains

    typedef local_t local_wrap_t

but at this time, local_t is not yet defined, since asm-
generic/local_wrap.h is included before the definition of local_t. The
following patch fixes that.

Thanks

Colin


diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index e1c81c3..1828c57 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -4,7 +4,6 @@
 #include <linux/percpu.h>
 #include <linux/atomic.h>
 #include <asm/types.h>
-#include <asm-generic/local_wrap.h>
 
 /*
  * A signed long type for operations which are atomic for a single CPU.
@@ -48,23 +47,6 @@ typedef struct
 #define local_add_unless(l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))
 #define local_inc_not_zero(l) atomic_long_inc_not_zero(&(l)->a)
 
-#define local_read_wrap(l)             atomic_long_read_wrap(&(l)->a)
-#define local_set_wrap(l,i)            atomic_long_set_wrap((&(l)->a),(i))
-#define local_inc_wrap(l)              atomic_long_inc_wrap(&(l)->a)
-#define local_inc_return_wrap(l)       atomic_long_return_wrap(&(l)->a)
-#define local_inc_and_test_wrap(l)     atomic_long_inc_and_test_wrap(&(l)->a)
-#define local_dec_wrap(l)              atomic_long_dec_wrap(&(l)->a)
-#define local_dec_return_wrap(l)       atomic_long_dec_return_wrap(&(l)->a)
-#define local_dec_and_test_wrap(l)     atomic_long_dec_and_test_wrap(&(l)->a)
-#define local_add_wrap(i,l)            atomic_long_add_wrap((i),(&(l)->a))
-#define local_add_return_wrap(i, l)    atomic_long_add_return_wrap((i), (&(l)->a))
-#define local_sub_wrap(i,l)            atomic_long_sub_wrap((i),(&(l)->a))
-#define local_sub_return_wrap(i, l)    atomic_long_sub_return_wrap((i), (&(l)->a))
-#define local_sub_and_test_wrap(i, l)  atomic_long_sub_and_test_wrap((i), (&(l)->a))
-#define local_cmpxchg_wrap(l, o, n)    atomic_long_cmpxchg_wrap((&(l)->a), (o), (n))
-#define local_add_unless_wrap(l, _a, u) atomic_long_add_unless_wrap((&(l)->a), (_a), (u))
-#define local_add_negative_wrap(i, l)  atomic_long_add_negative_wrap((i), (&(l)->a))
-
 /* Non-atomic variants, ie. preemption disabled and won't be touched
  * in interrupt, etc.  Some archs can optimize this case well. */
 #define __local_inc(l)         local_set((l), local_read(l) + 1)
@@ -72,4 +54,6 @@ typedef struct
 #define __local_add(i,l)       local_set((l), local_read(l) + (i))
 #define __local_sub(i,l)       local_set((l), local_read(l) - (i))
 
+#include <asm-generic/local_wrap.h>
+
 #endif /* _ASM_GENERIC_LOCAL_H */

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.