Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1991409ybl; Sat, 25 Jan 2020 13:42:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz7xqJCaCzN7rQGcoExbq9lK2S19+yib4arZmKcG1c962+2MAvNQeAk9sSt6unNpCexEXEQ X-Received: by 2002:a9d:7590:: with SMTP id s16mr7069235otk.89.1579988542088; Sat, 25 Jan 2020 13:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579988542; cv=none; d=google.com; s=arc-20160816; b=Whjn1cYSeU6yOCw9g/qEBCSI2kN5NLTlFtnaF1+Sz7blVgc1gp8v6g1THUupVzeSR4 gP1kiMvXEhvfPlfvNsNNCD4ZowEgrTA4iEMH5sBGUG9WfZyJgtbzV+1GygsOJWk8Zw4h HzKuSAIJQzErWMYUHq/ft33R7eXrqpGmVIVIcYsRgIXIsH7kGr3ME6iH2jXUQPCzsggt Z4/IdMBT6wWfbgwnA2wJLDe0QCx9KX3gnkGxBM8BvoTZSj9I5hnfgIrDFYYCb0f0wCKS N+7hjWyXY5sX5P7Gbk0cjeRQOzquUatvWstr4QdfZVM58bLEMQRjJjva0Ud2/4zs1/4j f9yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date; bh=363iVXIGPLRIt3Cwzxyft//xjavNuUZUziym2XczcrA=; b=O40ThiNR4xJlD9hOkRAPzd6TFcrkrfKmCLL7/LBD3dWkZITcmasxmfHjqj9TVrzs/S LPqE4Yt8MWAkky5yRC2oi1VlMWOGzmKzQ5fIwzbTqgDHKrWnRStXdjZDvkiIfMBl8H2p aiWD7jaCB/StK6BYLV9L7IczyAkczycxI6ARXdUrtAXmsaDEPdJOj4uRbdWXC467NJ4R a8mZfmIlwK3d+XsZeU/Xjw26dA8B3n1ajEv52t8sXIQedNlk+eERC0iHjxfJyvYjOWTe tpIwiEHtnPQXJIZwWp/5PMNTUeGV7U32tWx0aXPiBymdg33ZSXW0vSZ7hase7mhnm3jl d/Bg== 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 e9si4620044otk.318.2020.01.25.13.42.08; Sat, 25 Jan 2020 13:42:22 -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; 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 S1727278AbgAYVlN convert rfc822-to-8bit (ORCPT + 99 others); Sat, 25 Jan 2020 16:41:13 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33587 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbgAYVlN (ORCPT ); Sat, 25 Jan 2020 16:41:13 -0500 Received: by mail-wr1-f66.google.com with SMTP id b6so6364690wrq.0 for ; Sat, 25 Jan 2020 13:41:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=4Jsw+sl3rZeed96mR3AsM5sE56n8KXiFC5Ae1nN2OVo=; b=nEOv0yqo3AT60r69NkD2W8qNgjemdP5+zy2V3Pymdx2N9mbsoWmQe+KM9KyI8CRoh7 mVw+SkmVzV3iDqq/zicnMKBNC991p1NV1s3NR66cTpiRx3xCYI9t/88jEejhCW0c6FzD GkPwSi63yk9oTiw5N7wbEFZa/xGDTR674vkPi1oCth+q8x72McdEWAasWxzXN+nHZaXY TK7T+/PhRM8gMJAeEPR+swLtXvWm60SGEq4zApQ+egt7s697zM0Z+GkP/FXsUXLvTYen 8zqdKSbQzLlHR6c1uW8Ge3rVCYwEGjz3wb502Ru3WZblZ6oajg24gECAi8E0S6znv2nN 3Q8Q== X-Gm-Message-State: APjAAAW2a36eAo7xezvmW3DhY123aKFiRxbmiGwXkRhvgLJS8R34XUkp zRrsfr7YvyDGNCldvBCW1+ROsw== X-Received: by 2002:adf:df8e:: with SMTP id z14mr11369912wrl.190.1579988471090; Sat, 25 Jan 2020 13:41:11 -0800 (PST) Received: from ?IPv6:2a00:20:4003:d1ed:ce46:92a4:be2:c2c2? ([2a00:20:4003:d1ed:ce46:92a4:be2:c2c2]) by smtp.gmail.com with ESMTPSA id g79sm11149436wme.17.2020.01.25.13.41.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Jan 2020 13:41:10 -0800 (PST) Date: Sat, 25 Jan 2020 22:41:06 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <20200124045908.26389-1-madhuparnabhowmik10@gmail.com> References: <20200124045908.26389-1-madhuparnabhowmik10@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH] sched.h: Annotate sighand_struct with __rcu To: madhuparnabhowmik10@gmail.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, ebiederm@xmission.com, oleg@redhat.com, paulmck@kernel.org CC: joel@joelfernandes.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, frextrite@gmail.com, rcu@vger.kernel.org, Madhuparna Bhowmik From: Christian Brauner Message-ID: <37A3FF92-0958-46DD-AFB1-CE72000B153F@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >--- > 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. Thanks! Christian