From patchwork Tue Nov 1 10:42:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Colin Vidal X-Patchwork-Id: 9407137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5699060585 for ; Tue, 1 Nov 2016 10:43:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6175A297C7 for ; Tue, 1 Nov 2016 10:43:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5331A297CA; Tue, 1 Nov 2016 10:43:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id D1DB3297C7 for ; Tue, 1 Nov 2016 10:43:19 +0000 (UTC) Received: (qmail 15800 invoked by uid 550); 1 Nov 2016 10:43:18 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 15767 invoked from network); 1 Nov 2016 10:43:17 -0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cvidal.org; h= x-me-sender:x-sasl-enc:message-id:subject:from:to:cc:date :in-reply-to:references:content-type:mime-version :content-transfer-encoding; s=mesmtp; bh=PNiDOAsoP4xLJrwHHn4c8mN J060=; b=mnGX55ZdynmhW5VxkBJUCOH12tm3Gb3WHlt94RUHdwEtso3VcHdJtBH lbQ91UgEbN3ECkkhwot3vJdVNXYoJuVF6x8Zi4McebxW7aVwtY/NipYZhLviiui4 lsPf8jtR2yxuiz125CQvk5CiVt02lH8KkYUGkW+3wPAF++No5ht8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-me-sender:x-sasl-enc:message-id:subject :from:to:cc:date:in-reply-to:references:content-type :mime-version:content-transfer-encoding; s=smtpout; bh=PNiDOAsoP 4xLJrwHHn4c8mNJ060=; b=qnthMDEiNgUTD9NL8UpaGhZQaqS7EK+Kz8Uzf8Ztw m8AJ94tfQOvBebYkDjimjc9d0jeFy24sXSDoJq2dzbvBmfIM0Ez8BXzKXJ4KPBpc R9eMYeT+GwxpSdbZf5se/R8ya+Tkz2avWomXyfOhRCJsECUcxwwV0tYSRDMUHAEy 2s= X-ME-Sender: X-Sasl-enc: 0HbKMowYjxX0yQlmlZ/fh8vZFLRUOwpzYZM3IhX32IJy 1477996985 Message-ID: <1477996972.2236.19.camel@cvidal.org> From: Colin Vidal 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 , Hans Liljestrand , David Windsor Date: Tue, 01 Nov 2016 11:42:52 +0100 In-Reply-To: <1477914225-11298-2-git-send-email-elena.reshetova@intel.com> References: <1477914225-11298-1-git-send-email-elena.reshetova@intel.com> <1477914225-11298-2-git-send-email-elena.reshetova@intel.com> X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Subject: Re: [kernel-hardening] [RFC v3 PATCH 01/13] Add architecture independent hardened atomic base X-Virus-Scanned: ClamAV using ClamSMTP Elena, > diff --git a/include/asm-generic/atomic-long.h b/include/asm-generic/atomic-long.h > +#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  #endif /* CONFIG_HARDENED_ATOMIC */ 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))