From patchwork Tue Mar 24 15:36:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 11455795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 838BC6CA for ; Tue, 24 Mar 2020 15:37:22 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id E06862080C for ; Tue, 24 Mar 2020 15:37:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="g5YPnlnl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E06862080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-18159-patchwork-kernel-hardening=patchwork.kernel.org@lists.openwall.com Received: (qmail 24232 invoked by uid 550); 24 Mar 2020 15:37:08 -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: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 24128 invoked from network); 24 Mar 2020 15:37:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585064216; bh=neEUpG858SvJc0NfbvvctYu868B2urEcRa1OZnEdi/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5YPnlnldLX5FxEmCV5nU6OMxrr4aQRvL63Qf/IymntooM+N8SKCiS315iO4HYjLS OSzRmaE590qXuylBXKE8gVCA5Jq25Oq6QiB5CSl7fB4nqiXo+JVZM5bCw8OL+TYUfr xw+cubwn5lk1k1QcAZQqIPrJzxXq/tib0vsm0DRQ= From: Will Deacon To: linux-kernel@vger.kernel.org Cc: Will Deacon , Eric Dumazet , Jann Horn , Kees Cook , Maddie Stone , Marco Elver , "Paul E . McKenney" , Peter Zijlstra , Thomas Gleixner , kernel-team@android.com, kernel-hardening@lists.openwall.com Subject: [RFC PATCH 02/21] list: Remove hlist_nulls_unhashed_lockless() Date: Tue, 24 Mar 2020 15:36:24 +0000 Message-Id: <20200324153643.15527-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324153643.15527-1-will@kernel.org> References: <20200324153643.15527-1-will@kernel.org> MIME-Version: 1.0 Commit 02b99b38f3d9 ("rcu: Add a hlist_nulls_unhashed_lockless() function") introduced the (as yet unused) hlist_nulls_unhashed_lockless() function to avoid KCSAN reports when an RCU reader checks the 'hashed' status of an 'hlist_nulls' concurrently undergoing modification. Remove the unused function and add a READ_ONCE() to hlist_nulls_unhashed(), just like we do already for hlist_nulls_empty(). Cc: Paul E. McKenney Cc: Peter Zijlstra Signed-off-by: Will Deacon Reviewed-by: Greg Kroah-Hartman Acked-by: Paul E. McKenney --- include/linux/list_nulls.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h index fa6e8471bd22..3a9ff01e9a11 100644 --- a/include/linux/list_nulls.h +++ b/include/linux/list_nulls.h @@ -65,20 +65,6 @@ static inline unsigned long get_nulls_value(const struct hlist_nulls_node *ptr) * but hlist_nulls_del() does not. */ static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h) -{ - return !h->pprev; -} - -/** - * hlist_nulls_unhashed_lockless - Has node been removed and reinitialized? - * @h: Node to be checked - * - * Not that not all removal functions will leave a node in unhashed state. - * For example, hlist_del_init_rcu() leaves the node in unhashed state, - * but hlist_nulls_del() does not. Unlike hlist_nulls_unhashed(), this - * function may be used locklessly. - */ -static inline int hlist_nulls_unhashed_lockless(const struct hlist_nulls_node *h) { return !READ_ONCE(h->pprev); }