Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2128426ybl; Sat, 25 Jan 2020 17:25:08 -0800 (PST) X-Google-Smtp-Source: APXvYqw4eOBD8abY7VWrGx+On+AjVuzrA4b9P8xJ5rh2mNHPUlHdDpCmUUL5XSGYQ11v2QQkoP2n X-Received: by 2002:a9d:68d1:: with SMTP id i17mr7580640oto.367.1580001908221; Sat, 25 Jan 2020 17:25:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580001908; cv=none; d=google.com; s=arc-20160816; b=jkCzaJW49szDRFHIH4EYEK+M6GHtd5wffX8cbyevZHmps7dboUnJKbZRNiMQkSB9tT TjjjBlXtVehduS94q54Cj7ADJ8O0CZ40GIZ1qZDGawbOpp+dyQy2nA/Z8+eMAWytsqMG UsfVLO8IMm8fmwqX0mH5XoFa35G+RUUFr4iFwIkj/EpcOZrPNFEwty4l/Tak8lG50rlz 0TNKWWwH3Ay8yvQEfGh1hqSb0jieVpvnF44AqVV2JTcfKwMm6FjK60zGRokoETihSDD4 ouSepwbzE9KM7HOa6rLYOmalso7CoxJKd7bCqE69Ptuko7SAlx3LwYFW0y5wzTVMEZHR 1AJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=nLlygxaYm91Oy78PPxXyPXqfYRSsUwp7cmO+xg8INkg=; b=ZgNdnKOVY62iyy19nKL11eM01a5HSHMKXjxHLaznYRPO/5oLErV7Fj2MOkYLBPYlpS V95tGwdOnaGGvfp+giOey5c/Zth6ywt2jezHTSRj/h+slqsYih/LgWRiGVMuH0dv/WXQ qeVGCDlL6orXx712yG0LOqOCO5/1/Ka68KHNUMkWdI0pIY7zvCLVAynLzwWtm2Iz6OHC qHIUERMo/OlFymTw7OVQsPimcK/lKM+qIFdCY5c+C0bj4Htldi5oEVpAWt0svlKufWhh QDTtgv3tzPSMHjIaSz2o074bWr/2OqsnP+VEKnMzv/GV630ckfscv60bJE1c9yZgYh4O 5vCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cHMhoBBG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f60si4551014otf.119.2020.01.25.17.24.54; Sat, 25 Jan 2020 17:25:08 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=cHMhoBBG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729074AbgAZBXz (ORCPT + 99 others); Sat, 25 Jan 2020 20:23:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:48778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728792AbgAZBXz (ORCPT ); Sat, 25 Jan 2020 20:23:55 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D35DE2071E; Sun, 26 Jan 2020 01:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580001834; bh=GT9CakDKgzHGUsSd9Pzep51RqWx2T4j5nL8jJpuNXfU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=cHMhoBBGZV26DndY6i79l0/oheY4IbhYgCsuqfMECWp+RWh41bvab2aVqy5sh4VP2 zzY5c7ceHPkAgkzOeJIIw+jRuMUcrqF1H9vWDxzZF26XayhojEOK1n8F6qZrqmiqZb iWqsFYhbU643ZDKtlj+M0bfkHQQLNXzrJJ2KrkZc= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id A43853522863; Sat, 25 Jan 2020 17:23:54 -0800 (PST) Date: Sat, 25 Jan 2020 17:23:54 -0800 From: "Paul E. McKenney" To: Christian Brauner Cc: madhuparnabhowmik10@gmail.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, ebiederm@xmission.com, oleg@redhat.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, frextrite@gmail.com, rcu@vger.kernel.org Subject: Re: [PATCH] sched.h: Annotate sighand_struct with __rcu Message-ID: <20200126012354.GH2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200124045908.26389-1-madhuparnabhowmik10@gmail.com> <37A3FF92-0958-46DD-AFB1-CE72000B153F@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37A3FF92-0958-46DD-AFB1-CE72000B153F@ubuntu.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 25, 2020 at 10:41:06PM +0100, Christian Brauner wrote: > On January 24, 2020 5:59:08 AM GMT+01:00, madhuparnabhowmik10@gmail.com wrote: > >From: Madhuparna Bhowmik > > > >This patch fixes the following sparse errors by annotating the > >sighand_struct with __rcu > > > >kernel/fork.c:1511:9: error: incompatible types in comparison > >expression > >kernel/exit.c:100:19: error: incompatible types in comparison > >expression > >kernel/signal.c:1370:27: error: incompatible types in comparison > >expression > > > >This fix introduces the following sparse error in signal.c due to > >checking the sighand pointer without rcu primitives: > > > >kernel/signal.c:1386:21: error: incompatible types in comparison > >expression > > > >This new sparse error is also fixed in this patch. > > > >Signed-off-by: Madhuparna Bhowmik Acked-by: Paul E. McKenney > >--- > > include/linux/sched.h | 2 +- > > kernel/signal.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > >diff --git a/include/linux/sched.h b/include/linux/sched.h > >index b511e178a89f..7a351360ad54 100644 > >--- a/include/linux/sched.h > >+++ b/include/linux/sched.h > >@@ -918,7 +918,7 @@ struct task_struct { > > > > /* Signal handlers: */ > > struct signal_struct *signal; > >- struct sighand_struct *sighand; > >+ struct sighand_struct __rcu *sighand; > > sigset_t blocked; > > sigset_t real_blocked; > > /* Restored if set_restore_sigmask() was used: */ > >diff --git a/kernel/signal.c b/kernel/signal.c > >index bcd46f547db3..9ad8dea93dbb 100644 > >--- a/kernel/signal.c > >+++ b/kernel/signal.c > >@@ -1383,7 +1383,7 @@ struct sighand_struct *__lock_task_sighand(struct > >task_struct *tsk, > > * must see ->sighand == NULL. > > */ > > spin_lock_irqsave(&sighand->siglock, *flags); > >- if (likely(sighand == tsk->sighand)) > >+ if (likely(sighand == rcu_access_pointer(tsk->sighand))) > > break; > > spin_unlock_irqrestore(&sighand->siglock, *flags); > > } > > If Paul is happy with this and nobody wants to take it I'll pick this up. Works for me! Thanx, Paul