Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3743769imm; Mon, 25 Jun 2018 04:01:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ5DJ5nC9P/zzJ/C1wuwr9FEvy/sM3RnmmcyxGELdbOHfmMYYBv4ORIDBo4/BoMq7iq23/b X-Received: by 2002:a63:6e84:: with SMTP id j126-v6mr10248810pgc.450.1529924478462; Mon, 25 Jun 2018 04:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529924478; cv=none; d=google.com; s=arc-20160816; b=EjonHxZzGlZMhVHfvlQtmCNMfYFCSt4BE6wYYZHNyImksAhKxxS1SCy/Dd4BOgJ4Fy W3tpTpVLQNhi+mWV1RcCQmBAW2jUdvL0mMmQwE1BqxMu3rvUNxCH67/0l0AjpqcQtJVN SYxwYXkktVnY4aumw1sarkhmj652jIMxPqBRs+Eu1qpFUQBa7fcHznkBNcuMRdgA1Zdm nitaAMuREbnKo+euM3UnF01ENtvhj38q6KIA/RDIATHTwxSSZOVMw8rrFtLsau/i6kx+ DZWWyitiv4RqQL/BuLluM9BuxTHfpku56E55+KhAHZjfLhMFkFma9Wdax+CuHLE1guHR qPGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=c++BPB3HrA+9xcHq/OURKfpi4dpyXHXNJyqbIOibK3A=; b=Ti4XQFnXeR9r8bCmZ746bWtqsuD9rss6uaKgHyEoqOq5DnEIhzMEsMhmZEQVm13Wj6 xLZKxvX5sxznfPkigrfCr4PUFtIQTODmXQVDU4qsBw6oVNtLs771UqKfRQ7kkOCN+7B6 P8/zGavCMTZrn13dUL0clzLIWA6A9P/lEXZCSEJRJye+vZK9Z2Of7YCyXo1VbFv8xrIg p0sdxGHcIX7C7Mk8H74QfuFLbJJulovorG4bxYwr4lAWc5YUVeBu2XAus7ALzM0Iu4Bi rufoP3yoROHG0060U71hzNjqS2zsSA2djBAMgcg3tWrhg/ItOdX6wsPvbExSRyG5vDXX j52A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3-v6si1474146pgs.172.2018.06.25.04.01.02; Mon, 25 Jun 2018 04:01:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932387AbeFYLAN (ORCPT + 99 others); Mon, 25 Jun 2018 07:00:13 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54588 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932340AbeFYLAL (ORCPT ); Mon, 25 Jun 2018 07:00:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D710322D7; Mon, 25 Jun 2018 04:00:10 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 82FE63F73D; Mon, 25 Jun 2018 04:00:09 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com Cc: Mark Rutland , Arnd Bergmann , Dmitry Vyukov Subject: [PATCHv2 05/11] atomics: instrument cmpxchg_double*() Date: Mon, 25 Jun 2018 11:59:46 +0100 Message-Id: <20180625105952.3756-6-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180625105952.3756-1-mark.rutland@arm.com> References: <20180625105952.3756-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We currently don't instrument cmpxchg_double() and cmpxchg_double_local() due to compilation issues reported in the past, which are supposedly related to GCC bug 72873 [1], reported when GCC 7 was not yet released. This bug only applies to x86-64, and not other architectures. While the test case for GCC bug 72873 triggers issues with released versions of GCC, the instrumented kernel code compiles fine for all configurations I have tried, and it is unclear how the two cases are/were related. As we can't reproduce the kernel build failures, let's instrument cmpxchg_double*() again. We can revisit the issue if build failures reappear. Signed-off-by: Mark Rutland Cc: Arnd Bergmann Cc: Boqun Feng Cc: Dmitry Vyukov Cc: Peter Zijlstra Cc: Will Deacon --- include/asm-generic/atomic-instrumented.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/include/asm-generic/atomic-instrumented.h b/include/asm-generic/atomic-instrumented.h index 53481b6eacdf..0d4b1d3dbc1e 100644 --- a/include/asm-generic/atomic-instrumented.h +++ b/include/asm-generic/atomic-instrumented.h @@ -450,23 +450,18 @@ static __always_inline bool atomic64_add_negative(s64 i, atomic64_t *v) arch_cmpxchg64_local(__ai_ptr, (old), (new)); \ }) -/* - * Originally we had the following code here: - * __typeof__(p1) ____p1 = (p1); - * kasan_check_write(____p1, 2 * sizeof(*____p1)); - * arch_cmpxchg_double(____p1, (p2), (o1), (o2), (n1), (n2)); - * But it leads to compilation failures (see gcc issue 72873). - * So for now it's left non-instrumented. - * There are few callers of cmpxchg_double(), so it's not critical. - */ #define cmpxchg_double(p1, p2, o1, o2, n1, n2) \ ({ \ - arch_cmpxchg_double((p1), (p2), (o1), (o2), (n1), (n2)); \ + typeof(p1) __ai_p1 = (p1); \ + kasan_check_write(__ai_p1, 2 * sizeof(*__ai_p1)); \ + arch_cmpxchg_double(__ai_p1, (p2), (o1), (o2), (n1), (n2)); \ }) -#define cmpxchg_double_local(p1, p2, o1, o2, n1, n2) \ -({ \ - arch_cmpxchg_double_local((p1), (p2), (o1), (o2), (n1), (n2)); \ +#define cmpxchg_double_local(p1, p2, o1, o2, n1, n2) \ +({ \ + typeof(p1) __ai_p1 = (p1); \ + kasan_check_write(__ai_p1, 2 * sizeof(*__ai_p1)); \ + arch_cmpxchg_double_local(__ai_p1, (p2), (o1), (o2), (n1), (n2)); \ }) #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */ -- 2.11.0