From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDC80C76188 for ; Tue, 16 Jul 2019 04:08:15 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 1D59A21738 for ; Tue, 16 Jul 2019 04:08:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="Kq0teeTe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D59A21738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-16473-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 24169 invoked by uid 550); 16 Jul 2019 04:08:09 -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: Received: (qmail 24148 invoked from network); 16 Jul 2019 04:08:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rmC6wxi5sfJ1hgZ1T5d4GnYkV6yYjgLN1LSLJD9G/N4=; b=Kq0teeTexfzjIuo8X5x7eq1y/4O5B2Bmjf3Fma8qxHKz570TnWd5F41ARTOX+ZB9o5 ZrA8d8qX6imHshG3/BIhlS9G3/USuQssQxWSRVgYqXyJ69AtXg6PA4i/A/poj8yG+f0m jjDlhK3uHe61XmDCNPq7CEmNnt62VWeTQWFEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rmC6wxi5sfJ1hgZ1T5d4GnYkV6yYjgLN1LSLJD9G/N4=; b=stlfl/G2tH3daIUZkeVvhKcqxSga75WwvR+igWg55fmw9RfnetE11awC/oxe8SXBT2 pJ5R09OcvJiix448qpFFmc4UlVhlfqrbF9FE5wjnwJa2tRP7FerafujHDY06qaACVRRT NbEJdI73XBJ9Uo+RaFMG6XGSacf3Aa2jUH3j41F4S9kR/zQPQ/tO+Sc12/smrOhGNrih PBgVPEcf/C0wKE6TB3Tq+gjD24LsO2drLQziXWrhFN+aIUH6iAX6fvBLuRGUD1l48JkJ RkZJBG7Ch01cJ+970fWNUAyFfW2d7h+8+7nQP/+cvxuUEzxmfxo5txvl7HRbPY8RG7/g hbkg== X-Gm-Message-State: APjAAAUd4o9JnfOOg8QEH4GjqOgEkdQc7XOSR1kcBbvYCfY84hdzlGur E7Z0X+Lo+LlDJ4Gbnb18VAw= X-Google-Smtp-Source: APXvYqzgpmFKYjtDybWIlQwIoYF/PfoRh5ad2Zk33yjjz2GZk9FWUyWvHOfYTa/TTjzB9GZPuRionw== X-Received: by 2002:a63:9249:: with SMTP id s9mr29860119pgn.356.1563250076442; Mon, 15 Jul 2019 21:07:56 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Paul McKenney , Alexey Kuznetsov , Bjorn Helgaas , Borislav Petkov , c0d1n61at3@gmail.com, "David S. Miller" , edumazet@google.com, Greg Kroah-Hartman , Hideaki YOSHIFUJI , "H. Peter Anvin" , Ingo Molnar , Jonathan Corbet , Josh Triplett , keescook@chromium.org, kernel-hardening@lists.openwall.com, kernel-team@android.com, Lai Jiangshan , Len Brown , linux-acpi@vger.kernel.org, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, Mathieu Desnoyers , neilb@suse.com, netdev@vger.kernel.org, Oleg Nesterov , "Paul E. McKenney" , Pavel Machek , peterz@infradead.org, "Rafael J. Wysocki" , Rasmus Villemoes , rcu@vger.kernel.org, Steven Rostedt , Tejun Heo , Thomas Gleixner , will@kernel.org, x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH] rculist: Add build check for single optional list argument Date: Tue, 16 Jul 2019 00:07:43 -0400 Message-Id: <20190716040743.78343-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In a previous patch series [1], we added an optional lockdep expression argument to list_for_each_entry_rcu() and the hlist equivalent. This also meant more than one optional argument can be passed to them with that error going unnoticed. To fix this, let us force a compiler error more than one optional argument is passed. [1] https://lore.kernel.org/patchwork/project/lkml/list/?series=402150 Suggested-by: Paul McKenney Signed-off-by: Joel Fernandes (Google) --- include/linux/rculist.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 1048160625bb..86659f6d72dc 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -44,14 +44,18 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) * Check during list traversal that we are within an RCU reader */ +#define check_arg_count_one(dummy) + #ifdef CONFIG_PROVE_RCU_LIST -#define __list_check_rcu(dummy, cond, ...) \ +#define __list_check_rcu(dummy, cond, extra...) \ ({ \ + check_arg_count_one(extra); \ RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(), \ "RCU-list traversed in non-reader section!"); \ }) #else -#define __list_check_rcu(dummy, cond, ...) ({}) +#define __list_check_rcu(dummy, cond, extra...) \ + ({ check_arg_count_one(extra); }) #endif /* -- 2.22.0.510.g264f2c817a-goog