All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Vidal <colin@cvidal.org>
To: kernel-hardening@lists.openwall.com
Cc: keescook@chromium.org, arnd@arndb.de, tglx@linutronix.de,
	mingo@redhat.com, h.peter.anvin@intel.com,
	Elena Reshetova <elena.reshetova@intel.com>,
	Hans Liljestrand <ishkamiel@gmail.com>,
	David Windsor <dwindsor@gmail.com>
Subject: Re: [kernel-hardening] [RFC v3 PATCH 01/13] Add architecture independent hardened atomic base
Date: Tue, 01 Nov 2016 11:42:52 +0100	[thread overview]
Message-ID: <1477996972.2236.19.camel@cvidal.org> (raw)
In-Reply-To: <1477914225-11298-2-git-send-email-elena.reshetova@intel.com>

Elena,

> diff --git a/include/asm-generic/atomic-long.h b/include/asm-generic/atomic-long.h
<snip>
> +#ifndef CONFIG_HARDENED_ATOMIC
> +#ifndef atomic_read_wrap
> +#define atomic_read_wrap(v) atomic_read(v)
> +#endif /* atomic_read_wrap */
> +#ifndef atomic_set_wrap
> +#define atomic_set_wrap(v, i) atomic_set((v), (i))
> +#endif /* atomic_set_wrap */
> +#define atomic_add_wrap(i, v) atomic_add((i), (v))
> +#define atomic_sub_wrap(i, v) atomic_sub((i), (v))
> +#define atomic_inc_wrap(v) atomic_inc(v)
> +#define atomic_dec_wrap(v) atomic_dec(v)
> +#ifndef atomic_add_return_wrap
> +#define atomic_add_return_wrap(i, v) atomic_add_return((i), (v))
> +#endif /* atomic_add_return_wrap */
> +#ifndef atomic_sub_return_wrap
> +#define atomic_sub_return_wrap(i, v) atomic_sub_return((i), (v))
> +#endif /* atomic_sub_return_wrap */
> +#define atoimc_dec_return_wrap(v) atomic_dec_return(v)
> +#ifndef atomic_inc_return_wrap
> +#define atomic_inc_return_wrap(v) atomic_inc_return(v)
> +#endif /* atomic_inc_return */
> +#ifndef atomic_dec_and_test_wrap
> +#define atomic_dec_and_test_wrap(v) atomic_dec_and_test(v)
> +#endif /* atomic_dec_and_test_wrap */
> +#ifndef atomic_inc_and_test_wrap
> +#define atomic_inc_and_test_wrap(v) atomic_inc_and_test(v)
> +#endif /* atomic_inc_and_test_wrap */
> +#define atomic_sub_and_test_wrap(i, v) atomic_sub_and_test((v), (i))
> +#ifndef atomic_xchg_wrap
> +#define atomic_xchg_wrap(v, i) atomic_xchg((v), (i))
> +#endif /*  atomic_xchg_wrap(v, i) */
> +#ifndef atomic_cmpxchg_wrap
> +#define atomic_cmpxchg_wrap(v, o, n) atomic_cmpxchg((v), (o), (n))
> +#endif /* atomic_cmpxchg_wrap */
> +#define atomic_add_negative_wrap(i, v) atomic_add_negative((i), (v))
> +#define atomic_add_unless_wrap(v, i, j) atomic_add_unless((v), (i), (j))
> +#endif /* CONFIG_HARDENED_ATOMIC */
> +
>  #endif  /*  _ASM_GENERIC_ATOMIC_LONG_H  */
> 

It seems there are two missing guard here. I've got redefinition errors
on ARM (without my prototypes of arm generic atomic64 and arm hardened
atomic patches).

Thanks

Colin

diff --git a/include/asm-generic/atomic-long.h b/include/asm-
generic/atomic-long.h
index 60eb9e0..131f637 100644
--- a/include/asm-generic/atomic-long.h
+++ b/include/asm-generic/atomic-long.h
@@ -400,14 +400,18 @@ static inline long
atomic_long_add_unless_wrap(atomic_long_wrap_t *l, long a, lo
 #ifndef atomic_inc_and_test_wrap
 #define atomic_inc_and_test_wrap(v) atomic_inc_and_test(v)
 #endif /* atomic_inc_and_test_wrap */
+#ifndef atomic_sub_and_test_wrap
 #define atomic_sub_and_test_wrap(i, v) atomic_sub_and_test((v), (i))
+#endif /* atomic_sub_and_test_wrap */
 #ifndef atomic_xchg_wrap
 #define atomic_xchg_wrap(v, i) atomic_xchg((v), (i))
 #endif /*  atomic_xchg_wrap(v, i) */
 #ifndef atomic_cmpxchg_wrap
 #define atomic_cmpxchg_wrap(v, o, n) atomic_cmpxchg((v), (o), (n))
 #endif /* atomic_cmpxchg_wrap */
+#ifndef atomic_add_negative_wrap
 #define atomic_add_negative_wrap(i, v) atomic_add_negative((i), (v))
+#endif /* atomic_add_negative_wrap */
 #define atomic_add_unless_wrap(v, i, j) atomic_add_unless((v), (i),
(j))
 #endif /* CONFIG_HARDENED_ATOMIC */

  parent reply	other threads:[~2016-11-01 10:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 11:43 [kernel-hardening] [RFC v3 PATCH 00/13] HARDENING_ATOMIC feature Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 01/13] Add architecture independent hardened atomic base Elena Reshetova
2016-11-01  9:44   ` Colin Vidal
2016-11-01 10:59     ` Reshetova, Elena
2016-11-01 11:35       ` Hans Liljestrand
2016-11-01 13:57         ` Kees Cook
2016-11-02  4:55           ` Reshetova, Elena
2016-11-02 21:23           ` Hans Liljestrand
2016-11-01 10:15   ` Colin Vidal
2016-11-01 10:55     ` Reshetova, Elena
2016-11-01 10:42   ` Colin Vidal [this message]
2016-11-01 11:02     ` Reshetova, Elena
2016-11-01 11:53   ` Colin Vidal
2016-11-01 12:15     ` Reshetova, Elena
2016-11-01 12:55       ` Hans Liljestrand
2016-11-01 17:21         ` Colin Vidal
2016-11-02  4:51           ` Reshetova, Elena
2016-11-02  6:55       ` AKASHI Takahiro
2016-11-04  7:04         ` Reshetova, Elena
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 02/13] percpu-refcount: leave atomic counter unprotected Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 03/13] kernel: identify wrapping atomic usage Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 04/13] mm: " Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 05/13] fs: " Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 06/13] net: " Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 07/13] net: atm: " Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 08/13] security: " Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 09/13] drivers: identify wrapping atomic usage (part 1/2) Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 10/13] drivers: identify wrapping atomic usage (part 2/2) Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 11/13] x86: identify wrapping atomic usage Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 12/13] x86: implementation for HARDENED_ATOMIC Elena Reshetova
2016-10-31 11:43 ` [kernel-hardening] [RFC v3 PATCH 13/13] lkdtm: add tests for atomic over-/underflow Elena Reshetova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477996972.2236.19.camel@cvidal.org \
    --to=colin@cvidal.org \
    --cc=arnd@arndb.de \
    --cc=dwindsor@gmail.com \
    --cc=elena.reshetova@intel.com \
    --cc=h.peter.anvin@intel.com \
    --cc=ishkamiel@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.